Skip to content

Commit 17e0cd3

Browse files
committed
Force -fno-common on old GCC versions
Force older GCC versions to place uninitialized global variables in the BSS section. This will cause linking errors if the same global variable is defined in different compilation units that should be linked in the end.
1 parent 87b0a3f commit 17e0cd3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

toolchain/toolchain-arm-none-eabi.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ set( CMAKE_OBJCOPY ${TC_PATH}${CROSS_COMPILE}objcopy
2626
set( CMAKE_OBJDUMP ${TC_PATH}${CROSS_COMPILE}objdump
2727
CACHE FILEPATH "The toolchain objdump command " FORCE )
2828

29-
set(COMMON_FLAGS "-fno-builtin -ffunction-sections -fdata-sections -fno-strict-aliasing -fmessage-length=0")
29+
set(COMMON_FLAGS "-fno-common -fno-builtin -ffunction-sections -fdata-sections -fno-strict-aliasing -fmessage-length=0")
3030
set(CMAKE_C_FLAGS "${COMMON_FLAGS} -std=gnu99")
3131
set(CMAKE_CXX_FLAGS "${COMMON_FLAGS} -std=gnu++0x")
3232
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-gc-sections --specs=nosys.specs -nostdlib -static -nostartfiles")

0 commit comments

Comments
 (0)