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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 23 13:06:07 PDT 2021


MaskRay added inline comments.


================
Comment at: llvm/test/tools/llvm-objcopy/ELF/rename-section-relocsec.test:1
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-objcopy --rename-section=.text=.text2 --rename-section=.data=.data2 %t %t2
----------------
The two tests can be combined.

One file with different cases is sometimes easier to comprehend than having multiple files.

Is there a test renaming non-SHF_ALLOC relocation section?


================
Comment at: llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp:596
+      // sections are renamed.
+      // Dynamic relocation sections (i.e. SHT_REL[A] with SHF_ALLOC) should be
+      // renamed as normal sections to match the behavior of GNU objcopy.
----------------
You can omit `SHT_REL[A]` since the list will be incomplete. We may have [[ https://sourceware.org/bugzilla/show_bug.cgi?id=27924 | `SHT_RELR` ]] in the future :) 


================
Comment at: llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp:611-612
       }
     }
+    // Rename relocation sections similarly to their targets.
+    for (RelocationSectionBase *RelocSec : RelocSections) {
----------------
according to?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110352/new/

https://reviews.llvm.org/D110352



More information about the llvm-commits mailing list