On Thu, 28 Nov 2024 at 17:46, Philippe Mathieu-Daudé <phi...@linaro.org> wrote:
> On 28/11/24 17:38, Phil Dennis-Jordan wrote: > > Paolo, could we please apply either Sairaj and Santosh's fix at > > https://patchew.org/QEMU/20241114114509.15350-1-sarun...@amd.com/ > > <https://patchew.org/QEMU/20241114114509.15350-1-sarun...@amd.com/> > > or mine to fix this link error? As neither patch has so far been merged, > > 9.2.0-rc2 still fails to build on macOS, at least on my local systems. > > I'm not sure why CI builds aren't jumping up and down about this, but > > neither the Xcode 15.2 nor 16.1 toolchains are happy on macOS 14.7/arm64. > > Just curious, is your build configured with --enable-hvf --enable-tcg? > > It's my understanding that both HVF and TCG are enabled by default when building on macOS - they both show up as "YES" in the ./configure output, and the relevant -accel works; at any rate, specifying them explicitly made no difference with regard to this link error. Your question did however prompt me to dig a little deeper and check which of my test configurations was affected. It looks like the critical setting is --enable-debug. I think that changes the exact optimisation level (not -O0 but less aggressive than the default), so it's not unreasonable that this would change the compiler pass(es) for eliminating constant conditional branches. So yeah, when I build latest master/staging with --enable-debug on macOS and my --target-list includes x86_64, QEMU fails to link with an undefined symbol error for _kvm_enable_x2apic. This happens on both arm64 and x86-64 hosts, and with various Xcode 15.x and 16.y toolchains. I have to admit I'm personally not a big fan of relying on the optimiser for removing references to these symbols, but restructuring the conditional expression like in Sairaj and Santosh's patch seems to allow even the optimisation level used for debug builds to do it, so I guess I can't argue with the result. :-) Phil