LTO build failure with GCC 13.2.1

Igor Opaniuk igor.opaniuk at foundries.io
Mon Feb 19 22:20:52 CET 2024


Hello Sahaj,

On Fri, Feb 16, 2024 at 5:50 AM Sahaj Sarup <sahaj.sarup at linaro.org> wrote:
>
> Hi all,
>
> Since commit f8cebb4f789c9950caf55a0b73e88049e7a1c3a3 enabled LTO by
> default for imx8m platforms,
> I have been having issues building u-boot.
> I am primarily working on imx8mp instead of imx8mm platforms so the
> bug resolved by that commit doesn't affect me yet.
> But I guess it's a generic issue with u-boot's LTO requirements and GCC 13.
>
> Build log:
> ```
>   LTO     u-boot
> /usr/bin/aarch64-linux-gnu-ld:
> /usr/lib/gcc/aarch64-linux-gnu/13/libgcc.a(lse-init.o): in function
> `init_have_lse_atomics':
> /builddir/build/BUILD/gcc-13.2.1-20230728/aarch64-linux-gnu/aarch64-linux-gnu/libgcc/../../../gcc-13.2.1-20230728/libgcc/config/aarch64/lse-init.c:46:
> undefined reference to `__getauxval'
> collect2: fatal error: ld terminated with signal 11 [Segmentation
> fault], core dumped
> compilation terminated.
> make: *** [Makefile:1766: u-boot] Error 1
> make: *** Deleting file 'u-boot'
> ```
>
> GCC Version:
> ```
> $ aarch64-linux-gnu-gcc -v
> Using built-in specs.
> COLLECT_GCC=/usr/bin/aarch64-linux-gnu-gcc
> COLLECT_LTO_WRAPPER=/usr/libexec/gcc/aarch64-linux-gnu/13/lto-wrapper
> Target: aarch64-linux-gnu
> Configured with: ../gcc-13.2.1-20230728/configure --bindir=/usr/bin
> --build=x86_64-redhat-linux-gnu --datadir=/usr/share --disable-
> decimal-float --disable-dependency-tracking --disable-gold
> --disable-libgcj --disable-libgomp --disable-libmpx
> --disable-libquadmat
> h --disable-libssp --disable-libunwind-exceptions --disable-shared
> --disable-silent-rules --disable-sjlj-exceptions --disable-threa
> ds --with-ld=/usr/bin/aarch64-linux-gnu-ld --enable-__cxa_atexit
> --enable-checking=release --enable-gnu-unique-object --enable-init
> fini-array --enable-languages=c,c++ --enable-linker-build-id
> --enable-lto --enable-nls --enable-obsolete --enable-plugin --enable-t
> argets=all --exec-prefix=/usr --host=x86_64-redhat-linux-gnu
> --includedir=/usr/include --infodir=/usr/share/info --libexecdir=/usr/
> libexec --localstatedir=/var --mandir=/usr/share/man --prefix=/usr
> --program-prefix=aarch64-linux-gnu- --sbindir=/usr/sbin --shared
> statedir=/var/lib --sysconfdir=/etc --target=aarch64-linux-gnu
> --with-bugurl=http://bugzilla.redhat.com/bugzilla/ --with-gcc-major-
> version-only --with-isl --with-newlib
> --with-plugin-ld=/usr/bin/aarch64-linux-gnu-ld
> --with-sysroot=/usr/aarch64-linux-gnu/sys-root
> --with-system-libunwind --with-system-zlib --without-headers
> --enable-gnu-indirect-function --with-linker-hash-style=gnu
> Thread model: single
> Supported LTO compression algorithms: zlib zstd
> gcc version 13.2.1 20230728 (Red Hat Cross 13.2.1-1) (GCC)
> ```
>
> Thanks,
> Sahaj Sarup

This might be related [1] (try tocompile with -mno-outline-atomics):

"GCC 10.1.0 introduced the -moutline-atomics option which, when
enabled, use LSE instructions when the processor provides them.
The option is enabled by default and unfortunately causes the
following error at compile time:

 aarch64-linux-gnu-ld:
/usr/lib/gcc/aarch64-linux-gnu/10.1.0/libgcc.a(lse-init.o): in
function `init_have_lse_atomics':
 lse-init.c:(.text.startup+0xc): undefined reference to `__getauxval'

This is happening because we are linking against our own libcflat which
doesn't implement the function __getauxval().

Disable the use of the out-of-line functions by compiling with
-mno-outline-atomics."


[1] https://patchwork.kernel.org/project/kvm/patch/20200728121751.15083-1-drjones@redhat.com/

-- 
Best regards - Freundliche Grüsse - Meilleures salutations

Igor Opaniuk
Senior Software Engineer, Embedded & Security
E: igor.opaniuk at foundries.io
W: www.foundries.io


More information about the U-Boot mailing list