Bugzilla – Bug 1133281
LTO: qemu build fails
Last modified: 2023-10-13 14:30:12 UTC
Fails due to: [ 284s] /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: /tmp/curl.so.8gtd0D.ltrans0.ltrans.o: relocation R_X86_64_PC32 against undefined symbol `qemu_mutex_lock_func' can not be used when making a shared object; recompile with -fPIC [ 284s] /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: final link failed: bad value [ 284s] collect2: error: ld returned 1 exit status [ 284s] make: *** [/home/abuild/rpmbuild/BUILD/qemu-3.1.0/rules.mak:110: block/curl.so] Error 1 [ 284s] make: *** Waiting for unfinished jobs.... We should disable LTO for such a low level package.
I'm curious about your comment about we should disable LTO for such a low level package. I would think anywhere LTO could reasonably apply, we would want it. What do you see in the qemu package which would make you make that blanket statement?
(In reply to Bruce Rogers from comment #1) > I'm curious about your comment about we should disable LTO for such a low > level package. I would think anywhere LTO could reasonably apply, we would > want it. What do you see in the qemu package which would make you make that > blanket statement? I must agree that my analysis was very easygoing. I expect usage of an top level assembly which is a bit problematic for LTO. Anyway I can debug the unresolved symbols in qemu package later.
Status update: The qemu now in Factory (and Tumbleweed) have the suggested disabling. I've investigated most of the issues preventing LTO being enabled for qemu and the subpackages, and am working on resolving those, so I'll leave this bug open to track that effort.
The current blocker I see for enabling LTO for qemu has to do with runaway memory allocation by the compiler due to the __attribute__(flatten) used in qemu's target/arm/sve_helper.c. In googling around it seems you have experienced this in previous work, and have worked on solutions in the compiler code. I get this both with gcc8 and gcc9. What is the solution from your perspective?
(In reply to Bruce Rogers from comment #4) > The current blocker I see for enabling LTO for qemu has to do with runaway > memory allocation by the compiler due to the __attribute__(flatten) used in > qemu's target/arm/sve_helper.c. At, flattening. > > In googling around it seems you have experienced this in previous work, and > have worked on solutions in the compiler code. I get this both with gcc8 and > gcc9. What is the solution from your perspective? Yes, I've seen it couple of times. My solution would be to remove it so it may cause huge code inlining.