[PATCH] D110352: [llvm-objcopy] Rename relocation sections together with their targets.

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 23 10:48:13 PDT 2021


ikudrin created this revision.
ikudrin added reviewers: jhenderson, MaskRay, rupprecht, alexander-shaposhnikov.
ikudrin added a project: LLVM.
Herald added subscribers: abrachet, emaste.
ikudrin requested review of this revision.

As for now, `llvm-objcopy` renames only sections that are specified explicitly in `--rename-section`, while GNU `objcopy` keeps names of relocation sections in sync with their targets. For example:

  > readelf -S test.o
  ...
    [ 1] .foo      PROGBITS
    [ 2] .rela.foo RELA
  
  > objcopy --rename-section .foo=.bar test.o gnu.o
  > readelf -S gnu.o
  ...
    [ 1] .bar      PROGBITS
    [ 2] .rela.bar RELA
  
  > llvm-objcopy --rename-section .foo=.bar test.o llvm.o
  > readelf -S llvm.o
  ...
    [ 1] .bar      PROGBITS
    [ 2] .rela.foo RELA

This patch makes `llvm-objcopy` to match the behavior of GNU `objcopy` better.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110352

Files:
  llvm/test/tools/llvm-objcopy/ELF/rename-section-dynrelocsec.test
  llvm/test/tools/llvm-objcopy/ELF/rename-section-relocsec.test
  llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110352.374617.patch
Type: text/x-patch
Size: 3667 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210923/bfbb3e40/attachment-0001.bin>


More information about the llvm-commits mailing list