bugGNU GRUB - Bugs: bug #46986, Fails to build on FreeBSD CURRENT...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #46986: Fails to build on FreeBSD CURRENT amd64

Submitted by:  Kostya Berger <bergerkos>
Submitted on:  Wed 27 Jan 2016 01:19:24 AM UTC  
 
Category: CompilationSeverity: Major
Priority: 5 - NormalItem Group: None
Status: FixedPrivacy: Public
Assigned to: NoneOriginator Name: bergerkos
Open/Closed: ClosedRelease: 
Release: Git masterReproducibility: Every Time
Planned Release: None

(Jump to the original submission Jump to the original submission)

Wed 03 Feb 2016 05:36:43 PM UTC, comment #20:

Should be fixed in 67dba97e4598eaf2deb14da044fbfb1c119cf76f. Please reopen if needed. Thank you!

Andrei Borzenkov <arvidjaar>
Project Member
Tue 02 Feb 2016 07:45:28 PM UTC, comment #19:

> If we want to support symbolless modules we need more work
> to make them work.


In principle this is cosmetic. Such modules exist only for .moddeps and although they return error from insmod, dependencies have already been loaded anyway.

Still binutils reverted to 2.17 behavior, so I sent patch to grub-devel for review.

Andrei Borzenkov <arvidjaar>
Project Member
Fri 29 Jan 2016 10:37:04 PM UTC, comment #18:

Sorry, I mean binutils-2.25.1.

Kostya Berger <bergerkos>
Fri 29 Jan 2016 10:34:24 PM UTC, comment #17:

OK, my version of strip is part of elftoolchain which is used in FreeBSD for license-related reasons.

I've tried using strip from binutils-6.25 and it builds ok. So, as a local workaround I'm using a patch for grub-core/genmod.sh.in to replace "@TARGET_STRIP@" with "/usr/local/bin/strip" in that particular script.

Kostya Berger <bergerkos>
Thu 28 Jan 2016 08:55:11 PM UTC, comment #16:

Yes, I can reproduce it with binutils 2.17 (it was a challenge just to compile them ...). Note that modern binutils actually always add section symbols. I am not sure what to do. I would like to know the reason why this behavior was changed.

Andrei Borzenkov <arvidjaar>
Project Member
Wed 27 Jan 2016 09:37:37 PM UTC, comment #15:

Here's objdump output for all_video.mod that builds with strip section removed in genmod.sh (for this particular module):
LC_ALL=C objdump -x all_video.mod

all_video.mod: file format elf32-i386-freebsd
all_video.mod
architecture: i386, flags 0x00000011:
HAS_RELOC, HAS_SYMS
start address 0x00000000

Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00000000 00000000 00000000 00000034 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 00000000 00000000 00000000 00000034 2**0
CONTENTS, ALLOC, LOAD, DATA
2 .module_license 0000000f 00000000 00000000 00000034 2**0
CONTENTS, ALLOC, LOAD, DATA
3 .bss 00000000 00000000 00000000 00000043 2**0
ALLOC
4 .note.GNU-stack 00000000 00000000 00000000 00000043 2**0
CONTENTS, READONLY
5 .debug_aranges 00000018 00000000 00000000 00000043 2**0
CONTENTS, RELOC, READONLY, DEBUGGING
6 .debug_info 0000042a 00000000 00000000 0000005b 2**0
CONTENTS, RELOC, READONLY, DEBUGGING
7 .debug_abbrev 0000011b 00000000 00000000 00000485 2**0
CONTENTS, READONLY, DEBUGGING
8 .debug_line 0000007b 00000000 00000000 000005a0 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_str 00000779 00000000 00000000 0000061b 2**0
CONTENTS, READONLY, DEBUGGING
10 .moddeps 00000021 00000000 00000000 00000d94 2**0
CONTENTS, READONLY
11 .modname 0000000a 00000000 00000000 00000db5 2**0
CONTENTS, READONLY
SYMBOL TABLE:

                1. l d .text 00000000 .text
                2. l d .data 00000000 .data
                3. l d .module_license 00000000 .module_license
                4. l d .bss 00000000 .bss
                5. l d .note.GNU-stack 00000000 .note.GNU-stack
                6. l d .debug_aranges 00000000 .debug_aranges
                7. l d .debug_info 00000000 .debug_info
                8. l d .debug_abbrev 00000000 .debug_abbrev
                9. l d .debug_line 00000000 .debug_line
                10. l d .debug_str 00000000 .debug_str
                11. l df ABS 00000000 fake_module.c
                12. l O .module_license 0000000f grub_module_license
                13. l d .moddeps 00000000 .moddeps
                14. l d .modname 00000000 .modname

