[libc-commits] [libc] [libc][startup] check that we're cross compiling and using LLD (PR #96357)
via libc-commits
libc-commits at lists.llvm.org
Fri Jun 21 13:49:05 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: Nick Desaulniers (paternity leave) (nickdesaulniers)
<details>
<summary>Changes</summary>
We only need to set `--target=` for LLD when cross compiling. This should fix
the host build using BFD.
Fixes: #<!-- -->96342
---
Full diff: https://github.com/llvm/llvm-project/pull/96357.diff
1 Files Affected:
- (modified) libc/startup/linux/CMakeLists.txt (+5-1)
``````````diff
diff --git a/libc/startup/linux/CMakeLists.txt b/libc/startup/linux/CMakeLists.txt
index 31c0ada31aebd..ece88c25a4aa8 100644
--- a/libc/startup/linux/CMakeLists.txt
+++ b/libc/startup/linux/CMakeLists.txt
@@ -26,7 +26,11 @@ function(merge_relocatable_object name)
)
# Pass -r to the driver is much cleaner than passing -Wl,-r: the compiler knows it is
# a relocatable linking and will not pass other irrelevant flags to the linker.
- target_link_options(${relocatable_target} PRIVATE -r -nostdlib --target=${explicit_target_triple})
+ set(link_opts -r -nostdlib)
+ if (explicit_target_triple)
+ list(APPEND link_opts --target=${explicit_target_triple})
+ endif()
+ target_link_options(${relocatable_target} PRIVATE ${link_opts})
set_target_properties(
${relocatable_target}
PROPERTIES
``````````
</details>
https://github.com/llvm/llvm-project/pull/96357
More information about the libc-commits
mailing list