Here it is. It passes all my usual tests, I also especially verified it actually works on aarch64, and on a few more platforms too. I also verified the plugins in qemu, which uses qemu symbols, works (these shouldn't and don't use the internal codegen symbols in question).
I'm entirely satisfied with the result. The diff against currently accepted version follows (besides the UNRELEASED distribution). All the interesting info (which I already mentioned here in previous messages) is in the new file mark-internal-codegen-functions-hidden.patch. With this amount of ping-pong which already happened around qemu, I'm asking for approval before uploading this new version, instead of uploading it already, - if yet another round-trip is okay with you. Thanks, /mjt diff --git a/debian/changelog b/debian/changelog index 6d20774780..d4fa5731ed 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +qemu (1:7.2+dfsg-7+deb12u12) UNRELEASED; urgency=medium + + * mark-internal-codegen-functions-hidden.patch: + make GOT on AArch64 to fit. See comment in the patch for details. + * Revert "d/rules: disable capstone for static-user build on aarch64" + Re-enable capstone usage on aarch64, restore the status quo. + + -- Michael Tokarev <m...@tls.msk.ru> Sat, 04 Jan 2025 14:02:50 +0300 + qemu (1:7.2+dfsg-7+deb12u11) bookworm; urgency=medium * disable capstone for qemu-user-static buildi on arm64. See diff --git a/debian/patches/mark-internal-codegen-functions-hidden.patch b/debian/patches/mark-internal-codegen-functions-hidden.patch new file mode 100644 index 0000000000..b779959ff3 --- /dev/null +++ b/debian/patches/mark-internal-codegen-functions-hidden.patch @@ -0,0 +1,50 @@ +From: Michael Tokarev <m...@tls.msk.ru> +Subject: mark internal codegen helpers to be hidden +Date: Sat, 04 Jan 2025 13:53:36 +0300 +Forwarded: not-needed + +QEMU TCG uses arrays of pointers to functions for its +code generator. In 7.2, these functions are declared as +static inline. However, at least on some platforms, GCC +tries to make these functions visible to be used in a DSO. +And this makes the linker to fail at least on some platforms, +https://gitlab.com/qemu-project/qemu/-/issues/1129. + +Mark the internal generated helper functions to have hidden +visibility, so gcc does not generate code for sharing them, +which makes GOT significantly smaller (and the actual code +to access these functions a bit more efficient too). + +In later versions, qemu changed this place to use different +way, so this problem does not exist in more recent qemu. + +diff --git a/include/exec/helper-gen.h b/include/exec/helper-gen.h +--- a/include/exec/helper-gen.h ++++ b/include/exec/helper-gen.h +@@ -78,9 +78,11 @@ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \ + tcg_gen_callN(HELPER(name), dh_retvar(ret), 7, args); \ + } + ++#pragma GCC visibility push(hidden) + #include "helper.h" + #include "accel/tcg/tcg-runtime.h" + #include "accel/tcg/plugin-helpers.h" ++#pragma GCC visibility pop + + #undef DEF_HELPER_FLAGS_0 + #undef DEF_HELPER_FLAGS_1 +diff --git a/include/exec/helper-proto.h b/include/exec/helper-proto.h +--- a/include/exec/helper-proto.h ++++ b/include/exec/helper-proto.h +@@ -37,9 +37,11 @@ dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \ + + #define IN_HELPER_PROTO + ++#pragma GCC visibility push(hidden) + #include "helper.h" + #include "accel/tcg/tcg-runtime.h" + #include "accel/tcg/plugin-helpers.h" ++#pragma GCC visibility pop + + #undef IN_HELPER_PROTO + diff --git a/debian/patches/series b/debian/patches/series index 89fa483893..bbeb534adf 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -29,3 +29,4 @@ spelling.diff openbios-spelling-endianess.patch slof-spelling-seperator.patch ignore-roms-dependency-in-qtest.patch +mark-internal-codegen-functions-hidden.patch diff --git a/debian/rules b/debian/rules index 3383ea3036..dcc21904db 100755 --- a/debian/rules +++ b/debian/rules @@ -361,8 +361,6 @@ 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 $@