On Tue, 27 May 2025 at 09:59, Michael Tokarev <[email protected]> wrote: > > FWIW, and maybe a heads-up, but: > > Current qemu (git master) can't be built on debian stable (bookworm) on arm64 > statically, when capstone is used. > > ./configure --static --enable-capstone --target-list=aarch64-linux-user > > this fails at link stage: > > /usr/lib/gcc/aarch64-linux-gnu/12/../../../aarch64-linux-gnu/libc.a(setlocale.o): > in function `_nl_locale_subfreeres': > (__libc_freeres_fn+0x124): relocation truncated to fit: > R_AARCH64_LD64_GOTPAGE_LO15 against symbol `_nl_C_LC_COLLATE' defined in > .data.rel.ro.local > section in > /usr/lib/gcc/aarch64-linux-gnu/12/../../../aarch64-linux-gnu/libc.a(C-collate.o) > /usr/bin/ld: (__libc_freeres_fn+0x124): warning: too many GOT entries for > -fpic, please recompile with -fPIC > collect2: error: ld returned 1 exit status > > Apparently some code/data size has become too large. > > Only aarch64 target on aarch64 is affected, so far.
To summarise an IRC conversation: this happens because (as the error message suggests) the host glibc was incorrectly built with -fpic rather than -fPIC. This was fixed upstream under this bug report: https://sourceware.org/bugzilla/show_bug.cgi?id=29514 which is likely why you're only seeing it on Debian stable. In our CI we work around this for the affected distros with the --disable-pie configure flag. The error only happens if you've built QEMU with a set of options that mean that the layout of the executable happens to put a symbol that libc uses too far away from the libc object, so it tends to come and go depending on how much stuff you're compiling into the binary and apparently unrelated changes in QEMU itself. The fix in glibc itself is a three line patch (affecting aarch64 and sparc), if you want to suggest backporting it to bookworm: https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=51231c469b49fb383;hp=063f7462dac26487e38b126afcf80dad77da444c thanks -- PMM
