CMakeLists.txt: Enable -fno-common globally.
This is needed to force the .common type to .bss type. This will force the .common variables to go into bss section in the compiled object file. As of now the movement to the .bss section was happening only during the final linking stage. The -fno-common option specifies that the compiler should place uninitialized global variables in the data section of the object file, rather than generating them as common blocks. This has the effect that if the same variable is declared (without "extern") in two different compilations, you will get a multiple-definition error when you link them. e.g: // file a.c // file-scope int b; // file b.c // file-scope int b; If there exist two non-extern declarations of the same variable then no-common will cause a linker error. This sequence would have compiled before, but will now cause a linker error. Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
This commit is contained in:
parent
a65df22525
commit
3e784bc6b5
|
@ -136,6 +136,7 @@ zephyr_compile_options(
|
|||
-imacros ${AUTOCONF_H}
|
||||
-ffreestanding
|
||||
-Wno-main
|
||||
-fno-common
|
||||
${NOSTDINC_F}
|
||||
${TOOLCHAIN_C_FLAGS}
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue