Summary: | app-emulation/virtualbox-4.3.0 fails with ld.gold - ld: internal error in segment_precedes, at /var/tmp/portage/sys-devel/binutils-2.23.2/work/binutils-2.23.2/gold/layout.cc:3100 | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Justin Lecher (RETIRED) <jlec> |
Component: | Current packages | Assignee: | Gentoo Toolchain Maintainers <toolchain> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | alex_y_xu, johannes.hirte, markpariente, markus.knetschke, njsg, paolo.pedroni, patrick, polynomial-c, zeekec |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
See Also: | https://sourceware.org/bugzilla/show_bug.cgi?id=16389 | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
virtualbox-4.3.0:20131016-063642.log.xz
virtualbox-4.3.32.ebuild.patch |
Description
Justin Lecher (RETIRED)
2013-10-16 07:28:07 UTC
Created attachment 360988 [details]
virtualbox-4.3.0:20131016-063642.log.xz
build.log
upstream bug: https://sourceware.org/bugzilla/show_bug.cgi?id=12898 Reproducible with sys-devel/binutils-2.23.2 and app-emulation/virtualbox-4.3.0-r2. Reproducible with sys-devel/binutils-2.24-r3 and app-emulation/virtualbox-4.3.12. BTW, upstream bug is marked as RESOLVED FIXED in 2011. Does anyone know in which version of ld.gold the fixes landed? BTW, one other problem is that the virtualbox build system, at least at that point, does not respect the LD and/or LDFLAGS environment variables. We can see that the ld command is called directly: ld -N --no-check-sections --gc-sections -T /var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/src/VBox/Devices/PC/ipxe/src/arch/i386/scripts/i386.lds -u _rom_start --defsym check__rom_start=_rom_start -u obj_config --defsym check_obj_config=obj_config --defsym pci_vendor_id=0x8086 --defsym pci_device_id=0x100E -e _rom_start -m elf_i386 -o /var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/out/linux.amd64/release/obj/iPxeBaseBin/iPxeBaseBin /var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/out/linux.amd64/release/obj/iPxeBaseBin/src/arch/i386/core/basemem_packet.o /var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/out/linux.amd64/release/obj/iPxeBaseBin/src/arch/i386/core/relocate.o /var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/out/linux.amd64/release/obj/iPxeBaseBin/src/arch/i386/core/timer2.o [...snip...] Otherwise one could work around this issue with a file in /etc/portage/env with something like: LD="/usr/bin/ld.bfd" CFLAGS="${CFLAGS} -fuse-ld=bfd" CXXFLAGS="${CXXFLAGS} -fuse-ld=bfd" LDFLAGS="${LDFLAGS} -Wl,-fuse-ld=bfd" (as I do for the few packages that have problems with ld.gold) (In reply to Paolo Pedroni from comment #5) > BTW, one other problem is that the virtualbox build system, at least at that > point, does not respect the LD and/or LDFLAGS environment variables. We can > see that the ld command is called directly: > > ld -N --no-check-sections --gc-sections -T > /var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/src/ > VBox/Devices/PC/ipxe/src/arch/i386/scripts/i386.lds -u _rom_start --defsym > check__rom_start=_rom_start -u obj_config --defsym > check_obj_config=obj_config --defsym pci_vendor_id=0x8086 --defsym > pci_device_id=0x100E -e _rom_start -m elf_i386 -o > /var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/out/ > linux.amd64/release/obj/iPxeBaseBin/iPxeBaseBin > /var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/out/ > linux.amd64/release/obj/iPxeBaseBin/src/arch/i386/core/basemem_packet.o > /var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/out/ > linux.amd64/release/obj/iPxeBaseBin/src/arch/i386/core/relocate.o > /var/tmp/portage/app-emulation/virtualbox-4.3.0/work/VirtualBox-4.3.0/out/ > linux.amd64/release/obj/iPxeBaseBin/src/arch/i386/core/timer2.o > [...snip...] > > Otherwise one could work around this issue with a file in /etc/portage/env > with something like: > LD="/usr/bin/ld.bfd" > CFLAGS="${CFLAGS} -fuse-ld=bfd" > CXXFLAGS="${CXXFLAGS} -fuse-ld=bfd" > LDFLAGS="${LDFLAGS} -Wl,-fuse-ld=bfd" > > (as I do for the few packages that have problems with ld.gold) known issue, irrelevant for this bug Reproducible with virtualbox-4.3.28, binutils 2.24-r3 (amd64): ld: internal error in segment_precedes, at /var/tmp/portage/sys-devel/binutils-2.24-r3/work/binutils-2.24/gold/layout.cc:3336 does binutils-2.25.1 work any better ? (In reply to SpanKY from comment #8) > does binutils-2.25.1 work any better ? Still the same. Created attachment 417764 [details, diff]
virtualbox-4.3.32.ebuild.patch
Regardless of whether or not those patches from upstream fix the bug, it seems that the ipxe/ portion of the build system is hard-coding linker stuff and/or not using the ld and ldflags specified by the configure stage.
Firstly, ipxe has it's own makefile that uses CC, LD, etc directly (with defaults assigned), so we need to tc-export all the usual variables in order for that makefile to not use the generic defaults.
Secondly, ipxe also has a Makefile.kmk that uses a hard-coded 'ld'd) to match ipxe's own makefile.
With these two changes, we can also use 'tc-ld-disable-gold' as a workaround if the patches from upstream don't work.
The attached patch adds these changes to virtualbox-4.3.32.ebuild, which test-builds fine here with gcc-4.9.3 and lg.gold globally selected.
we have a system ipxe already, but if vbox wants to keep its own, disabling gold just for that is reasonable. the low level/bare metal firmware rarely works with gold and upstream isn't generally interested in adding features to fix it. (In reply to Ian Stakenvicius from comment #10) > The attached patch adds these changes to virtualbox-4.3.32.ebuild, which > test-builds fine here with gcc-4.9.3 and lg.gold globally selected. This works great, same patch applies to virtualbox-5.0.10.ebuild, please apply it to the tree. commit 82049238b1004c9715b574014e1c257924fe0f72 Author: PPed72 <paolo.pedroni@iol.it> Date: Mon Mar 7 14:39:26 2016 app-emulation/virtualbox: force usage of ld.bfd for virtualbox-5 See Gentoo bug #488176 I've just backported this change to virtualbox-4.3.38 and 4.3.40 as well, as link failures on the current stable package are really annoying. |