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)
Created attachment 360134 [details] emerge --info
The last grub-0.97-r13 from slot 0 is also affected.
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).
> 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.