RELOCATION RECORDS FOR [.debug_aranges]:
OFFSET TYPE VALUE
00000006 R_386_32 .debug_info

RELOCATION RECORDS FOR [.debug_info]:
OFFSET TYPE VALUE
00000006 R_386_32 .debug_abbrev
0000000c R_386_32 .debug_str
00000011 R_386_32 .debug_str
00000015 R_386_32 .debug_str
00000019 R_386_32 .debug_line
00000026 R_386_32 .debug_str
0000002c R_386_32 .debug_str
00000032 R_386_32 .debug_str
00000038 R_386_32 .debug_str
0000003e R_386_32 .debug_str
00000044 R_386_32 .debug_str
0000004a R_386_32 .debug_str
00000050 R_386_32 .debug_str
00000056 R_386_32 .debug_str
0000005c R_386_32 .debug_str
00000062 R_386_32 .debug_str
00000068 R_386_32 .debug_str
0000006e R_386_32 .debug_str
00000074 R_386_32 .debug_str
0000007a R_386_32 .debug_str
00000080 R_386_32 .debug_str
00000086 R_386_32 .debug_str
0000008c R_386_32 .debug_str
00000092 R_386_32 .debug_str
00000098 R_386_32 .debug_str
0000009e R_386_32 .debug_str
000000a4 R_386_32 .debug_str
000000aa R_386_32 .debug_str
000000b0 R_386_32 .debug_str
000000b6 R_386_32 .debug_str
000000bc R_386_32 .debug_str
000000c2 R_386_32 .debug_str
000000c8 R_386_32 .debug_str
000000ce R_386_32 .debug_str
000000d4 R_386_32 .debug_str
000000da R_386_32 .debug_str
000000e0 R_386_32 .debug_str
000000e6 R_386_32 .debug_str
000000ec R_386_32 .debug_str
000000f2 R_386_32 .debug_str
000000f8 R_386_32 .debug_str
000000fe R_386_32 .debug_str
00000104 R_386_32 .debug_str
0000010a R_386_32 .debug_str
00000110 R_386_32 .debug_str
00000116 R_386_32 .debug_str
0000011c R_386_32 .debug_str
00000122 R_386_32 .debug_str
00000128 R_386_32 .debug_str
0000012e R_386_32 .debug_str
00000134 R_386_32 .debug_str
0000013b R_386_32 .debug_str
00000158 R_386_32 .debug_str
0000015f R_386_32 .debug_str
00000166 R_386_32 .debug_str
0000016d R_386_32 .debug_str
0000017b R_386_32 .debug_str
00000182 R_386_32 .debug_str
00000187 R_386_32 .debug_str
00000194 R_386_32 .debug_str
00000199 R_386_32 .debug_str
000001a6 R_386_32 .debug_str
000001ad R_386_32 .debug_str
000001b2 R_386_32 .debug_str
000001bd R_386_32 .debug_str
000001c8 R_386_32 .debug_str
000001d3 R_386_32 .debug_str
000001e7 R_386_32 .debug_str
000001f4 R_386_32 .debug_str
00000201 R_386_32 .debug_str
0000020e R_386_32 .debug_str
0000021b R_386_32 .debug_str
00000228 R_386_32 .debug_str
00000236 R_386_32 .debug_str
00000244 R_386_32 .debug_str
00000252 R_386_32 .debug_str
00000264 R_386_32 .debug_str
00000270 R_386_32 .debug_str
0000027c R_386_32 .debug_str
00000288 R_386_32 .debug_str
00000294 R_386_32 .debug_str
000002a7 R_386_32 .debug_str
000002b2 R_386_32 .debug_str
000002be R_386_32 .debug_str
000002dd R_386_32 .debug_str
000002e9 R_386_32 .debug_str
000002f5 R_386_32 .debug_str
0000030d R_386_32 .debug_str
00000319 R_386_32 .debug_str
00000325 R_386_32 .debug_str
00000331 R_386_32 .debug_str
0000033d R_386_32 .debug_str
00000349 R_386_32 .debug_str
00000360 R_386_32 .debug_str
00000373 R_386_32 .debug_str
00000395 R_386_32 .debug_str
000003b0 R_386_32 .debug_str
000003bc R_386_32 .module_license
000003c1 R_386_32 .debug_str
000003cc R_386_32 .debug_str
000003f1 R_386_32 .debug_str
0000040d R_386_32 .debug_str
0000041f R_386_32 .debug_str

