Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 468136 - grub-2.00* x86_64-efi built with gcc-4.8 fails to load kernel
Summary: grub-2.00* x86_64-efi built with gcc-4.8 fails to load kernel
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Highest major (vote)
Assignee: Mike Gilbert
Depends on:
Blocks: gcc-4.8
  Show dependency tree
Reported: 2013-05-01 12:47 UTC by Justin Lecher
Modified: 2013-12-23 13:10 UTC (History)
6 users (show)

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

build.log grub with gcc-4.8 (grub-2.00-r3:20130501-122445.log.xz,47.76 KB, text/plain)
2013-05-01 12:47 UTC, Justin Lecher

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Lecher gentoo-dev 2013-05-01 12:47:25 UTC
Created attachment 347044 [details]
build.log grub with gcc-4.8

When building grub-2.00* (fails with all revisions) with gcc-4.8 it fails to load a kernel, booting from iso images ... I am using a gpt/uefi system

what I did:
1. building grub
2. grub2-mkconfig -o /boot/grub2/grub.cfg
3. grub2-install --target=x86_64-efi
4. Verified efi with efibootmgr and grub.cfg to be correct
5. Reboot -> grub2 gets loaded and correct menu entries are shown
6. Booting standard kernel (which has proven to boot the machine) -> grub shows "Loading ...." but system freezes including keyboard and nothing boots. Onbly hard reset is possible.

Same setup, same settings just switched to gcc-4.7 works fine.

Portage 2.2.0_alpha173 (default/linux/amd64/13.0, gcc-4.8.0, glibc-2.17, 3.9.0-lh x86_64)
                        System Settings
System uname: Linux-3.9.0-lh-x86_64-Intel-R-_Core-TM-_i7-2600_CPU_@_3.40GHz-with-gentoo-2.2
KiB Mem:    16345380 total,  11713516 free
KiB Swap:    3987452 total,   3987452 free
Timestamp of tree: Wed, 01 May 2013 12:30:01 +0000
ld GNU ld (GNU Binutils) 2.23.1
ccache version 3.1.9 [enabled]
app-shells/bash:          4.2_p45
dev-java/java-config:     2.2.0
dev-lang/python:          2.6.8-r1, 2.7.3-r3, 3.1.5-r1, 3.2.3-r2, 3.3.0-r1
dev-util/ccache:          3.1.9-r1::science
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.11.8
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.6, 1.12.6, 1.13.1
sys-devel/binutils:       2.23.1
sys-devel/gcc:            4.4.7, 4.5.4, 4.6.3, 4.7.2-r1, 4.8.0
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.8 (virtual/os-headers)
sys-libs/glibc:           2.17
Repositories: gentoo sunrise bicatali betagarden dummy Neurogeek science Raspberry-Pi-Overlay last-hope g-ctan
ACCEPT_KEYWORDS="amd64 ~amd64"
CFLAGS="-O2 -pipe -ftracer   -march=native -frecord-gcc-switches -g -Wimplicit-function-declaration"
CONFIG_PROTECT="/etc /usr/share/eselect/ /usr/share/gnupg/qualified.txt /usr/share/nano/ /var/lib/hsqldb /var/spool/munin-async/.ssh"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -ftracer   -march=native -frecord-gcc-switches -g -Wenum-compare"
EMERGE_DEFAULT_OPTS=" -vt --keep-going --autounmask-write --autounmask --quiet-build=n"
FCFLAGS="-O2 -pipe -ftracer   -march=native -frecord-gcc-switches -g"
FEATURES="assume-digests binpkg-logs buildsyspkg candy ccache collision-protect compressdebug distlocks ebuild-locks fixlafiles merge-sync metadata-transfer multilib-strict news noinfo parallel-fetch parallel-install preserve-libs protect-owned sandbox sfperms sign split-log splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe -ftracer   -march=native -frecord-gcc-switches -g"
GENTOO_MIRRORS=" /mnt/tmpfs/"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-O1 -Wl,--hash-style=gnu -Wl,--sort-common"
MAKEOPTS="-j12 -l9"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTDIR_OVERLAY="/local/overlays/sunrise-reviewed /local/overlays/bicatali /local/overlays/betagarden /local/overlays/dummy /local/overlays/neurogeek /local/overlays/sci /local/overlays/gen2pi /local/overlays/lh/ebuilds /local/overlays/g-ctan"
USE="X acl alsa amd64 avx bash-completion berkdb branding bzip2 cairo caps cli cracklib crypt cxx dbus dri fortran gdbm gif gmp gnome gnome-keyring gpm gstreamer gtk iconv icu ipv6 jpeg jpeg2k mmx mmxext modules mudflap multilib ncurses network-cron nls nptl nsplugin numa opengl openmp pam pcre pgo png pulseaudio qt3support raw readline session smp sse sse2 sse2_4way sse2check sse3 sse4 sse41 sse4_1 sse4_2 sse4a ssl ssse3 startup-notification tcpd threads tiff truetype unicode vaapi vdpau xinerama zlib" ABI_X86="64" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" DRACUT_MODULES="plymouth" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer pdfimport scripting-javascript wiki-publisher nlpsolver" LINGUAS="en" NGINX_MODULES_HTTP="access auth_basic autoindex browser charset empty_gif fastcgi geo gzip limit_conn limit_req map memcached proxy referer rewrite scgi split_clients ssi upstream_ip_hash userid uwsgi stub_status" OFFICE_IMPLEMENTATION="libreoffice" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_6 python2_7 python3_1 python3_2 python3_3 pypy1_9 pypy2_0" QEMU_SOFTMMU_TARGETS="i386 x86_64 arm armeb" QEMU_USER_TARGETS="i386 x86_64 arm armeb" RUBY_TARGETS="ruby19" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
USE_PYTHON="2.6 2.7 3.1 3.2 3.3 2.7-pypy-1.9 2.7-pypy-2.0"

                        Package Settings

