Skip to content

Commit b6766ae

Browse files
thugheskartben
authored andcommitted
cmake: compiler: Remove -fshort-enums
"-fshort-enums" changes the ABI. It's not enabled for gcc, so it's not clear why it's enabled for clang (only ARM) and armclang, other than it looks like some users of these toolchains may be linking against code that is compiled with "-fshort-enums". As an example, when compiling with clang, CONFIG_LTO, and a toolchain built without "-fshort-enums", the linker warns: ld.lld: error: linking module flags 'min_enum_size': IDs have conflicting values in '/usr/armv7m-cros-eabi/usr/lib/libc++_static.a(string.cpp.o at 784090)' and 'ld-temp.o' Signed-off-by: Tom Hughes <[email protected]>
1 parent c773f42 commit b6766ae

File tree

2 files changed

+0
-11
lines changed

2 files changed

+0
-11
lines changed

cmake/compiler/armclang/target.cmake

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ include(${ZEPHYR_BASE}/cmake/gcc-m-fpu.cmake)
1616
# 'cortex-m33+nodsp' we need that to be 'cortex-m33' for CMAKE_SYSTEM_PROCESSOR
1717
string(REGEX REPLACE "\\+.*" "" CMAKE_SYSTEM_PROCESSOR ${GCC_M_CPU})
1818

19-
list(APPEND TOOLCHAIN_C_FLAGS
20-
-fshort-enums
21-
)
22-
2319
if(CONFIG_ARM64)
2420
list(APPEND TOOLCHAIN_C_FLAGS -mcpu=${GCC_M_CPU})
2521

cmake/compiler/clang/target.cmake

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,6 @@ if(NOT "${ARCH}" STREQUAL "posix")
2929
include(${ZEPHYR_BASE}/cmake/gcc-m-fpu.cmake)
3030

3131
if("${ARCH}" STREQUAL "arm")
32-
list(APPEND TOOLCHAIN_C_FLAGS
33-
-fshort-enums
34-
)
35-
list(APPEND TOOLCHAIN_LD_FLAGS
36-
-fshort-enums
37-
)
38-
3932
include(${ZEPHYR_BASE}/cmake/compiler/clang/target_arm.cmake)
4033
elseif("${ARCH}" STREQUAL "arm64")
4134
include(${ZEPHYR_BASE}/cmake/compiler/clang/target_arm64.cmake)

0 commit comments

Comments
 (0)