[PATCH] D60042: [llvm-objcopy] Add --prefix-alloc-sections
James Henderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 4 01:37:29 PDT 2019
jhenderson added inline comments.
================
Comment at: llvm/test/tools/llvm-objcopy/ELF/prefix-alloc-sections.test:3
+# RUN: llvm-objcopy --prefix-alloc-sections=.alloc_prefix %t %t2
+# RUN: llvm-readobj --sections %t2 | FileCheck %s
+
----------------
rupprecht wrote:
> It'd be good to check --relocs as well
Dumb question maybe, but what does this give us?
================
Comment at: llvm/test/tools/llvm-objcopy/ELF/rename-section-and-prefix-alloc-sections.test:17
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ - Name: .rel.text
----------------
Not that it really matters, but you don't need the SHF_EXECINSTR here, as it has no impact on the behaviour.
================
Comment at: llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp:614
+ for (auto &Sec : Obj.sections()) {
+ if ((Sec.Flags & SHF_ALLOC) != 0) {
+ Sec.Name = (Config.AllocSectionsPrefix + Sec.Name).str();
----------------
Hmm... What does GNU objcopy do for dynamic relocation sections (i.e. SHT_REL[A] with SHF_ALLOC)? Will it rename them according to the switch, or something else (e.g. renaming based on their target section). In other words, if for example I had a .rela.plt section targeting .plt and I did `--prefix-alloc-sections=.foo`, do you get `.foo.rela.plt` or `.rela.foo.plt` or something else?
You need a test case for this too.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60042/new/
https://reviews.llvm.org/D60042
More information about the llvm-commits
mailing list