Skip to content

Commit 7e232b0

Browse files
committed
linker/ld: libgcc on aarch64 always uses strchr
Make the modification of the link_order_library to add libc after libgcc for aarch64 independent of the C library. Leave the addition of the math library specific to newlib. Signed-off-by: Keith Packard <[email protected]>
1 parent d334bef commit 7e232b0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

cmake/linker/ld/linker_libraries.cmake

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,16 @@ if(CONFIG_CPP
2727
endif()
2828

2929

30-
if(CONFIG_NEWLIB_LIBC AND CMAKE_C_COMPILER_ID STREQUAL "GNU")
30+
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
3131
# We are using c;rt;c (expands to '-lc -lgcc -lc') in code below.
32-
# This is needed because when linking with newlib on aarch64, then libgcc has a
32+
# This is needed because when linking on aarch64, then libgcc has a
3333
# link dependency to libc (strchr), but libc also has dependencies to libgcc.
3434
# Lib C depends on libgcc. e.g. libc.a(lib_a-fvwrite.o) references __aeabi_idiv
35-
set_property(TARGET linker APPEND PROPERTY link_order_library "math;c;rt;c")
35+
if (CONFIG_NEWLIB_LIBC)
36+
set_property(TARGET linker APPEND PROPERTY link_order_library "math;c;rt;c")
37+
else()
38+
set_property(TARGET linker APPEND PROPERTY link_order_library "c;rt;c")
39+
endif()
3640
else()
3741
set_property(TARGET linker APPEND PROPERTY link_order_library "c;rt")
3842
endif()

0 commit comments

Comments
 (0)