Skip to content

Commit 32d05db

Browse files
[libc][startup] set --target= for linker when cross compiling (#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 7b57a1b commit 32d05db

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)