ld.conf 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. LDFLAGS+=$USER_LDFLAGS $_LD_FLAGS
  2. _START_GROUP=
  3. _END_GROUP=
  4. BEFORE_PEERS=
  5. AFTER_PEERS=
  6. START_WHOLE_ARCHIVE_VALUE=
  7. END_WHOLE_ARCHIVE_VALUE=
  8. LD_STRIP_FLAG=
  9. _SONAME_OPTION=
  10. _LD_SRCS_GLOBALS=--start-wa ${rootrel;ext=.a:SRCS_GLOBAL} --end-wa ${rootrel;ext=.o:SRCS_GLOBAL} ${rootrel;ext=.supp:SRCS_GLOBAL}
  11. when ($OS_LINUX == "yes" || $OS_ANDROID == "yes" || $OS_CYGWIN == "yes" || $OS_NONE == "yes") {
  12. _START_GROUP=-Wl,--start-group
  13. _END_GROUP=-Wl,--end-group
  14. START_WHOLE_ARCHIVE_VALUE=-Wl,--whole-archive
  15. END_WHOLE_ARCHIVE_VALUE=-Wl,--no-whole-archive
  16. LD_STRIP_FLAG=-s
  17. _SONAME_OPTION=-soname
  18. _LD_SRCS_GLOBALS=-Wl,--whole-archive --ya-start-command-file ${rootrel;ext=.a:SRCS_GLOBAL} --ya-end-command-file -Wl,--no-whole-archive ${rootrel;ext=.o:SRCS_GLOBAL} ${rootrel;ext=.supp:SRCS_GLOBAL}
  19. }
  20. when ($_LD_WHOLE_ARCHIVE == "yes") {
  21. }
  22. when ($OS_DARWIN == "yes" || $OS_IOS == "yes") {
  23. _SONAME_OPTION=-install_name
  24. }
  25. _LD_LINKER_OUTPUT=
  26. _LD_LINKER_OUTPUT_FLAG=--linker-output ${output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX$MODULE_VERSION.linker.txt:REALPRJNAME}
  27. # Enable section-level DCE (dead code elimination):
  28. # remove whole unused code and data sections
  29. # (needs `-ffunction-sections` and `-fdata-sections` to be useful)
  30. #
  31. # NOTE: CGO linker doesn't seem to support DCE, but shares common LDFLAGS
  32. _LD_DCE_FLAG_GC_SECTIONS=
  33. _LD_DCE_FLAG_PRINT_SECTIONS=
  34. when ($OS_DARWIN == "yes" || $OS_IOS == "yes" || $OS_IOSSIM == "yes") {
  35. _LD_DCE_FLAG_GC_SECTIONS=-Wl,-dead_strip
  36. }
  37. elsewhen ($OS_LINUX == "yes" || $OS_ANDROID == "yes" || $OS_NONE == "yes") {
  38. _LD_DCE_FLAG_GC_SECTIONS=-Wl,--gc-sections
  39. when ($LINKER_DCE_PRINT_SECTIONS == "yes") {
  40. _LD_DCE_FLAG_PRINT_SECTIONS=-Wl,--print-gc-sections
  41. _LD_LINKER_OUTPUT=$_LD_LINKER_OUTPUT_FLAG
  42. }
  43. }
  44. LD_DCE_FLAG =
  45. LD_DCE_FLAG+=$_LD_DCE_FLAG_GC_SECTIONS
  46. LD_DCE_FLAG+=$_LD_DCE_FLAG_PRINT_SECTIONS
  47. DCE_FLAG=
  48. _LD_ICF_FLAG=
  49. _LD_ICF_FLAG_PRINT_SECTIONS=
  50. when ($_DEFAULT_LINKER_ID == "lld") {
  51. # Enable ICF (identical code folding pass) in safe mode
  52. # https://research.google/pubs/pub36912/
  53. _LD_ICF_FLAG=-Wl,--icf=safe
  54. when ($LINKER_ICF_PRINT_SECTIONS == "yes") {
  55. _LD_ICF_FLAG_PRINT_SECTIONS=-Wl,--print-icf-sections
  56. _LD_LINKER_OUTPUT=$_LD_LINKER_OUTPUT_FLAG
  57. }
  58. }
  59. LD_ICF_FLAG =
  60. LD_ICF_FLAG+=$_LD_ICF_FLAG
  61. LD_ICF_FLAG+=$_LD_ICF_FLAG_PRINT_SECTIONS
  62. ICF_FLAG=
  63. _LD_NO_PIE_FLAG=
  64. when ($_LINKER_ID == "lld" && $PIE != "yes" && ($PIC != "yes" || $PIC_NO_PIE == "yes")) {
  65. when ($OS_LINUX == "yes") {
  66. _LD_NO_PIE_FLAG=-Wl,-no-pie
  67. }
  68. }
  69. STRIP_FLAG=
  70. C_LIBRARY_PATH=
  71. C_SYSTEM_LIBRARIES_INTERCEPT=
  72. when ($USEMPROF == "yes" || $USE_MPROF == "yes") {
  73. C_SYSTEM_LIBRARIES_INTERCEPT+=-ldmalloc
  74. }
  75. _LD_THREAD_LIBRARY=
  76. when ($OS_LINUX == "yes" || $OS_DARWIN == "yes") {
  77. _LD_THREAD_LIBRARY=-lpthread
  78. }
  79. _LD_USE_STDLIB=
  80. when ($_BUILD_COVERAGE == "yes" || $GCOV_COVERAGE == "yes" || $CLANG_COVERAGE == "yes" || $_BUILD_SANITIZED == "yes") {
  81. _LD_USE_STDLIB=
  82. }
  83. elsewhen ($OS_ANDROID == "yes") {
  84. when ($_ANDROID_NDK_VERSION_LESS_THEN_23 == "yes") {
  85. # Preserve old behaviour: specify runtime libs manually
  86. _LD_USE_STDLIB=-nodefaultlibs
  87. }
  88. otherwise {
  89. # Use toolchain defaults to link with libunwind/clang_rt.builtins
  90. _LD_USE_STDLIB=-nostdlib++
  91. }
  92. }
  93. elsewhen ($OS_LINUX == "yes" || $OS_DARWIN == "yes" || $OS_IOS == "yes") {
  94. _LD_USE_STDLIB=-nodefaultlibs
  95. }
  96. _C_SYSTEM_LIBRARIES=$_LD_USE_STDLIB $_LD_THREAD_LIBRARY $_LD_SYS_LIB -lc
  97. when ($MUSL == "yes") {
  98. _C_SYSTEM_LIBRARIES=-nostdlib
  99. }
  100. when ($OS_EMSCRIPTEN == "yes") {
  101. _C_SYSTEM_LIBRARIES=-nostdlib
  102. }
  103. C_SYSTEM_LIBRARIES=$_C_SYSTEM_LIBRARIES
  104. LD_EXPORT_ALL_DYNAMIC_SYMBOLS_FLAG=
  105. when ($OS_LINUX == "yes" || $OS_ANDROID == "yes") {
  106. LD_EXPORT_ALL_DYNAMIC_SYMBOLS_FLAG=-rdynamic
  107. }
  108. NO_EXPORT_DYNAMIC_SYMBOLS=
  109. EXPORTS_VALUE=$LD_EXPORT_ALL_DYNAMIC_SYMBOLS_FLAG
  110. when ($EXPORTS_FILE) {
  111. EXPORTS_VALUE=$LD_EXPORT_ALL_DYNAMIC_SYMBOLS_FLAG -Wl,--version-script=${input:EXPORTS_FILE}
  112. }
  113. when ($NO_EXPORT_DYNAMIC_SYMBOLS == "yes") {
  114. EXPORTS_VALUE=
  115. }
  116. LINKER_SCRIPT_VALUE=${ext=.ld;pre=-T:SRCS_GLOBAL}
  117. _LINKER_TIME_TRACE_GRANULARITY=500
  118. when ($TIME_TRACE_GRANULARITY && $TIME_TRACE_GRANULARITY != "") {
  119. _LINKER_TIME_TRACE_GRANULARITY=$TIME_TRACE_GRANULARITY
  120. }
  121. _LINKER_TIME_TRACE_FLAG=
  122. when (($TIME_TRACE == "yes" || $LINKER_TIME_TRACE == "yes") && $_DEFAULT_LINKER_ID == "lld") {
  123. _LINKER_TIME_TRACE_FLAG=\
  124. -Wl,--time-trace=${rootrel;output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX.time_trace.json:REALPRJNAME} \
  125. -Wl,--time-trace-granularity=$_LINKER_TIME_TRACE_GRANULARITY
  126. }
  127. _EXE_FLAGS=\
  128. $C_FLAGS_PLATFORM \
  129. $BEFORE_PEERS \
  130. $_START_GROUP \
  131. ${rootrel:PEERS} \
  132. $_END_GROUP \
  133. $AFTER_PEERS \
  134. $EXPORTS_VALUE \
  135. $LINKER_SCRIPT_VALUE \
  136. $LDFLAGS \
  137. $LDFLAGS_GLOBAL \
  138. $OBJADDE \
  139. $OBJADDE_LIB \
  140. $OBJADDE_LIB_GLOBAL \
  141. $C_LIBRARY_PATH \
  142. $C_SYSTEM_LIBRARIES_INTERCEPT \
  143. $C_SYSTEM_LIBRARIES \
  144. $STRIP_FLAG \
  145. $DCE_FLAG \
  146. $ICF_FLAG \
  147. $_LD_NO_PIE_FLAG \
  148. $_LINKER_TIME_TRACE_FLAG
  149. _SONAME_FLAG=-Wl,$_SONAME_OPTION,$_SONAME
  150. when ($OS_EMSCRIPTEN == "yes") {
  151. _SONAME_FLAG=
  152. }
  153. _SHARED_FLAG=-shared
  154. when ($OS_EMSCRIPTEN == "yes") {
  155. _SHARED_FLAG=-Wl,-shared -Wl,--no-entry -Wl,--export-all -Wl,--import-memory -Wl,--import-undefined
  156. }
  157. _EXEC_SHARED_FLAG=
  158. when ($OS_LINUX == "yes") {
  159. _EXEC_SHARED_FLAG=-pie -fPIE -Wl,--unresolved-symbols=ignore-all -rdynamic
  160. }
  161. _LD_ENV_STYLE=${cwd:ARCADIA_BUILD_ROOT} $TOOLCHAIN_ENV ${hide;kv:"p LD"} ${hide;kv:"pc light-blue"} ${hide;kv:"show_out"}
  162. _ROOT_FLAGS=--source-root $ARCADIA_ROOT --build-root $(BUILD_ROOT)
  163. # Program
  164. GENERATE_MF_CMD=\
  165. $YMAKE_PYTHON ${input:"build/scripts/generate_mf.py"} ${hide;input:"build/scripts/process_command_files.py"} \
  166. --build-root $ARCADIA_BUILD_ROOT \
  167. --module-name $REALPRJNAME \
  168. -o ${rootrel;output;pre=$MODULE_PREFIX;suf=$MODULE_SUFFIX.mf:REALPRJNAME} \
  169. -t $MODULE_TYPE \
  170. --ya-start-command-file \
  171. -Ya,lics $LICENSE_NAMES \
  172. -Ya,peers ${rootrel:PEERS} \
  173. -Ya,credits ${input:CREDITS_TEXTS_FILE} $CREDITS_FLAGS \
  174. --ya-end-command-file
  175. _LINK_SCRIPT_IMPORTS=\
  176. ${hide;input:"build/scripts/fix_py2_protobuf.py"} \
  177. ${hide;input:"build/scripts/thinlto_cache.py"} \
  178. $_PROCESS_WHOLE_ARCHIVE_SCRIPT
  179. LINK_SCRIPT_EXE_FLAGS=
  180. REAL_LINK_EXE_CMDLINE =\
  181. $YMAKE_PYTHON ${input:"build/scripts/link_exe.py"} \
  182. REAL_LINK_EXE_CMDLINE+=--clang-ver $CLANG_VER
  183. REAL_LINK_EXE_CMDLINE+=$_LD_LINKER_OUTPUT
  184. REAL_LINK_EXE_CMDLINE+=\
  185. $_ROOT_FLAGS \
  186. ${pre=--whole-archive-peers :WHOLE_ARCHIVE_PEERS} \
  187. ${pre=--whole-archive-libs :_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL} \
  188. $_LD_ARCH_FLAG \
  189. $LINK_SCRIPT_EXE_FLAGS \
  190. $_THINLTO_CACHE_FLAGS \
  191. $CXX_COMPILER_OLD \
  192. $_LD_SRCS_GLOBALS \
  193. $VCS_C_OBJ $_EXTRA_OBJS $AUTO_INPUT -o $TARGET \
  194. $_EXE_FLAGS \
  195. $_LINK_SCRIPT_IMPORTS \
  196. $_LD_ENV_STYLE
  197. REAL_LINK_EXE_TIDY=\
  198. $YMAKE_PYTHON ${input:"build/scripts/clang_tidy_arch.py"} \
  199. --output-file $TARGET \
  200. $_ROOT_FLAGS \
  201. $AUTO_INPUT \
  202. ${ext=.tidyjson:SRCS_GLOBAL} \
  203. $_LD_ENV_STYLE
  204. # Executable Shared Library
  205. REAL_LINK_EXEC_DYN_LIB_CMDLINE =\
  206. $YMAKE_PYTHON ${input:"build/scripts/link_dyn_lib.py"} \
  207. ${hide;input:"build/scripts/link_exe.py"} \
  208. --target $TARGET
  209. REAL_LINK_EXEC_DYN_LIB_CMDLINE+=$_LD_LINKER_OUTPUT
  210. REAL_LINK_EXEC_DYN_LIB_CMDLINE+=\
  211. $_ROOT_FLAGS \
  212. ${pre=--whole-archive-peers :WHOLE_ARCHIVE_PEERS} \
  213. ${pre=--whole-archive-libs :_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL} \
  214. $_LD_ARCH_FLAG \
  215. $LINK_DYN_LIB_FLAGS \
  216. $_THINLTO_CACHE_FLAGS \
  217. $CXX_COMPILER_OLD \
  218. $_LD_SRCS_GLOBALS \
  219. $VCS_C_OBJ $_EXTRA_OBJS $AUTO_INPUT -o $TARGET \
  220. $_EXEC_SHARED_FLAG \
  221. $_SONAME_FLAG \
  222. $_EXE_FLAGS \
  223. $_LINK_SCRIPT_IMPORTS \
  224. $_LD_ENV_STYLE
  225. REAL_LINK_EXEC_DYN_LIB=$REAL_LINK_EXEC_DYN_LIB_IMPL($_WHOLE_ARCHIVE_PEERS_VALUE)
  226. # Shared Library
  227. LINK_DYN_LIB_FLAGS=
  228. REAL_LINK_DYN_LIB_CMDLINE =\
  229. $YMAKE_PYTHON ${input:"build/scripts/link_dyn_lib.py"} \
  230. ${hide;input:"build/scripts/link_exe.py"} \
  231. --target $TARGET
  232. REAL_LINK_DYN_LIB_CMDLINE+=$_LD_LINKER_OUTPUT
  233. REAL_LINK_DYN_LIB_CMDLINE+=\
  234. ${pre=--whole-archive-peers :WHOLE_ARCHIVE_PEERS} \
  235. ${pre=--whole-archive-libs :_WHOLE_ARCHIVE_LIBS_VALUE_GLOBAL} \
  236. $_ROOT_FLAGS \
  237. $_LD_ARCH_FLAG \
  238. $LINK_DYN_LIB_FLAGS \
  239. $_THINLTO_CACHE_FLAGS \
  240. $CXX_COMPILER_OLD \
  241. $_LD_SRCS_GLOBALS \
  242. $VCS_C_OBJ $_EXTRA_OBJS $AUTO_INPUT -o $TARGET \
  243. $_SHARED_FLAG \
  244. $_SONAME_FLAG \
  245. $_EXE_FLAGS \
  246. $_LINK_SCRIPT_IMPORTS \
  247. $_LD_ENV_STYLE
  248. REAL_LINK_DYN_LIB=$REAL_LINK_DYN_LIB_IMPL($_WHOLE_ARCHIVE_PEERS_VALUE)
  249. _DWARF_COMMAND=
  250. when (($OS_DARWIN == "yes" || $OS_IOS || $OS_IOSSIM) && $NO_DEBUGINFO != "yes" && $SPLIT_DWARF_VALUE != "no" && $NO_SPLIT_DWARF != "yes") {
  251. _DWARF_COMMAND=$DWARF_TOOL $TARGET -o ${output;pre=$MODULE_PREFIX$REALPRJNAME.dSYM/Contents/Resources/DWARF/$MODULE_PREFIX:REALPRJNAME} $_LD_ENV_STYLE
  252. }
  253. elsewhen ($OS_DARWIN == "yes" && $NO_DEBUGINFO != "yes") {
  254. _EXE_FLAGS+=$DEBUG_INFO_FLAGS
  255. }
  256. otherwise {
  257. _DWARF_COMMAND=
  258. }
  259. DWARF_COMMAND=$_DWARF_COMMAND
  260. _REAL_LINK_EXE=$REAL_LINK_EXE_IMPL($_WHOLE_ARCHIVE_PEERS_VALUE)
  261. _EXTRA_OBJS=
  262. _GENERATE_EXTRA_OBJS=
  263. _EXTRA_LINK_CMD=
  264. _LINK_EXE=
  265. _LINK_EXE+=$GENERATE_MF
  266. _LINK_EXE+=&& $GENERATE_VCS_C_INFO_NODEP
  267. _LINK_EXE+=&& $_GENERATE_EXTRA_OBJS
  268. _LINK_EXE+=&& $COPY_PROFILE_RUNTIME
  269. _LINK_EXE+=&& $REAL_LINK_EXE
  270. _LINK_EXE+=&& $DWARF_COMMAND
  271. _LINK_EXE+=&& $LINK_ADDITIONAL_SECTIONS_COMMAND
  272. _LINK_EXE+=&& $PACK_IOS_CMD
  273. _LINK_EXE+=&& $_EXTRA_LINK_CMD
  274. _LINK_DYN_LIB=
  275. _LINK_DYN_LIB+=$GENERATE_MF
  276. _LINK_DYN_LIB+=&& $GENERATE_VCS_C_INFO_NODEP
  277. _LINK_DYN_LIB+=&& $_GENERATE_EXTRA_OBJS
  278. _LINK_DYN_LIB+=&& $COPY_PROFILE_RUNTIME
  279. _LINK_DYN_LIB+=&& $REAL_LINK_DYN_LIB
  280. _LINK_DYN_LIB+=&& $DWARF_COMMAND
  281. _LINK_DYN_LIB+=&& $LINK_ADDITIONAL_SECTIONS_COMMAND
  282. _LINK_DYN_LIB+=&& $_EXTRA_LINK_CMD
  283. when ($TIDY == "yes") {
  284. _REAL_LINK_EXE=$REAL_LINK_EXE_TIDY
  285. _LINK_EXE=$REAL_LINK_EXE
  286. _LINK_DYN_LIB=$REAL_LINK_EXE
  287. }
  288. REAL_LINK_EXE=$_REAL_LINK_EXE
  289. LINK_EXE=$_LINK_EXE
  290. LINK_DYN_LIB=$_LINK_DYN_LIB
  291. LINK_EXEC_DYN_LIB=\
  292. $GENERATE_MF && \
  293. $GENERATE_VCS_C_INFO_NODEP && \
  294. $_GENERATE_EXTRA_OBJS && \
  295. $REAL_LINK_EXEC_DYN_LIB && \
  296. $DWARF_COMMAND && \
  297. $LINK_ADDITIONAL_SECTIONS_COMMAND
  298. SWIG_DLL_JAR_CMD=\
  299. $GENERATE_MF && \
  300. $GENERATE_VCS_C_INFO_NODEP && \
  301. $REAL_SWIG_DLL_JAR_CMD && \
  302. $DWARF_COMMAND
  303. _LD_LINK_LIB_EXTRA_INPUT=
  304. _LD_TAIL_LINK_LIB=$AUTO_INPUT $_LD_LINK_LIB_EXTRA_INPUT ${hide;kv:"p AR"} $TOOLCHAIN_ENV ${hide;kv:"pc light-red"} ${hide;kv:"show_out"}
  305. _LD_ARCHIVER=$YMAKE_PYTHON ${input:"build/scripts/link_lib.py"} ${quo:AR_TOOL} $AR_TYPE $_LD_LLVM_AR_FORMAT $ARCADIA_BUILD_ROOT $_LD_AR_PLUGIN
  306. _LD_LIB_GENERATE_MF=$GENERATE_MF &&
  307. when ($TIDY == "yes") {
  308. _LD_ARCHIVER=$YMAKE_PYTHON ${input:"build/scripts/clang_tidy_arch.py"} --source-root $ARCADIA_ROOT --build-root $ARCADIA_BUILD_ROOT --output-file
  309. _LD_LIB_GENERATE_MF=
  310. }
  311. LINK_LIB=$_LD_LIB_GENERATE_MF $_LD_ARCHIVER $TARGET $_LD_TAIL_LINK_LIB
  312. GLOBAL_LINK_LIB=$_LD_ARCHIVER $GLOBAL_TARGET $_LD_TAIL_LINK_LIB
  313. # "Fat Object" : pre-linked global objects and static library with all dependencies
  314. _LD_LINK_FAT_PREFIX=$GENERATE_MF && $GENERATE_VCS_C_INFO_NODEP && $YMAKE_PYTHON ${input:"build/scripts/link_fat_obj.py"} --build-root $ARCADIA_BUILD_ROOT $_PROCESS_WHOLE_ARCHIVE_SCRIPT
  315. _LD_LINK_FAT_SRCS_GLOBALS_WA=$_LD_SRCS_GLOBALS
  316. _LD_LINK_FAT_SRCS_GLOBALS_NO_WA=${rootrel;ext=.a:SRCS_GLOBAL} ${rootrel;ext=.o:SRCS_GLOBAL}
  317. macro _FAT_OBJECT_ARGS_BASE(Flag, Lib) {
  318. .CMD=$Flag=$Lib
  319. }
  320. # FIXME: pre=lib here is weird legacy
  321. _FAT_OBJECT_ARGS=--obj=${output;pre=lib;suf=.o:REALPRJNAME}
  322. _LD_LINK_FAT_SRCS_GLOBALS=$_LD_LINK_FAT_SRCS_GLOBALS_WA
  323. macro PACK_GLOBALS_IN_LIBRARY() {
  324. SET(_FAT_OBJECT_ARGS $_FAT_OBJECT_ARGS_BASE(--globals-lib, \${output;pre=$MODULE_PREFIX;suf=.globals.a:REALPRJNAME}))
  325. }
  326. when ($OS_ANDROID == "yes") {
  327. _FAT_OBJECT_ARGS=
  328. _LD_LINK_FAT_SRCS_GLOBALS=$_LD_LINK_FAT_SRCS_GLOBALS_NO_WA
  329. }
  330. _LD_LINK_FAT_SUFFIX1=$_LD_ARCH_FLAG \
  331. -Ya,input $AUTO_INPUT $VCS_C_OBJ \
  332. -Ya,global_srcs
  333. _LD_LINK_FAT_SUFFIX2=-Ya,peers $PEERS \
  334. -Ya,linker $CXX_COMPILER_OLD \
  335. $LDFLAGS_GLOBAL $C_FLAGS_PLATFORM $LD_SDK_VERSION \
  336. -Ya,archiver $_LD_ARCHIVER \
  337. $TOOLCHAIN_ENV ${hide;kv:"p LD"} ${hide;kv:"pc light-blue"} ${hide;kv:"show_out"}
  338. LINK_FAT_OBJECT=\
  339. $_LD_LINK_FAT_PREFIX \
  340. --lib=$TARGET $_FAT_OBJECT_ARGS \
  341. $_LD_LINK_FAT_SUFFIX1 \
  342. $_LD_LINK_FAT_SRCS_GLOBALS \
  343. $_LD_LINK_FAT_SUFFIX2
  344. LINK_RECURSIVE_LIBRARY=\
  345. $_LD_LINK_FAT_PREFIX \
  346. --lib=$TARGET --with-own-obj --with-global-srcs \
  347. $_LD_LINK_FAT_SUFFIX1 \
  348. $_LD_LINK_FAT_SRCS_GLOBALS_NO_WA \
  349. $_LD_LINK_FAT_SUFFIX2
  350. LIBRT=-lrt
  351. LIBRESOLV=
  352. when ($OS_LINUX || $OS_DARWIN || $OS_ANDROID) {
  353. LIBRESOLV=-lresolv
  354. }
  355. PROFFLAG=-pg
  356. _THINLTO_CACHE_FLAGS=
  357. macro THINLTO_CACHE(file) {
  358. DEFAULT(THINLTO_CACHE use)
  359. SET(_THINLTO_FILE $file)
  360. when ($CLANG && $USE_THINLTO == "yes") {
  361. select ($THINLTO_CACHE) {
  362. "gen" ? {
  363. _THINLTO_CACHE_FLAGS=--thinlto-cache-write --thinlto-cache=${output;pre=out-:_THINLTO_FILE}
  364. }
  365. "use" ? {
  366. _THINLTO_CACHE_FLAGS=--thinlto-cache=${input:_THINLTO_FILE}
  367. }
  368. }
  369. }
  370. }