bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/13947] Strip applied twice corrupts binaries compiled with --emi


From: hjl.tools at gmail dot com
Subject: [Bug ld/13947] Strip applied twice corrupts binaries compiled with --emit-relocs
Date: Thu, 12 Apr 2012 00:33:30 +0000

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:

address@hidden pr13947]$ cat foo.s
    .text
    .globl _start
_start:
    .dc.a foo
    .data
    .globl foo
foo:
    .byte 20
address@hidden pr13947]$ gcc -c foo.s
address@hidden 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
address@hidden pr13947]$ strip foo.o
address@hidden 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.
address@hidden 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.



reply via email to

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