Kostya Berger <bergerkos>
Wed 27 Jan 2016 09:28:48 PM UTC, comment #14:

Sorry, distorted output here.

Kostya Berger <bergerkos>
Wed 27 Jan 2016 09:27:35 PM UTC, comment #13:

Well, when I disable strip command in genmod.sh for all_video.mod it contains these symbols (same as all_video.module):
SYMBOL TABLE:

                1. l d .text 00000000 .text
                2. l d .data 00000000 .data
                3. l d .module_license 00000000 .module_license
                4. l d .bss 00000000 .bss
                5. l d .note.GNU-stack 00000000 .note.GNU-stack
                6. l d .debug_aranges 00000000 .debug_aranges
                7. l d .debug_info 00000000 .debug_info
                8. l d .debug_abbrev 00000000 .debug_abbrev
                9. l d .debug_line 00000000 .debug_line
                10. l d .debug_str 00000000 .debug_str
                11. l df ABS 00000000 fake_module.c
                12. l O .module_license 0000000f grub_module_license
                13. l d .moddeps 00000000 .moddeps
                14. l d .modname 00000000 .modname
Kostya Berger <bergerkos>
Wed 27 Jan 2016 09:07:24 PM UTC, comment #12:

Before module verifier this problem just resulted in unloadable module. You can disable check in module verifier but it will not do any good as runtime has the same check. And if you bypass check at runtime you're likely to bit a null pointer dereference. If we want to support symbolless modules we need more work to make them work. Alternative is to put a fake symbol

Vladimir Serbinenko <phcoder>
Project Administrator
Wed 27 Jan 2016 09:03:15 PM UTC, comment #11:

Don't know if it matters as I'm not a programmer... but genmod.sh has changed in the version that fails compared to the previous one.

The strip command in the failing revision is:
strip --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note.gnu.gold-version -R .note.GNU-stack -R .note -R .comment all_video.mod.tmp

And in the one that doesn't fail it is:
strip --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note.gnu.gold-version -R .note.GNU-stack -R .note -R .comment build-grub-module-verifier.tmp

So, in the first case it is all_video.mod.tmp is being stripped, in the second it is build-grub-module-verifier.tmp.

Also, in the successful build all_video.mod has no symbols either, but nobody cares in this case.

Kostya Berger <bergerkos>
Wed 27 Jan 2016 08:26:11 PM UTC, comment #10:

Doesn't build either. And here strip is GNU strip 2.17.50

Kostya Berger <bergerkos>
Wed 27 Jan 2016 08:08:49 PM UTC, comment #9:

Sorry, I'm not a programmer, that's why.

strip -V: strip (elftoolchain r3223M)
objcopy -V: GNU objcopy 2.17.50 [FreeBSD] 2007-07-03

Interestingly, in FreeBSD 10.2 man strip it says "GNU strip...". Here on CURRENT it doesn't mention GNU...

Know what? I'll check how it builds on STABLE and report back.

Kostya Berger <bergerkos>
Wed 27 Jan 2016 07:56:15 PM UTC, comment #8:

You misunderstand. It is clear what this script does. But either objcopy or strip removes more than expected. So you need to check result of these commands using "objdump -t" to see when symbol table gets lost.

I'm pretty sure it is strip, and actually those symbols are not needed for linking indeed. What version are you using (strip -V and objcopy -V)?

Andrei Borzenkov <arvidjaar>
Project Member
Wed 27 Jan 2016 07:43:39 PM UTC, comment #7:

Here is the debug output of the command you suggested:

TARGET_OBJ2ELF= sh -x genmod.sh moddep.lst all_video.module build-grub-module-verifier all_video.mod

