Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 486996 - sys-boot/grub-0.97-r12 compiled with sys-devel/gcc-4.7.3-r1 -msse2: crash at stage-1_5 and the system reboots in cycle
Summary: sys-boot/grub-0.97-r12 compiled with sys-devel/gcc-4.7.3-r1 -msse2: crash at ...
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 Linux
: Normal normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-05 10:04 UTC by Alex Dubenetsky
Modified: 2013-10-06 19:10 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge-info.txt,6.14 KB, text/plain)
2013-10-05 10:05 UTC, Alex Dubenetsky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Dubenetsky 2013-10-05 10:04:20 UTC
After upgrading gcc from 4.6.3 to 4.7.3-r1 the system can't boot any more.
After some searching I detected that grub-0.97-r12 compiled with gcc4.7.3-r1 can't work (crashes at stage 1.5 loading/running) if the compiler optimization option -msse2 (and probably higher sse) was used.
On screen it sees as the system going to reboot after "Grub loading stage 1_5" and before the grub menu is shown.

The bug is sees on amd64 arch. Situation with other arches is unknown to me.

Reproducible: Always

Steps to Reproduce:
1. rebuild grub-0.97-r12 with gcc-4.7.3-r1 and CFLAGS,CPPFLAGS,CXXFLAGS="-march=native -O2 -pipe -g0 -mmmx -msse -msse2 -msse3 -mssse3 -mfpmath=sse"
2. reboot the system

Actual Results:  
The system goes to cyclic reboot after trying to load grub stage 1.5.

Expected Results:  
Boot the system.

'emerge --info' is attached.

Possible workarounds, one of:
1. Don't use gcc-4.7
2. Don't use -msse2 and higher compiler optimization system wide
3. Setup special C*FLAGS env for grub, e.g.:
---
# cat > /etc/portage/env/grub.conf 
CFLAGS="-march=native -O2 -pipe -g0 -mmmx -msse -mfpmath=sse"
CXXFLAGS="${CFLAGS}"
CPPFLAGS="${CFLAGS}"
^D
# cat >> /etc/portage/package.env 
sys-boot/grub grub.conf
^D
---
4. Keep the older grub binaries to run (temporary uninstall grub before update gcc OR save and overwrite binaries from /lib64/grub/i386-pc/ to /boot/grub)
Comment 1 Alex Dubenetsky 2013-10-05 10:05:34 UTC
Created attachment 360134 [details]
emerge --info
Comment 2 Alex Dubenetsky 2013-10-05 10:27:39 UTC
The last grub-0.97-r13 from slot 0 is also affected.
Comment 3 Rafał Mużyło 2013-10-05 13:20:26 UTC
The answer lies in the question here.

This is (in a way) a dupe of bug 360513.

Your CFLAGS don't make sense for a bootloader (frankly, if you can't rely just on march value, chances are there are other ebuilds that get broken with such).
Comment 4 Alex Dubenetsky 2013-10-06 19:10:10 UTC
> Your CFLAGS don't make sense for a bootloader 
Actually, it does. To be exact - CPPFLAGS.
I don't know if it's a feature - then ok.

> (frankly, if you can't rely just on march value, chances are there are other ebuilds that get broken with such).
Sorry, I don't quite understand what do you mean.
If you talking about -march=native, it works for me for years.

I added CPPFLAGS="-march=atom -pipe -g0" to /etc/portage/env/grub.conf.
I feel like the bug is resolved and changing status so.