Summary: | sys-boot/grub-0.97-r14: runtime errors when built with gcc-4.9.3 | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Anna Tikhomirova <vamp> |
Component: | [OLD] Core system | Assignee: | Gentoo's Team for Core System packages <base-system> |
Status: | RESOLVED FIXED | ||
Severity: | minor | CC: | axs, mmokrejs, norman.shulman, slyfox |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: | grub-0.97-Add-esp-to-list-of-clobbered-registers.patch |
Description
Anna Tikhomirova
2015-11-04 20:05:54 UTC
I added a workaround to grub-0.97-r16 to help prevent this issue. It tested fine for me, but it might be too heavy-handed and/or not necessary for gcc-5. Anyhow, anyone still using grub:0 please report failures. *** Bug 566638 has been marked as a duplicate of this bug. *** (In reply to Ian Stakenvicius from comment #1) > I added a workaround to grub-0.97-r16 to help prevent this issue. It tested > fine for me, but it might be too heavy-handed and/or not necessary for > gcc-5. Anyhow, anyone still using grub:0 please report failures. Hi Ian, just a quick question: the fix replaces the "-O2" in our CFLAGS. What if I am setup to use "-O3" oder "-Ofast"? "-O3" contains all the "-O2" stuff plus more ... Thanks for feedback, Marc (In reply to Marc Burkhardt from comment #3) > (In reply to Ian Stakenvicius from comment #1) > > I added a workaround to grub-0.97-r16 to help prevent this issue. It tested > > fine for me, but it might be too heavy-handed and/or not necessary for > > gcc-5. Anyhow, anyone still using grub:0 please report failures. > the fix replaces the "-O2" in our CFLAGS. What if I am setup to use "-O3" > oder "-Ofast"? > > "-O3" contains all the "-O2" stuff plus more ... > > Thanks for feedback, > Marc Hi Marc, in https://bugs.gentoo.org/show_bug.cgi?id=566638#c1 I showed that all these resulted in a broken binary: -O1, O2, -Os . I did not test -Ofast but maybe you can check gcc manpage for clues? I guess -O3 will for sure result in a broken code as well. Well, somebody should ensure this gets reported to gcc developers. (In reply to Marc Burkhardt from comment #3) > (In reply to Ian Stakenvicius from comment #1) > > Hi Ian, > > just a quick question: > > the fix replaces the "-O2" in our CFLAGS. What if I am setup to use "-O3" > oder "-Ofast"? > > "-O3" contains all the "-O2" stuff plus more ... > > Thanks for feedback, > Marc The patch I did replaces the -O2 that the build system hard-codes, when USE="custom-cflags" is off. Unless you enable that flag, your system cflags are totally ignored by the grub:0 build system. You can certainly try other flags/settings yourself by enabling the use flag so that your system cflags are used, but as the use flag (should?) state, you're on your own. Created attachment 419232 [details, diff]
grub-0.97-Add-esp-to-list-of-clobbered-registers.patch
fixes misoptimization by -fcombine-stack-adjustments
I think i have a plausible theory why it crashes (see patch header) :) Please try the patch with reverted change in ebuild (stop forcing O0 back to default O2): https://gitweb.gentoo.org/repo/gentoo.git/commit/sys-boot/grub/grub-0.97-r16.ebuild?id=69273f1d085c5d44071c1f209e9048faa7c78202 Or the equivalent change: diff --git a/sys-boot/grub/grub-0.97-r16.ebuild b/sys-boot/grub/grub-0.97-r16.ebuild index 9da0d0e..512b7bb 100644 --- a/sys-boot/grub/grub-0.97-r16.ebuild +++ b/sys-boot/grub/grub-0.97-r16.ebuild @@ -77,7 +77,7 @@ src_prepare() { ewarn "incompatibilities." else einfo "Forcing -O0 to get around optimization issue caused by gcc-4.9 and newer with -O2" - sed -i -e "/CFLAGS/s/-O2/-O0/" \ + sed -i -e "/CFLAGS/s/-O2/-O2/" \ "${S}"/configure.ac || die fi fi Thanks! Thanks slyfox! Tested with gcc-4.8.5 and gcc-4.9.3 , no errors or issues either on use of 'grub' or on bootup. Pushed to gentoo repo in grub-0.97-r17; i think we can consider this bug to be fixed. I will request stabilization of -r17 as soon as bug 568222 is resolved. So -r17 ebuild compiles a working binary for me as well using gcc-4.9.3. Thank you. |