+ set -e
+ moddep=moddep.lst
+ infile=all_video.module
+ outfile=all_video.mod
+ tmpfile=all_video.mod.tmp
+ echo all_video.module
+ sed -e 's@\.module.*$@@'
+ modname=all_video
+ grep ^all_video: moddep.lst
exit 0
+ grep ^all_video: moddep.lst
+ sed 's@^.*:@@'
+ deps=' vbe vga video_bochs video_cirrus'
+ rm -f all_video.mod.tmp all_video.mod
+ test x0 '!=' x1
+ objcopy -R .modname -R .moddeps all_video.module all_video.mod.tmp
+ mktemp /tmp/tmp.XXXXXXXXXX
+ t1=/tmp/tmp.t9sjgVroO4
+ printf 'all_video\0'
+ mktemp /tmp/tmp.XXXXXXXXXX
+ t2=/tmp/tmp.gh7SdJ96c2
+ printf 'vbe\0'
+ printf 'vga\0'
+ printf 'video_bochs\0'
+ printf 'video_cirrus\0'
+ test -n ' vbe vga video_bochs video_cirrus'
+ objcopy --add-section '.modname=/tmp/tmp.t9sjgVroO4' --add-section '.moddeps=/tmp/tmp.gh7SdJ96c2' all_video.mod.tmp
+ rm -f /tmp/tmp.t9sjgVroO4 /tmp/tmp.gh7SdJ96c2
+ test xpc '!=' xemu
+ strip --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note.gnu.gold-version -R .note.GNU-stack -R .note -R .comment all_video.mod.tmp
+ test -z ''
+ ./build-grub-module-verifier all_video.mod.tmp i386
build-grub-module-verifier: error: no symbol table.

Now I commented out in genmod.sh the line to remove $t1 and $t2 in order to see what gets there.
So the one contains "all_video", while the other contains "vbevgavideo_bochsvideo_cirrus". Should it not be rather "vbe vga video_bosh video_cirrus"?

Kostya Berger <bergerkos>
Wed 27 Jan 2016 07:07:49 PM UTC, comment #6:

This is something with your toolchain. When I generate module from the same all_video.module sumbol table is preserved. Try to execute step by step manually (see grub-core/genmod.sh) to find out when it gets lost.

bor@bor-Latitude-E5450:~/build/grub/grub-core$ TARGET_OBJ2ELF= sh genmod.sh moddep.lst all_video.module build-grub-module-verifier all_video.mod
bor@bor-Latitude-E5450:~/build/grub/grub-core$ LC_ALL=C objdump -x all_video.mod
all_video.mod: file format elf32-i386
all_video.mod
architecture: i386, flags 0x00000010:
HAS_SYMS
start address 0x00000000

Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00000000 00000000 00000000 00000034 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 00000000 00000000 00000000 00000034 2**0
CONTENTS, ALLOC, LOAD, DATA
2 .module_license 0000000f 00000000 00000000 00000034 2**0
CONTENTS, ALLOC, LOAD, DATA
3 .bss 00000000 00000000 00000000 00000043 2**0
ALLOC
4 .moddeps 00000021 00000000 00000000 00000043 2**0
CONTENTS, READONLY
5 .modname 0000000a 00000000 00000000 00000064 2**0
CONTENTS, READONLY
SYMBOL TABLE:

                1. l d .text 00000000 .text
                2. l d .data 00000000 .data
                3. l d .module_license 00000000 .module_license
                4. l d .bss 00000000 .bss
                5. l d .moddeps 00000000 .moddeps
                6. l d .modname 00000000 .modname

bor@bor-Latitude-E5450:~/build/grub/grub-core$ LC_ALL=C objdump -x /tmp/all_video.mod.46986

/tmp/all_video.mod.46986: file format elf32-i386
/tmp/all_video.mod.46986
architecture: i386, flags 0x00000000:

start address 0x00000000

Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00000000 00000000 00000000 00000034 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 00000000 00000000 00000000 00000034 2**0
CONTENTS, ALLOC, LOAD, DATA
2 .module_license 0000000f 00000000 00000000 00000034 2**0
CONTENTS, ALLOC, LOAD, DATA
3 .bss 00000000 00000000 00000000 00000043 2**0
ALLOC
4 .moddeps 00000021 00000000 00000000 00000043 2**0
CONTENTS, READONLY
5 .modname 0000000a 00000000 00000000 00000064 2**0
CONTENTS, READONLY
SYMBOL TABLE:
no symbols

