https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93732
Bug ID: 93732 Summary: [10 Regression] Incorrect symbol type when activating LTO a compile step Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: laurent.stacul at gmail dot com CC: marxin at gcc dot gnu.org Target Milestone: --- Hello, With gcc (GCC) 10.0.1 20200211 and the following program: #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} If you compile with the LTO support, with the command: $ gcc -c -DNDEBUG -O3 -std=gnu17 -fno-working-directory -ggdb3 -flto -ffat-lto-objects -fuse-linker-plugin conftest.c The symbol nm_test_var will be flagged as in text section. $ nm conftest.o 00000000 T main 00000000 T nm_test_func 00000000 T nm_test_var Whereas, compiling without LTO support as follow: $ $ gcc -c -DNDEBUG -O3 -std=gnu17 -fno-working-directory -ggdb3 -fno-lto -ffat-lto-objects -fuse-linker-plugin conftest.c Will give: $ nm conftest.o 0000000000000000 T main 0000000000000000 T nm_test_func 0000000000000000 B nm_test_var I also compared with gcc (GCC) 9.2.1 20191112. With or without LTO, the result is the same but the symbol nm_test_var is neither in the text section not in the BSS one, but in the common section: 00000000 T main 00000000 T nm_test_func 00000000 C nm_test_var For info, this leads to errors when you build libtoolized libraries (error at configure step). Regards, Laurent