03.01.2025 13:02, Michael Tokarev пишет:
02.01.2025 23:17, Adam D. Barratt wrote:
The arm64 build keeps failing:
/usr/lib/gcc/aarch64-linux-gnu/12/../../../aarch64-linux-gnu/libc.a(init-first.o):
in function `__libc_init_first':
(.text+0x10): relocation truncated to fit: R_AARCH64_LD64_GOTPAGE_LO15 against symbol `__environ' defined in .bss section in /usr/lib/gcc/aarch64-
linux-gnu/12/../../../aarch64-linux-gnu/libc.a(environ.o)
/usr/bin/ld: (.text+0x10): warning: too many GOT entries for -fpic, please
recompile with -fPIC
collect2: error: ld returned 1 exit status
This is capstone built wrongly. Sigh.
Things turned out to be more interesting.
I just uploaded a new release of qemu, which disables capstone for user-static
build on arm64. Verified it too, and verified the resulting binaries actually
works. The diff is below.
More findings are at https://gitlab.com/qemu-project/qemu/-/issues/1129 .
I'm not yet sure why this affects arm64 only, will investigate it. The thing
is that a more recent qemu (with that huge all_helpers array removed) builds
fine on all supported platforms, so it is not an issue anymore. Unfortunately
picking up that change to 7.2 is unreasonable.
Thanks,
/mjt
diff --git a/debian/changelog b/debian/changelog
index 5fe0bd956d..6e83331748 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+qemu (1:7.2+dfsg-7+deb12u10) bookworm; urgency=medium
+
+ * disable capstone for qemu-user-static build. See
+ https://gitlab.com/qemu-project/qemu/-/issues/1129 for details.
+ The choice is to disable either capstone or pie, and it is better
+ to keep pie enabled because it helps with guest/host address conflicts.
+ Capstone is used to produce disassembler output of guest code, it is
+ nice to have it but it is not required for normal operations.
+
+ -- Michael Tokarev <m...@tls.msk.ru> Fri, 03 Jan 2025 14:58:28 +0300
+
qemu (1:7.2+dfsg-7+deb12u9) bookworm; urgency=medium
* re-enable (upstream default) --static-pie linking for qemu-user-static
diff --git a/debian/rules b/debian/rules
index dcc21904db..3383ea3036 100755
--- a/debian/rules
+++ b/debian/rules
@@ -361,6 +361,8 @@ b/user-static/configured: configure
../../configure ${common_configure_opts} \
--static \
$(if $(filter i386,${DEB_HOST_ARCH}),--disable-pie) \
+ $(# https://gitlab.com/qemu-project/qemu/-/issues/1129: ) \
+ $(if $(filter arm64,${DEB_HOST_ARCH}),--disable-capstone) \
--disable-system --disable-xen \
--target-list="$(addsuffix -linux-user,${user_targets})"
touch $@