https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95318
Bug ID: 95318 Summary: gcc 10.1 on x86_64 fails to build aarch64 cross-compiler when using default optimization settings Product: gcc Version: 10.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: bootstrap Assignee: unassigned at gcc dot gnu.org Reporter: bneumeier at gmail dot com Target Milestone: --- This issue is seen when building an X86_64-to-AArch64 cross-compiler using GCC 10.1. `gcc -v` on the host computer reports: ---------- Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/home/cbl/cbltools/libexec/gcc/x86_64-pc-linux-gnu/10.1.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /path/to/gcc-10.1.0/configure --prefix=/home/cbl/cbltools --with-local-prefix=/home/cbl/cbltools --disable-multilib --disable-nls --enable-shared --enable-languages=c,c++ --enable-c99 --enable-long-long --enable-threads=posix --with-gmp=/home/cbl/cbltools --with-mpfr=/home/cbl/cbltools --with-mpc=/home/cbl/cbltools --with-isl=/home/cbl/cbltools Thread model: posix Supported LTO compression algorithms: zlib gcc version 10.1.1 20200507 (GCC) ---------- The cross-compiler build was configured with: ../gcc-10.1.0/configure --prefix=/home/cbl/work/cross-tools --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=aarch64-cbl-linux-gnu --with-sysroot=/home/cbl/work/sysroot --with-build-sysroot=/home/cbl/work/sysroot --disable-decimal-float --disable-libgomp --disable-libmudflap --disable-libssp --disable-multilib --disable-nls --disable-shared --disable-threads --enable-languages=c,c++ --with-newlib --without-headers --with-gmp=/home/cbl/cbltools --with-mpfr=/home/cbl/cbltools --with-mpc=/home/cbl/cbltools --with-isl=/home/cbl/cbltools --enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419 --with-cpu=cortex-a72.cortex-a53 The issue is encountered after successfully completing the `all-gcc` make target, and running `make all-target-libgcc`. Compilation of libgcc/unwind-c.c produces errors: /home/cbl/work/build/build-gcc-2/./gcc/xgcc -B/home/cbl/work/build/build-gcc-2/./gcc/ -B/home/cbl/work/cross-tools/aarch64-cbl-linux-gnu/bin/ -B/home/cbl/work/cross-tools/aarch64-cbl-linux-gnu/lib/ -isystem /home/cbl/work/cross-tools/aarch64-cbl-linux-gnu/include -isystem /home/cbl/work/cross-tools/aarch64-cbl-linux-gnu/sys-include --sysroot=/home/cbl/work/sysroot -g -O2 -O2 -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag -Wstrict-prototypes -Wmissing-prototypes -Wno-error=format-diag -Wold-style-definition -isystem ./include -fPIC -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -Dinhibit_libc -fPIC -I. -I. -I../.././gcc -I/home/cbl/work/build/gcc-10.1.0/libgcc -I/home/cbl/work/build/gcc-10.1.0/libgcc/. -I/home/cbl/work/build/gcc-10.1.0/libgcc/../gcc -I/home/cbl/work/build/gcc-10.1.0/libgcc/../include -DHAVE_CC_TLS -o unwind-c.o -MT unwind-c.o -MD -MP -MF unwind-c.dep -fexceptions -c /home/cbl/work/build/gcc-10.1.0/libgcc/unwind-c.c -fvisibility=hidden -DHIDE_EXPORTS /tmp/cc3usGId.s: Assembler messages: /tmp/cc3usGId.s: Error: invalid operands (*ABS* and *GAS `expr' section* sections) for `*' when setting `.LVU94' /tmp/cc3usGId.s: Error: can't resolve value for symbol `.LVU94' If I add the `-fno-align-loops` directive, this avoids the errors. I'm attaching the preprocessed source `unwind-c.i`, and the compiled `unwind-c.s` both with `-fno-align-loops` (working) and without (error). After adding `-fno-align-loops` as a workaround, the cross-compiler build completes without further issues. However, actually using the resulting cross-compiler to build a target-native GCC (again, unless -fno-align-loops is specified) fails with similar error messages on several other files, e.g.: aarch64-cbl-linux-gnu-g++ -fno-PIE -c -g -O2 -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -I. -I. -I/home/cbl/work/build/gcc-10.1.0/gcc -I/home/cbl/work/build/gcc-10.1.0/gcc/. -I/home/cbl/work/build/gcc-10.1.0/gcc/../include -I/home/cbl/work/build/gcc-10.1.0/gcc/../libcpp/include -I/home/cbl/work/sysroot/scaffolding/include -I/home/cbl/work/sysroot/scaffolding/include -I/home/cbl/work/sysroot/scaffolding/include -I/home/cbl/work/build/gcc-10.1.0/gcc/../libdecnumber -I/home/cbl/work/build/gcc-10.1.0/gcc/../libdecnumber/dpd -I../libdecnumber -I/home/cbl/work/build/gcc-10.1.0/gcc/../libbacktrace -I/home/cbl/work/sysroot/scaffolding/include -o gimple-low.o -MT gimple-low.o -MMD -MP -MF ./.deps/gimple-low.TPo /home/cbl/work/build/gcc-10.1.0/gcc/gimple-low.c /tmp/ccMqyaI0.s: Assembler messages: /tmp/ccMqyaI0.s: Error: invalid operands (*ABS* and *GAS `expr' section* sections) for `*' when setting `.LVU289' /tmp/ccMqyaI0.s: Error: can't resolve value for symbol `.LVU289' If that's interesting enough to provide additional details on, please let me know and I'll attach relevant files for those issues as well.