https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/ Issue: sys-boot/grub-2.06_rc1 fails to compile. Discovered on: amd64 (internal ref: tinderbox) NOTE: This machine uses GCC-11: https://gcc.gnu.org/gcc-11/porting_to.html If you think this is a GCC-11 related issue, please block bug 732706.
Created attachment 704730 [details] build.log.xz build log and emerge --info (compressed because it exceeds attachment limit, use 'xzless' to read it)
Possible context of error(s): collect2: error: ld returned 1 exit status
Relevant line from the log: > /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: section .note.gnu.property VMA [0000000000400158,0000000000400187] overlaps section .bss VMA [000000000000f000,000000000041e1b7] I can reproduce the issue with gcc-10.3.0 and gcc-11.1.0. Maybe something to do with binutils?
Yes, it's a binutils-2.36 section. I suggest ignoring .note.gnu.property. The change should be similar to https://mail.coreboot.org/hyperkitty/list/seabios@seabios.org/thread/5HOETPBPQKC2Y5PRFFSYDHBPWOTC7VQV/
I get the same error with binutils-2.35.2. This might just be some regression in grub-2.06~rc1.
Same error with grub-2.04.
I believe this is the failing command. I don't see any linker scripts referenced. > x86_64-pc-linux-gnu-gcc -std=gnu99 -Os -m64 -Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations -Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2 -freg-struct-return -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow -msoft-float -fno-dwarf2-cfi-asm -mno-stack-arg-probe -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-ident -mcmodel=large -fno-PIE -fno-pie -fno-stack-protector -Wtrampolines -ffreestanding -m64 -Wl,-melf_x86_64 -no-pie -Wl,--build-id=none -nostdlib -Wl,-N -Wl,-N -Wl,-Ttext,0 -o kernel.exec kern/x86_64/xen/kernel_exec-startup.o kern/x86_64/kernel_exec-dl.o kern/x86_64/xen/kernel_exec-hypercall.o kern/i386/kernel_exec-tsc.o kern/i386/xen/kernel_exec-tsc.o kern/xen/kernel_exec-init.o term/xen/kernel_exec-console.o disk/xen/kernel_exec-xendisk.o commands/kernel_exec-boot.o term/kernel_exec-terminfo.o term/kernel_exec-tparm.o commands/kernel_exec-extcmd.o lib/kernel_exec-arg.o kern/kernel_exec-compiler-rt.o kern/kernel_exec-mm.o kern/kernel_exec-time.o kern/generic/kernel_exec-millisleep.o kern/kernel_exec-buffer.o kern/kernel_exec-command.o kern/kernel_exec-corecmd.o kern/kernel_exec-device.o kern/kernel_exec-disk.o kern/kernel_exec-dl.o kern/kernel_exec-env.o kern/kernel_exec-err.o kern/kernel_exec-file.o kern/kernel_exec-fs.o kern/kernel_exec-list.o kern/kernel_exec-main.o kern/kernel_exec-misc.o kern/kernel_exec-parser.o kern/kernel_exec-partition.o kern/kernel_exec-rescue_parser.o kern/kernel_exec-rescue_reader.o kern/kernel_exec-term.o kern/kernel_exec-verifiers.o kernel_exec-symlist.o
Yeah, looks like grub uses default linker script. It might be a binutils bug. I'll try to extract small example and file a bug against binutils.
After distilling it down to tiny assembly files I found a NOTABUG on binutils tracker: https://sourceware.org/PR27377 The suggestion is to use not -Wl,-Ttext,0 but -Wl,-Ttext-segment,0
Created attachment 706194 [details, diff] patch fixing .note.ABI-tags and .bss sections overlap
(In reply to Sergei Trofimovich from comment #9) Thank you for pointing me to problem solution. Proposed patch is maybe crude, but functional for me.
I would appreciate it if someone who actually understands this could send a patch upstream for review. I have no way of testing if this actually works at runtime.
https://lists.gnu.org/archive/html/grub-devel/2020-10/msg00095.html
Comment on attachment 706194 [details, diff] patch fixing .note.ABI-tags and .bss sections overlap Assuming this is the correct thing to do, configure.ac should be patched instead of configure.
It was possible to build grub with patch from #c14, but grub-mkimage (as described in https://wiki.xenproject.org/wiki/PvGrub2 or used by app-emulation/grub-xen-host) failed: grub-mkimage: error: `/usr/lib/grub/x86_64-xen/kernel.img' is miscompiled: its start address is 0x150 instead of 0x0: ld.gold bug?.
(In reply to Tomáš Mózes from comment #15) > It was possible to build grub with patch from #c14, but grub-mkimage (as > described in https://wiki.xenproject.org/wiki/PvGrub2 or used by > app-emulation/grub-xen-host) failed: > > grub-mkimage: error: `/usr/lib/grub/x86_64-xen/kernel.img' is miscompiled: > its start address is 0x150 instead of 0x0: ld.gold bug?. The failure is with binutils-2.36.1-r1. Grub compiles fine and grub-xen-host too with the stable binutils-2.35.2.
https://build.opensuse.org/package/view_file/Base:System/grub2/0001-Fix-build-error-in-binutils-2.36.patch Please try adding this patch to grub (and test if the result not just builds but also works!)
(In reply to Andreas K. Hüttel from comment #17) > https://build.opensuse.org/package/view_file/Base:System/grub2/0001-Fix- > build-error-in-binutils-2.36.patch > > Please try adding this patch to grub (and test if the result not just builds > but also works!) Tomáš, are you able to give this a go? Cheers!
Same for me ... But that Suse patch (also need to enable GRUB_AUTORECONF=1 because of aclocal-1.15 needed) - fixes the problem.
(In reply to Sam James from comment #18) > (In reply to Andreas K. Hüttel from comment #17) > > https://build.opensuse.org/package/view_file/Base:System/grub2/0001-Fix- > > build-error-in-binutils-2.36.patch > > > > Please try adding this patch to grub (and test if the result not just builds > > but also works!) > > Tomáš, are you able to give this a go? Cheers! I've just compile tested it, I don't use sys-boot/grub[grub_platforms_xen].
(In reply to Andreas K. Hüttel from comment #17) > https://build.opensuse.org/package/view_file/Base:System/grub2/0001-Fix- > build-error-in-binutils-2.36.patch > > Please try adding this patch to grub (and test if the result not just builds > but also works!) It looks like this patch was sent for review upstream, but has not been accepted/applied. https://lists.gnu.org/archive/html/grub-devel/2021-08/msg00002.html
I'm having the same problem with both binutils-2.36 and the 2.37 which was stabilized a couple of days ago. I think it is not good to have a broken stable ebuild for grub. If we cannot fix the problem yet, then we should require binutils<2.36 if the efi use-flag is used. Otherwise let me know, if I can support with testing patches. I'm actually using grub-xen productively.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=abe655fe66964de0a45e8d0c158bdf3958cdfd1c commit abe655fe66964de0a45e8d0c158bdf3958cdfd1c Author: Mike Gilbert <floppym@gentoo.org> AuthorDate: 2021-09-23 18:47:53 +0000 Commit: Mike Gilbert <floppym@gentoo.org> CommitDate: 2021-09-23 18:47:53 +0000 sys-boot/grub: fix xen build with binutils-2.36 Closes: https://bugs.gentoo.org/787221 Signed-off-by: Mike Gilbert <floppym@gentoo.org> sys-boot/grub/files/grub-2.06-binutils-2.36.patch | 44 +++++++++++++++++++++++ sys-boot/grub/grub-2.06-r1.ebuild | 3 +- 2 files changed, 46 insertions(+), 1 deletion(-)