Skip to content

Commit e020f31

Browse files
jonathonpenixmmahadevan108
authored andcommitted
cmake: libc: minimal: Avoid linking against other libc implementations
The minimal libc is currently built as a zephyr_library and will be included in the final link line as such. However, the c_library property will still be set as "-lc" (for most linkers) and will be added to the link line. This effectively requires that a separate libc implementation be available in the toolchain and makes it possible to accidentally pull from the non-minimal libc. This doesn't seem desirable, so try to prevent this by clearing the c_library property if we are using the minimal libc. Signed-off-by: Jonathon Penix <[email protected]>
1 parent d7765cc commit e020f31

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/libc/minimal/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# SPDX-License-Identifier: Apache-2.0
22

3+
# As minimal libc will be built as a zephyr_library, clear c_library to
4+
# prevent accidentally requiring or linking against another libc implementation.
5+
set_property(TARGET linker PROPERTY c_library "")
6+
37
zephyr_system_include_directories(include)
48

59
zephyr_library()

0 commit comments

Comments
 (0)