Bug 17566 - ld: internal error in set_is_section_symbol, at object.h:1771 building Linux kernel on ppc64
Summary: ld: internal error in set_is_section_symbol, at object.h:1771 building Linux ...
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.26
: P2 normal
Target Milestone: ---
Assignee: Alan Modra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-07 19:01 UTC by Markus Trippelsdorf
Modified: 2014-12-03 15:35 UTC (History)
2 users (show)

See Also:
Host: powerpc64-unknown-linux-gnu
Target: powerpc64-unknown-linux-gnu
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Trippelsdorf 2014-11-07 19:01:21 UTC
Building the Linux kernel on a POWER8 machine:

trippels@gcc2-power8 linux-3.17.2 % ld -m elf32ppc -T arch/powerpc/boot/zImage.lds -Ttext 0x20000000 -pie -o arch/powerpc/boot/zImage.epapr arch/powerpc/boot/epapr.o arch/powerpc/boot/epapr-wrapper.o ./zImage.111199.o arch/powerpc/boot/wrapper.a
ld: internal error in set_is_section_symbol, at object.h:1771

Works fine without -pie.

trippels@gcc2-power8 linux-3.17.2 % cat arch/powerpc/boot/zImage.lds
OUTPUT_ARCH(powerpc:common)
ENTRY(_zimage_start)
EXTERN(_zimage_start)
SECTIONS
{
  .text :
  {
    _start = .;
    *(.text)
    *(.fixup)
    _etext = .;
  }
  . = ALIGN(4096);
  .data :
  {
    *(.rodata*)
    *(.data*)
    *(.sdata*)
    *(.got2)
  }
  .dynsym : { *(.dynsym) }
  .dynstr : { *(.dynstr) }
  .dynamic :
  {
    __dynamic_start = .;
    *(.dynamic)
  }
  .hash : { *(.hash) }
  .interp : { *(.interp) }
  .rela.dyn :
  {
    *(.rela*)
  }
  . = ALIGN(8);
  .kernel:dtb :
  {
    _dtb_start = .;
    *(.kernel:dtb)
    _dtb_end = .;
  }
  . = ALIGN(4096);
  .kernel:vmlinux.strip :
  {
    _vmlinux_start = .;
    *(.kernel:vmlinux.strip)
    _vmlinux_end = .;
  }
  . = ALIGN(4096);
  .kernel:initrd :
  {
    _initrd_start = .;
    *(.kernel:initrd)
    _initrd_end = .;
  }
  . = ALIGN(4096);
  .bss :
  {
    _edata = .;
    __bss_start = .;
    *(.sbss)
    *(.bss)
    *(COMMON)
    _end = . ;
  }
}
Comment 1 Cary Coutant 2014-12-02 18:45:53 UTC
Alan, can you take a look at this one, too?

I'm guessing that when you need a dynamic relocation against a section symbol, you're calling add_local() instead of add_local_section(). I don't see any checks for STT_SECTION in the powerpc target code.
Comment 2 Markus Trippelsdorf 2014-12-03 09:45:28 UTC
To reproduce:

trippels@gcc2-power8 linux-3.17.2 % make defconfig
trippels@gcc2-power8 linux-3.17.2 % make -j160 
...
ld: internal error in set_is_section_symbol, at object.h:1771
Comment 3 Markus Trippelsdorf 2014-12-03 11:20:26 UTC
Possible fix as suggested in comment 1:

diff --git a/gold/powerpc.cc b/gold/powerpc.cc
index 554bf38..97b6e39 100644
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -5581,7 +5581,7 @@ Target_powerpc<size, big_endian>::Scan::local(
            { 
              check_non_pic(object, r_type);
              unsigned int r_sym = elfcpp::elf_r_sym<size>(reloc.get_r_info());
-             rela_dyn->add_local(object, r_sym, r_type, output_section,
+             rela_dyn->add_local_section(object, r_sym, r_type, output_section,
                                  data_shndx, reloc.get_r_offset(),
                                  reloc.get_r_addend());
            }
Comment 4 Sourceware Commits 2014-12-03 14:41:50 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, master has been updated
       via  1f98a0748c4dfae57a76c408501c938480c1173c (commit)
      from  ff1eb2b544c8500f48eff3418ac1e005acd5e3fe (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1f98a0748c4dfae57a76c408501c938480c1173c

commit 1f98a0748c4dfae57a76c408501c938480c1173c
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Dec 3 21:56:19 2014 +1030

    powerpc gold, fix pr17566
    
    Code stolen from arm.cc.
    
    	PR 17566
    	* powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
    	when adding dynamic relocations against section symbols.

-----------------------------------------------------------------------

Summary of changes:
 gold/ChangeLog  |    6 ++++++
 gold/powerpc.cc |   20 +++++++++++++++++---
 2 files changed, 23 insertions(+), 3 deletions(-)
Comment 5 Sourceware Commits 2014-12-03 14:45:04 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, binutils-2_25-branch has been updated
       via  a9c9ac20a264dea3afff321e651fbbec0122af38 (commit)
      from  631d040f80d99b7b993abd77c9d064fa8bccd711 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a9c9ac20a264dea3afff321e651fbbec0122af38

commit a9c9ac20a264dea3afff321e651fbbec0122af38
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Dec 3 21:56:19 2014 +1030

    powerpc gold, fix pr17566
    
    Code stolen from arm.cc.
    
    	PR 17566
    	* powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
    	when adding dynamic relocations against section symbols.

-----------------------------------------------------------------------

Summary of changes:
 gold/ChangeLog  |    6 ++++++
 gold/powerpc.cc |   20 +++++++++++++++++---
 2 files changed, 23 insertions(+), 3 deletions(-)
Comment 6 Markus Trippelsdorf 2014-12-03 15:35:09 UTC
Fixed. Thanks.