Skip to contentSkip to conversation

grub2 failure with gcc-4.9

Buildroot Thierry Bultel 2 participants 6 messages Feb 5, 2015

lore
Share & tools
lore
#0 lore raw

Hi,

I just figured out that my PC target was failing to boot, because I upgraded the compiler from (buildroot toolchain) gcc-4.8.x to gcc-4.9.x

The configuration is:
BR2_TARGET_GRUB2_I386_PC=y BR2_TARGET_GRUB2_BUILTIN_MODULES="boot linux ext2 fat part_msdos part_gpt part_bsd normal biosdisk sleep echo video videoinfo help jpeg uhci ehci usb usb_keyboard usbms usbtest gfxterm gfxmenu vbe vga video_bochs video_cirrus font search search_fs_file search_label test test_blockarg keylayouts at_keyboard cat configfile loadenv eval serial regexp"

(I know, that makes a lot but work like a charm with gcc-4.8.2)

The symptom is :
-------------------------------
'' is already set
Aborted. Press any key to exit.
-------------------------------

After some (printf) debugging, I found out that when 'loading' the builtin modules at startup, some modules names are corrupted. I am about to get into deeper investigation, but has anyone encountered it ?

Best regards
Thierry

#1 lore raw

Dear Thierry Bultel,

Quoted 4 lines · Thierry Bultel

After some (printf) debugging, I found out that when 'loading' the builtin modules at startup, some modules names are corrupted. I am about to get into deeper investigation, but has anyone encountered it ?

Interesting.

First suggestions:

- try with another gcc 4.9 toolchain (distro toolchain or something)

- try with different optimization levels (default of Buildroot is -Os, try with -O0 and -O2)

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

Le 05/02/2015 14:20, Thomas Petazzoni a ?crit :

Quoted 9 lines

Dear Thierry Bultel,

Quoted 4 lines · Thierry Bultel

After some (printf) debugging, I found out that when 'loading' the builtin modules at startup, some modules names are corrupted. I am about to get into deeper investigation, but has anyone encountered it ?

Quoted 9 lines

Interesting.

First suggestions:

- try with another gcc 4.9 toolchain (distro toolchain or something)

- try with different optimization levels (default of Buildroot is -Os, try with -O0 and -O2)

It seems that when building the target part, grub is using CXXFLAGS (from $(HOST_CONFIGURE_OPTS)) in addition of TARGET_CFLAGS. Thus we have both -0s and -O2 in command line.

Unfortunately that is not the cause of the bug, because -02 (twice) makes it happen.

Trying another toolchain ...

Quoted 2 lines

Thomas

#3 lore raw

Le 05/02/2015 15:16, Thierry Bultel a ?crit :

Quoted 20 lines

Le 05/02/2015 14:20, Thomas Petazzoni a ?crit :

Quoted 9 lines

Dear Thierry Bultel,

Quoted 4 lines · Thierry Bultel

After some (printf) debugging, I found out that when 'loading' the builtin modules at startup, some modules names are corrupted. I am about to get into deeper investigation, but has anyone encountered it ?

Quoted 9 lines

Interesting.

First suggestions:

- try with another gcc 4.9 toolchain (distro toolchain or something)

- try with different optimization levels (default of Buildroot is -Os, try with -O0 and -O2)

Quoted 8 lines

It seems that when building the target part, grub is using CXXFLAGS (from $(HOST_CONFIGURE_OPTS)) in addition of TARGET_CFLAGS. Thus we have both -0s and -O2 in command line.

Unfortunately that is not the cause of the bug, because -02 (twice) makes it happen.

Trying another toolchain ...

FYI, loops rebooting with gcc-4.7 from
BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_201209

Quoted 4 lines
Quoted 3 lines

Thomas

#4 lore raw
In reply to Thomas Petazzoni

Le 05/02/2015 14:20, Thomas Petazzoni a ?crit :

Quoted 11 lines

Dear Thierry Bultel,

Quoted 4 lines · Thierry Bultel

After some (printf) debugging, I found out that when 'loading' the builtin modules at startup, some modules names are corrupted. I am about to get into deeper investigation, but has anyone encountered it ?

Interesting.

Quoted 9 lines

First suggestions:

- try with another gcc 4.9 toolchain (distro toolchain or something)

- try with different optimization levels (default of Buildroot is -Os, try with -O0 and -O2)

Thomas

With gcc-4.9 from Ubuntu

(in grub2.mk, I set TARGET_CC="/usr/bin/gcc" \
	TARGET_CFLAGS="-m32" \

)

... grub hangs.

#5 lore raw

Dear Thierry Bultel,

Quoted 7 lines · Thierry Bultel

With gcc-4.9 from Ubuntu

(in grub2.mk, I set TARGET_CC="/usr/bin/gcc" \
	TARGET_CFLAGS="-m32" \

)

... grub hangs.

Seems like you're good for a bug report to the upstream project. I checked their Git repo, there is a gcc 4.9 fix but specific for ARM issues. I haven't seen any other commit mentioning "4.9".

You may want to try with their latest Git version first, though, just in case the problem was fixed but not mentioned explicitly in a commit log.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com