http://sourceware.org/bugzilla/show_bug.cgi?id=13947

--- Comment #11 from H.J. Lu <hjl.tools at gmail dot com> 2012-04-12 00:33:30 
UTC ---
The problem is strip removes relocation while keeping
an empty relocation section:

[hjl@gnu-6 pr13947]$ cat foo.s
    .text
    .globl _start
_start:
    .dc.a foo
    .data
    .globl foo
foo:
    .byte 20
[hjl@gnu-6 pr13947]$ gcc -c foo.s
[hjl@gnu-6 pr13947]$ readelf -r foo.o

Relocation section '.rela.text' at offset 0x320 contains 1 entries:
  Offset          Info           Type           Sym. Value    Sym. Name +
Addend
000000000000  000500000001 R_X86_64_64       0000000000000000 foo + 0
[hjl@gnu-6 pr13947]$ strip foo.o
[hjl@gnu-6 pr13947]$ readelf -rS foo.o
There are 6 section headers, starting at offset 0x70:

Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .text             PROGBITS         0000000000000000  00000040
       0000000000000008  0000000000000000  AX       0     0     4
  [ 2] .rela.text        RELA             0000000000000000  000001f0
       0000000000000000  0000000000000018           0     1     8
  [ 3] .data             PROGBITS         0000000000000000  00000048
       0000000000000001  0000000000000000  WA       0     0     4
  [ 4] .bss              NOBITS           0000000000000000  0000004c
       0000000000000000  0000000000000000  WA       0     0     4
  [ 5] .shstrtab         STRTAB           0000000000000000  0000004c
       0000000000000021  0000000000000000           0     0     1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

There are no relocations in this file.
[hjl@gnu-6 pr13947]$ 

The empty relocation section confuses strip when mapping sections
to segments.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to