https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87793
Bug ID: 87793 Summary: GCC reports error when compiling with "-fpic -Os -g" Product: gcc Version: 8.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: bmeng.cn at gmail dot com Target Milestone: --- Created attachment 44921 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44921&action=edit minimal test case (test.c) and the preprocessed file (test.i) # Command line to call compiler $ /share/toolchains/gcc-8.1.0-nolibc/i386-linux/bin/i386-linux-gcc -march=i386 -m32 -c test.c -o test.o -fpic -Os -g --save-temps -v # Output Using built-in specs. COLLECT_GCC=/share/toolchains/gcc-8.1.0-nolibc/i386-linux/bin/i386-linux-gcc Target: i386-linux Configured with: /home/arnd/git/gcc/configure --target=i386-linux --enable-targets=all --prefix=/home/arnd/cross/x86_64/gcc-8.1.0-nolibc/i386-linux --enable-languages=c --without-headers --disable-bootstrap --disable-nls --disable-threads --disable-shared --disable-libmudflap --disable-libssp --disable-libgomp --disable-decimal-float --disable-libquadmath --disable-libatomic --disable-libcc1 --disable-libmpx --enable-checking=release : (reconfigured) /home/arnd/git/gcc/configure --target=i386-linux --enable-targets=all --prefix=/home/arnd/cross/x86_64/gcc-8.1.0-nolibc/i386-linux --enable-languages=c --without-headers --disable-bootstrap --disable-nls --disable-threads --disable-shared --disable-libmudflap --disable-libssp --disable-libgomp --disable-decimal-float --disable-libquadmath --disable-libatomic --disable-libcc1 --disable-libmpx --enable-checking=release Thread model: single gcc version 8.1.0 (GCC) COLLECT_GCC_OPTIONS='-march=i386' '-m32' '-c' '-o' 'test.o' '-fpic' '-Os' '-g' '-save-temps' '-v' /share/toolchains/gcc-8.1.0-nolibc/i386-linux/bin/../libexec/gcc/i386-linux/8.1.0/cc1 -E -quiet -v -iprefix /share/toolchains/gcc-8.1.0-nolibc/i386-linux/bin/../lib/gcc/i386-linux/8.1.0/ test.c -march=i386 -m32 -fpic -g -fworking-directory -Os -fpch-preprocess -o test.i ignoring nonexistent directory "/share/toolchains/gcc-8.1.0-nolibc/i386-linux/bin/../lib/gcc/i386-linux/8.1.0/../../../../i386-linux/sys-include" ignoring nonexistent directory "/share/toolchains/gcc-8.1.0-nolibc/i386-linux/bin/../lib/gcc/i386-linux/8.1.0/../../../../i386-linux/include" ignoring duplicate directory "/share/toolchains/gcc-8.1.0-nolibc/i386-linux/bin/../lib/gcc/../../lib/gcc/i386-linux/8.1.0/include" ignoring duplicate directory "/share/toolchains/gcc-8.1.0-nolibc/i386-linux/bin/../lib/gcc/../../lib/gcc/i386-linux/8.1.0/include-fixed" ignoring nonexistent directory "/share/toolchains/gcc-8.1.0-nolibc/i386-linux/bin/../lib/gcc/../../lib/gcc/i386-linux/8.1.0/../../../../i386-linux/sys-include" ignoring nonexistent directory "/share/toolchains/gcc-8.1.0-nolibc/i386-linux/bin/../lib/gcc/../../lib/gcc/i386-linux/8.1.0/../../../../i386-linux/include" #include "..." search starts here: #include <...> search starts here: /share/toolchains/gcc-8.1.0-nolibc/i386-linux/bin/../lib/gcc/i386-linux/8.1.0/include /share/toolchains/gcc-8.1.0-nolibc/i386-linux/bin/../lib/gcc/i386-linux/8.1.0/include-fixed End of search list. COLLECT_GCC_OPTIONS='-march=i386' '-m32' '-c' '-o' 'test.o' '-fpic' '-Os' '-g' '-save-temps' '-v' /share/toolchains/gcc-8.1.0-nolibc/i386-linux/bin/../libexec/gcc/i386-linux/8.1.0/cc1 -fpreprocessed test.i -quiet -dumpbase test.c -march=i386 -m32 -auxbase-strip test.o -g -Os -version -fpic -o test.s GNU C17 (GCC) version 8.1.0 (i386-linux) compiled by GNU C version 5.4.1 20170519, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version isl-0.18-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU C17 (GCC) version 8.1.0 (i386-linux) compiled by GNU C version 5.4.1 20170519, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version isl-0.18-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 5b6be85f431a859ca20ca7e588057ee0 COLLECT_GCC_OPTIONS='-march=i386' '-m32' '-c' '-o' 'test.o' '-fpic' '-Os' '-g' '-save-temps' '-v' /share/toolchains/gcc-8.1.0-nolibc/i386-linux/bin/../lib/gcc/i386-linux/8.1.0/../../../../i386-linux/bin/as -v --32 -o test.o test.s GNU assembler version 2.30 (i386-linux) using BFD version (GNU Binutils) 2.30 test.s: Assembler messages: test.s:715: Error: junk at end of line, first unrecognized character is `@' test.s:760: Error: junk at end of line, first unrecognized character is `@' test.s:715: Error: can't resolve `end.1561' {.u_boot_list_2_fit_loadable_3 section} - `start.1558' {.u_boot_list_2_fit_loadable_1 section} test.s:760: Error: can't resolve `end.1561' {.u_boot_list_2_fit_loadable_3 section} - `start.1558' {.u_boot_list_2_fit_loadable_1 section} # Workaround Removing -fpic or -Os or -g will make the compilation succeed. GCC 7.3.0 does not have this issue with the same compiler options. Looks a regression issue introduced in GCC 8.1.0 (?)