sys-boot/grub-2.00-r3 was built with the following:
USE="(multilib) nls truetype -custom-cflags -debug -device-mapper -doc -efiemu -libzfs -mount -sdl -static" ABI_X86="64" GRUB_PLATFORMS="efi-64 -coreboot -efi-32 -emu -ieee1275 -multiboot -pc -qemu -qemu-mips -yeeloong"
Comment 1 Mike Gilbert gentoo-dev 2013-05-01 13:50:29 UTC
The i386-pc platform works fine for me when built with gcc-4.8. I guess there could be an issue with the x86_64-efi platform.

Can you give the live ebuild (grub-9999) a shot? If that works, we can look for a patch.

Also, be aware that I added a USE flag (multislot) to the live ebuild which toggles the grub -> grub2 rename.
Comment 2 Mike Gilbert gentoo-dev 2013-05-01 14:14:19 UTC
I will also see if I can reproduce this in qemu.
Comment 3 Mike Gilbert gentoo-dev 2013-05-02 02:52:11 UTC
I can reproduce the problem with grub-2.00-r3 under qemu with OVMF. The latest grub trunk works fine.
Comment 4 Mike Gilbert gentoo-dev 2013-05-02 05:05:34 UTC
Bisected to this commit, which is the first in a refactoring series to remove nested functions from the codebase.

I'm not comfortable backporting this myself; it would probably be better to add a snapshot.

Justin: Please confirm that the grub trunk works on actual EFI hardware; I'm just testing with an emulator.
Comment 5 Justin Lecher gentoo-dev 2013-05-02 07:29:32 UTC
I couldn't reboot until now. Will Do it after breakfast.
Comment 6 Justin Lecher gentoo-dev 2013-05-02 09:50:55 UTC
I tried revno 4940 which works correctly.
Comment 7 Alexandre 2013-07-23 06:21:33 UTC
Seems to be an important bug
Can the fix be backported ?
Is grub-9999 safe ?
Comment 8 Justin Lecher gentoo-dev 2013-07-23 06:23:34 UTC
(In reply to Alexandre from comment #7)
> Seems to be an important bug
> Can the fix be backported ?

Its definitely needed. I will set priority higher.

> Is grub-9999 safe ?

No guarantee for "safe" but I rebuilded it once after this report using 9999 and it worked.
Comment 9 Mike Gilbert gentoo-dev 2013-07-28 17:34:15 UTC
Sorry for the delay guys. I have added a new snapshot, which is currently hard-masked.

I will unmask it as soon as you can confirm that it works without any major problems.

+*grub-2.00_p4946 (28 Jul 2013)
+  28 Jul 2013; Mike Gilbert <> +grub-2.00_p4946.ebuild,
+  grub-9999.ebuild:
+  Add new snapshot for bug 468136.

As a bonus, we don't need autogen anymore. Yay!

+  28 Jul 2013; Mike Gilbert <> grub-2.00_p4946.ebuild,
+  grub-9999.ebuild:
+  We don't need autogen with a pristine snapshot.
Comment 10 Ben Kohler gentoo-dev 2013-08-03 16:02:56 UTC
I upgraded 2 machines to gcc-4.8.1 this morning and got a chance to test this.  Here are my results:

(machine A)
gcc-4.8.1 + grub-2.00-r4 + x86_64-efi = fail, hangs on "Loading kernel x.y.z"
gcc-4.8.1 + grub-2.00_p4946 + x86_64-efi = success

(machine B)
<did not attempt to reproduce failure again, but..>
gcc-4.8.1 + grub-2.00_p4946 + x86_64-efi = success
Comment 11 Mike Gilbert gentoo-dev 2013-08-04 20:45:05 UTC
+*grub-2.00_p5086 (04 Aug 2013)
+  04 Aug 2013; Mike Gilbert <> +grub-2.00_p5086.ebuild,
+  grub-9999.ebuild:
+  New snapshot, resolves bug 468136. Append -fuse-ld=bfd to LDFLAGS for gcc-4.8+
+  as a workaround for bug 439082.