Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]>
- Loading branch information