bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/23261] New: objcopy doesn't convert REL to RELA relocation


From: s at pahtak dot org
Subject: [Bug binutils/23261] New: objcopy doesn't convert REL to RELA relocations when converting from i386 to x86-64.
Date: Tue, 05 Jun 2018 21:02:22 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=23261

            Bug ID: 23261
           Summary: objcopy doesn't convert REL to RELA relocations when
                    converting from i386 to x86-64.
           Product: binutils
           Version: 2.30
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: s at pahtak dot org
  Target Milestone: ---

Created attachment 11055
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11055&action=edit
Object file which demonstrates the problem.

Converting a relocatable elf32-i386 file with REL relocations (implicit
addends) to elf64-x86-64 converts the relocation sections to 64-bit but does
not convert to RELA (explicit addend) relocations.

Run

    objcopy -I elf32-i386 -O elf64-x86-64 bug.o bug-64.o

on the attached bug.o and examine the result with readelf -S bug-64.o

Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .text._start      PROGBITS         0000000000000000  00000040
       0000000000000007  0000000000000000  AX       0     0     16
  [ 2] .rel.text._start  REL              0000000000000000  00000128
       0000000000000010  0000000000000010   I       4     1     8
  [ 3] .text.foo         PROGBITS         0000000000000000  00000050
       000000000000000a  0000000000000000  AX       0     0     16
  [ 4] .symtab           SYMTAB           0000000000000000  00000060
       00000000000000a8  0000000000000018           5     6     8
  [ 5] .strtab           STRTAB           0000000000000000  00000108
       0000000000000020  0000000000000000           0     0     1
  [ 6] .shstrtab         STRTAB           0000000000000000  00000138
       0000000000000036  0000000000000000           0     0     1

The resulting object file is correctly handled by ld.bfd, causes an internal
error in ld.gold

ld.gold: internal error in scan_relocatable_relocs, at
../../gold/x86_64.cc:5118

and is linked incorrectly in ld.lld (it ignores the implicit addend of REL in
x86-64).

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]