Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 438058 - sys-devel/binutils: gold linker is unable to handle 16-bit real mode code
Summary: sys-devel/binutils: gold linker is unable to handle 16-bit real mode code
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
: 485078 (view as bug list)
Depends on:
Blocks: systemwide-gold
  Show dependency tree
 
Reported: 2012-10-12 02:42 UTC by Alexandre Rostovtsev (RETIRED)
Modified: 2015-09-02 05:14 UTC (History)
2 users (show)

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


Attachments
emerge --info (emerge --info seabios.txt,5.99 KB, text/plain)
2012-10-12 02:42 UTC, Alexandre Rostovtsev (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexandre Rostovtsev (RETIRED) gentoo-dev 2012-10-12 02:42:08 UTC
Created attachment 326346 [details]
emerge --info

# binutils-config --linker ld.gold
 * Setting default linker to ld.gold for x86_64-pc-linux-gnu-2.22.90 ...  [ ok ]
# MAKEOPTS=-j1 emerge -1 seabios
Calculating dependencies... done!

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) sys-firmware/seabios-1.7.0
 * seabios-1.7.0.tar.gz SHA256 SHA512 WHIRLPOOL size ;-) ...             [ ok ]
 * seabios-1.7.0-bins.tar.xz SHA256 SHA512 WHIRLPOOL size ;-) ...        [ ok ]
>>> Unpacking source...
>>> Unpacking seabios-1.7.0.tar.gz to /var/tmp/portage/sys-firmware/seabios-1.7.0/work
>>> Unpacking seabios-1.7.0-bins.tar.xz to /var/tmp/portage/sys-firmware/seabios-1.7.0/work
>>> Source unpacked in /var/tmp/portage/sys-firmware/seabios-1.7.0/work
>>> Preparing source in /var/tmp/portage/sys-firmware/seabios-1.7.0/work/seabios-1.7.0 ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/sys-firmware/seabios-1.7.0/work/seabios-1.7.0 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/sys-firmware/seabios-1.7.0/work/seabios-1.7.0 ...
make -j1 out/bios.bin 
  Working around non-functional -combine
  Build default config
#
# configuration written to /var/tmp/portage/sys-firmware/seabios-1.7.0/work/seabios-1.7.0/.config
#
  Working around non-functional -combine
  Build Kconfig config file
  Compiling whole program out/ccode32flat.o
  Compiling whole program out/code32seg.o
  Compiling whole program out/ccode16.o
  Compiling to assembler out/asm-offsets.s
  Generating offset file out/asm-offsets.h
  Compiling (16bit) out/romlayout.o
  Building ld scripts
Version: 1.7.0-20121011_223928-rook
Fixed space: 0xe05b-0x10000  total: 8101  slack: 8  Percent slack: 0.1%
16bit size:           39056
32bit segmented size: 1418
32bit flat size:      14742
32bit flat init size: 57200
  Linking out/rom16.o
  Stripping out/rom16.strip.o
  Linking out/rom32seg.o
  Stripping out/rom32seg.strip.o
  Linking out/rom.o
ld: error: out/rom16.strip.o: unsupported ELF file type 2
ld: error: out/rom32seg.strip.o: unsupported ELF file type 2
make: *** [out/rom.o] Error 1
 * ERROR: sys-firmware/seabios-1.7.0 failed (compile phase):
 *   emake failed
 * 
 * If you need support, post the output of `emerge --info '=sys-firmware/seabios-1.7.0'`,
 * the complete build log and the output of `emerge -pqv '=sys-firmware/seabios-1.7.0'`.
 * The complete build log is located at '/var/tmp/portage/sys-firmware/seabios-1.7.0/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-firmware/seabios-1.7.0/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-firmware/seabios-1.7.0/work/seabios-1.7.0'
 * S: '/var/tmp/portage/sys-firmware/seabios-1.7.0/work/seabios-1.7.0'


When using ld.bfd as the linker, seabios builds successfully.
Comment 1 Doug Goldstein (RETIRED) gentoo-dev 2012-10-12 13:40:52 UTC
Gold doesn't support 16-bit real mode code, which is what a BIOS is, so until it does its can't be considered a full replacement to ld.bfd.
Comment 2 Doug Goldstein (RETIRED) gentoo-dev 2013-06-16 00:47:31 UTC
Until gold supports 16-bit real mode there's nothing for the virtualization guys to do here. You're building a BIOS, there's no other options other than what we need.

Given that gold creates Grub's that aren't bootable, that should have been the first warning this wouldn't work.

Kicking this over to toolchain to see how they want to triage this.
Comment 3 SpanKY gentoo-dev 2013-09-05 09:26:20 UTC
you could file a bug upstream, but i suspect they aren't interested in supporting it in gold ...

if the -fuse-ld flag ever goes mainline, we'll probably want to update packages to start using that.
Comment 4 Doug Goldstein (RETIRED) gentoo-dev 2013-09-17 01:41:38 UTC
*** Bug 485078 has been marked as a duplicate of this bug. ***
Comment 5 Ryan Hill (RETIRED) gentoo-dev 2013-10-06 08:19:54 UTC
> if the -fuse-ld flag ever goes mainline, we'll probably want to update
> packages to start using that.

It's available in 4.8.
Comment 7 SpanKY gentoo-dev 2015-03-16 21:22:31 UTC
i've added helpers for ebuilds:
http://sources.gentoo.org/eclass/toolchain-funcs.eclass?r1=1.134&r2=1.135
Comment 9 SpanKY gentoo-dev 2015-09-02 05:14:25 UTC
afaik gold doesn't plan on supporting this, and all the known packages that need it use the bfd-fallback helpers.  if you find packages that still fail, please file new bugs for each one.