Bug 10698 - gold fails to link linux kernel
Summary: gold fails to link linux kernel
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.21
: P2 normal
Target Milestone: ---
Assignee: Ian Lance Taylor
Depends on:
Reported: 2009-09-27 18:05 UTC by Bernhard Rosenkraenzer
Modified: 2009-10-21 09:05 UTC (History)
1 user (show)

See Also:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Bernhard Rosenkraenzer 2009-09-27 18:05:24 UTC
LD      .tmp_vmlinux1
ld: error: invalid assignment to dot outside of SECTIONS
ld: error: invalid assignment to dot outside of SECTIONS
ld: internal error in convert_types, at ../../gold/gold.h:294
make: *** [.tmp_vmlinux1] Error 1
Comment 1 Ian Lance Taylor 2009-10-16 06:00:50 UTC
This may be fixed now.  Please let me know if it is not.
Comment 2 Bernhard Rosenkraenzer 2009-10-19 10:38:27 UTC
Not fixed.

[bero@ebertswil linux-2.6.31]$ ld --version
GNU gold (Linux/GNU Binutils 1.9
Copyright 2008 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
[bero@ebertswil linux-2.6.31]$ make 2>&1 |tail -n 5
  LD      .tmp_vmlinux1
ld: error: invalid assignment to dot outside of SECTIONS
ld: error: invalid assignment to dot outside of SECTIONS
ld: internal error in convert_types, at ../../gold/gold.h:294
make: *** [.tmp_vmlinux1] Error 1
Comment 3 Octoploid 2009-10-19 15:38:02 UTC
Fixed in the 2.20 release here.
Comment 4 Ian Lance Taylor 2009-10-19 15:43:26 UTC
Bernhard: you were not using the current linker sources.
Comment 5 Bernhard Rosenkraenzer 2009-10-19 19:15:04 UTC
Hmm, right, the kernel.org version seems to be rather out of sync with gold (odd, given it's supposed to 
be synced)...

2.20 doesn't compile with the options I'm using, but that's a separate issue, will open a new bug for 
Comment 6 Sedat Dilek 2009-10-21 07:47:19 UTC

I have already reported that issue to LKML [1] and am still in conversion with Ian.
Leaving out "--emit-relocs" or unsetting CONFIG_RELOCATABLE kernel-config
variable let gold compile Linux-2.6.31-rc5-git3.

This weekend I could track down the problem to (with binutils-cvs20091017):
GOOD: 2.6.29-rc8 and 2.6.30
BAD: upstream (up-to 2.6.32-rc5-git1), 2.6.31, 2.6.31-{rc5..rc1}

If you look at the kernel-sources the "incompatibility" arosed between 2.6.30
and the merge-window resulted in 2.6.31-rc1.

With upstream kernel, (un)setting CONFIG_RELOCATABLE and binutils-2.20.51
snapshot tarball from 21-Oct-2009 gold still fails:
  LD      drivers/built-in.o
  LD      vmlinux.o
  MODPOST vmlinux.o
WARNING: vmlinux.o(.devinit.text+0x387c): Section mismatch in reference from the
function ezx_pcap_probe() to the function .init.text:set_irq_noprobe()
The function __devinit ezx_pcap_probe() references
a function __init set_irq_noprobe().
If set_irq_noprobe is only used by ezx_pcap_probe then
annotate set_irq_noprobe with a matching annotation.

  GEN     .version
  CHK     include/generated/compile.h
  UPD     include/generated/compile.h
  CC      init/version.o
  LD      init/built-in.o
  LD      .tmp_vmlinux1
ld: internal error in convert_types, at ../../gold/gold.h:294
make[3]: *** [.tmp_vmlinux1] Error 1

Also the binutils-gold (2.20-1) package from Debian/sid fails.

I prepared an archive with all involved input files, see [3].

Hope this get fixed, soon.

IMHO, it would be a good idea to get in contact with the responsible maintainers
in Linux-kernel.

The bug is *NOT* fixed.

- Sedat -

[1] [binutils-gold][2.6.31-rc5-git3] ld error w/ LDFLAGS_vmlinux := --emit-reloc
[2] ftp://sourceware.org/pub/binutils/snapshots/binutils-2.20.51.tar.bz2
[3] http://files.iniza.org/for_iant/
Comment 7 Sedat Dilek 2009-10-21 08:09:52 UTC
For the sake of completeness:
In [1] is the web-link to the patch to gold Ian mentionned in "Additional
Comment #1".

[1] gold patch committed: Permit assignment to dot outside of SECTIONS
Comment 8 Sedat Dilek 2009-10-21 08:13:09 UTC
I put my latest kernel dot-config file and the build-log on [1].

[1] http://files.iniza.org/for_iant/build-with-binutils-
Comment 9 Sedat Dilek 2009-10-21 09:05:10 UTC
Eliminating "--emit-relocs" or unsetting CONFIG_RELOCATABLE in kernel-config
does not fix it, too.

This is the "ld-line", if you want to try it manually (here: for i386):

ld -m elf_i386 --emit-relocs --build-id -X -o .tmp_vmlinux1 -T
arch/x86/kernel/vmlinux.lds arch/x86/kernel/head_32.o arch/x86/kernel/head32.o
arch/x86/kernel/head.o arch/x86/kernel/init_task.o  init/built-in.o
--start-group  usr/built-in.o  arch/x86/built-in.o  kernel/built-in.o 
mm/built-in.o  fs/built-in.o  ipc/built-in.o  security/built-in.o 
crypto/built-in.o  block/built-in.o  lib/lib.a  arch/x86/lib/lib.a 
lib/built-in.o  arch/x86/lib/built-in.o  drivers/built-in.o  sound/built-in.o 
firmware/built-in.o  arch/x86/pci/built-in.o  arch/x86/power/built-in.o 
arch/x86/video/built-in.o  net/built-in.o --end-group