summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-objcopy/ELF/rename-section-and-prefix-alloc-sections.test
diff options
context:
space:
mode:
authorJames Henderson <jh7370@my.bristol.ac.uk>2019-05-08 09:49:35 +0000
committerJames Henderson <jh7370@my.bristol.ac.uk>2019-05-08 09:49:35 +0000
commitfa11fb33ad6eecfe081a9875ed27b98a1077e404 (patch)
tree98cbc44058252a00260779637347f428901aa287 /llvm/test/tools/llvm-objcopy/ELF/rename-section-and-prefix-alloc-sections.test
parent3c696b3e7c21815662247e2af0346a596a4d0668 (diff)
downloadbcm5719-llvm-fa11fb33ad6eecfe081a9875ed27b98a1077e404.tar.gz
bcm5719-llvm-fa11fb33ad6eecfe081a9875ed27b98a1077e404.zip
[llvm-objcopy] Add --prefix-alloc-sections
This patch adds support for --prefix-alloc-sections, which adds a prefix to every allocated section names. It adds a prefix after renaming section names by --rename-section as GNU objcopy does. Fixes PR41266: https://bugs.llvm.org/show_bug.cgi?id=41266 Differential Revision: https://reviews.llvm.org/D60042 Patch by Seiya Nuta. llvm-svn: 360233
Diffstat (limited to 'llvm/test/tools/llvm-objcopy/ELF/rename-section-and-prefix-alloc-sections.test')
-rw-r--r--llvm/test/tools/llvm-objcopy/ELF/rename-section-and-prefix-alloc-sections.test32
1 files changed, 32 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-objcopy/ELF/rename-section-and-prefix-alloc-sections.test b/llvm/test/tools/llvm-objcopy/ELF/rename-section-and-prefix-alloc-sections.test
new file mode 100644
index 00000000000..fd642b6e3a4
--- /dev/null
+++ b/llvm/test/tools/llvm-objcopy/ELF/rename-section-and-prefix-alloc-sections.test
@@ -0,0 +1,32 @@
+# RUN: yaml2obj %s > %t
+# RUN: llvm-objcopy --rename-section=.text=.text2 --rename-section=.data=.data2 --prefix-alloc-sections=.prefix %t %t2
+# RUN: llvm-readobj --sections %t2 | FileCheck %s
+
+# .text/.rel.text and .data/.rela.data are the cases when the relocation section
+# comes after/before its target section respectively. We handle them in different
+# ways to perform both --rename-section and --prefix-alloc-sections in one pass.
+
+!ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_X86_64
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC ]
+ - Name: .rel.text
+ Type: SHT_REL
+ Info: .text
+ - Name: .rela.data
+ Type: SHT_RELA
+ Info: .data
+ - Name: .data
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC ]
+
+# CHECK: Name: .prefix.text2
+# CHECK: Name: .rel.prefix.text2
+# CHECK: Name: .rela.prefix.data2
+# CHECK: Name: .prefix.data2
OpenPOWER on IntegriCloud