bor@bor-Latitude-E5450:~/build/grub/grub-core$

Andrei Borzenkov <arvidjaar>
Project Member
Wed 27 Jan 2016 06:40:25 PM UTC, comment #5:

Here, configure output, too.

(file #36185)

Kostya Berger <bergerkos>
Wed 27 Jan 2016 06:38:22 PM UTC, comment #4:

Here you are.

(file #36182, file #36183, file #36184)

Kostya Berger <bergerkos>
Wed 27 Jan 2016 05:40:41 PM UTC, comment #3:

It does not really matter. Commit you mention introduced module verifier, which is why it is the first to fail. The problem is most likely in your toolchain, but we need to see what sections actually exist in object. I guess make output is not needed, but configure and config.log would be useful.

Andrei Borzenkov <arvidjaar>
Project Member
Wed 27 Jan 2016 05:27:54 PM UTC, comment #2:

For which build? For the last or for the first bad (i.e. a7cf8b1e235fbbc8a460510615c7ff85f21c2d05) ?

Kostya Berger <bergerkos>
Wed 27 Jan 2016 03:40:45 AM UTC, comment #1:

Please attach all_video.module and all_video.mod.tmp (latter should be left by genmod.sh). Also full configure and make log.

Andrei Borzenkov <arvidjaar>
Project Member
Wed 27 Jan 2016 01:19:24 AM UTC, original submission:

Fails to build. Git bisect shows first failing commit to be a7cf8b1e235fbbc8a460510615c7ff85f21c2d05
Used GCC version = 4.8.5_2

Failing command:
...
mv syminfo.lst.new syminfo.lst
cat syminfo.lst | sort | /usr/bin/awk -f ./genmoddep.awk > moddep.lst || (rm -f moddep.lst; exit 1)
gcc -o build-grub-module-verifier -I../include -DGRUB_FILE=\".util/grub-module-verifier.c\" -I. -I. -I.. -I.. -I../include -I../include -I../grub-core/lib/libgcrypt-grub/src/ -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-module-verifier\" ../util/grub-module-verifier.c ../util/grub-module-verifier32.c ../util/grub-module-verifier64.c ../grub-core/kern/emu/misc.c ../util/misc.c
TARGET_OBJ2ELF= sh genmod.sh moddep.lst disk.module build-grub-module-verifier disk.mod
TARGET_OBJ2ELF= sh genmod.sh moddep.lst trig.module build-grub-module-verifier trig.mod
....
TARGET_OBJ2ELF= sh genmod.sh moddep.lst all_video.module build-grub-module-verifier all_video.mod
build-grub-module-verifier: error: no symbol table.
Makefile:42419: recipe for target 'all_video.mod' failed
gmake[5]: *** [all_video.mod] Error 1
gmake[5]: Leaving directory '/home/kostya/grub2-dev/work/grub-a7cf8b1e235fbbc8a460510615c7ff85f21c2d05/grub-core'

Kostya Berger <bergerkos>

 

Attached Files
file #36185:  configure.output.txt added by bergerkos (31KiB - text/plain - didn't attach at the first take)
file #36182:  all_video.module added by bergerkos (5KiB - application/octet-stream - Here session.txt is full make output just in case (including configure), the rest is obvious)
file #36183:  config.log added by bergerkos (677KiB - text/x-log - Here session.txt is full make output just in case (including configure), the rest is obvious)
file #36184:  all_video.mod.tmp added by bergerkos (492B - application/octet-stream - Here session.txt is full make output just in case (including configure), the rest is obvious)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by phcoder (Posted a comment)
  • -unavailable- added by arvidjaar (Posted a comment)
  • -unavailable- added by bergerkos (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 03 Feb 2016 05:36:43 PM UTCarvidjaarStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Wed 27 Jan 2016 06:40:25 PM UTCbergerkosAttached File-=>Added configure.output.txt, #36185
    Wed 27 Jan 2016 06:38:22 PM UTCbergerkosAttached File-=>Added all_video.module, #36182
      Attached File-=>Added config.log, #36183
      Attached File-=>Added all_video.mod.tmp, #36184

    Back to the top


    Powered by Savane 3.1-cleanup1