ld.conf 13 KB

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