Skip to content

Commit 2c7b433

Browse files
nickdesaulniersAlexisPerry
authored andcommitted
[libc][startup] set --target= for linker when cross compiling (llvm#96342)
Otherwise the startup objects will fail to link since they were cross compiled, but the linker is not informed of the intent to cross compile, which results in linker errors when the host architecture does not match the target architecture.
1 parent 81291a6 commit 2c7b433

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libc/startup/linux/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function(merge_relocatable_object name)
2626
)
2727
# Pass -r to the driver is much cleaner than passing -Wl,-r: the compiler knows it is
2828
# a relocatable linking and will not pass other irrelevant flags to the linker.
29-
target_link_options(${relocatable_target} PRIVATE -r -nostdlib)
29+
target_link_options(${relocatable_target} PRIVATE -r -nostdlib --target=${explicit_target_triple})
3030
set_target_properties(
3131
${relocatable_target}
3232
PROPERTIES

0 commit comments

Comments
 (0)