bug-binutils
[Top][All Lists]
Advanced

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

[Bug binutils/28035] New: objcopy/strip: Don't convert SHT_REL to SHT_RE


From: i at maskray dot me
Subject: [Bug binutils/28035] New: objcopy/strip: Don't convert SHT_REL to SHT_RELA
Date: Wed, 30 Jun 2021 19:59:40 +0000

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

            Bug ID: 28035
           Summary: objcopy/strip: Don't convert SHT_REL to SHT_RELA
           Product: binutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: i at maskray dot me
  Target Milestone: ---

With 'clang' and 'llvm-profdata' built from the main branch of llvm-project
(the future clang 13.0.0 release):

echo -e '#include <stdio.h>\nint main() { puts("foo"); }' > a.c
clang -O1 -fprofile-generate a.c; rm default*.profraw; ./a.out; llvm-profdata
merge default_*.profraw -o a.profdata
clang -O1 -fprofile-use=a.profdata a.c -c

Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg
Lk Inf Al
  [ 0]                   NULL            0000000000000000 000000 000000 00     
0   0  0
  [ 1] .strtab           STRTAB          0000000000000000 0001a0 000097 00     
0   0  1
  [ 2] .text             PROGBITS        0000000000000000 000040 000000 00  AX 
0   0  4
  [ 3] .text.hot.        PROGBITS        0000000000000000 000040 00000f 00  AX 
0   0 16
  [ 4] .rela.text.hot.   RELA            0000000000000000 000138 000030 18    
13   3  8
  [ 5] .rodata.str1.1    PROGBITS        0000000000000000 00004f 000004 01 AMS 
0   0  1
  [ 6] .comment          PROGBITS        0000000000000000 000053 000016 01  MS 
0   0  1
  [ 7] .note.GNU-stack   PROGBITS        0000000000000000 000069 000000 00     
0   0  1
  [ 8] .llvm.call-graph-profile LOOS+0xfff4c09  0000000000000000 000069 000008
08   E 13   0  1
  [ 9] .rel.llvm.call-graph-profile REL             0000000000000000 000168
000020 10     13   8  8
  [10] .eh_frame         X86_64_UNWIND   0000000000000000 000078 000030 00   A 
0   0  8
  [11] .rela.eh_frame    RELA            0000000000000000 000188 000018 18    
13  10  8
  [12] .llvm_addrsig     LOOS+0xfff4c03  0000000000000000 0001a0 000000 00   E
13   0  1
  [13] .symtab           SYMTAB          0000000000000000 0000a8 000090 18     
1   4  8

objcopy --strip-debug a.o a.copy.o


I think it will be good to retain the original section type, don't convert REL
to RELA just because of arch/ABI preference.

---

Just for completeness, the original .rel.llvm.call-graph-profile contains
R_X86_64_NONE relocations.

% readelf -r a.o
...
Relocation section '.rel.llvm.call-graph-profile' at offset 0x168 contains 2
entries:
  Offset          Info           Type           Sym. Value    Sym. Name
000000000000  000400000000 R_X86_64_NONE     0000000000000000 main
000000000000  000500000000 R_X86_64_NONE     0000000000000000 puts
...

-- 
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]