summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-objcopy/reloc-error-remove-symtab.test
diff options
context:
space:
mode:
authorJake Ehrlich <jakehehrlich@google.com>2017-10-10 18:47:09 +0000
committerJake Ehrlich <jakehehrlich@google.com>2017-10-10 18:47:09 +0000
commit36a2eb34ed394b7277df6ef9b935bfe2be3402b8 (patch)
tree876ae8d0fd21d2494acbb401953c66431e5e7a64 /llvm/test/tools/llvm-objcopy/reloc-error-remove-symtab.test
parentc5ff72708d232079e1c2099165584cf8d03e1c7e (diff)
downloadbcm5719-llvm-36a2eb34ed394b7277df6ef9b935bfe2be3402b8.tar.gz
bcm5719-llvm-36a2eb34ed394b7277df6ef9b935bfe2be3402b8.zip
[llvm-objcopy] Add support for removing sections
This change adds support for removing sections using the -R field (as GNU objcopy does as well). This change should let us add many helpful tests and is a proper stepping stone for adding more general kinds of stripping. Differential Revision: https://reviews.llvm.org/D38260 llvm-svn: 315346
Diffstat (limited to 'llvm/test/tools/llvm-objcopy/reloc-error-remove-symtab.test')
-rw-r--r--llvm/test/tools/llvm-objcopy/reloc-error-remove-symtab.test32
1 files changed, 32 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-objcopy/reloc-error-remove-symtab.test b/llvm/test/tools/llvm-objcopy/reloc-error-remove-symtab.test
new file mode 100644
index 00000000000..539e6ea1ce1
--- /dev/null
+++ b/llvm/test/tools/llvm-objcopy/reloc-error-remove-symtab.test
@@ -0,0 +1,32 @@
+# RUN: yaml2obj %s > %t
+# RUN: not llvm-objcopy -R .symtab %t %t2 2>&1 >/dev/null | FileCheck %s
+
+!ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_X86_64
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x1000
+ AddressAlign: 0x0000000000000010
+ Content: "0000000000000000"
+ - Name: .rel.text
+ Type: SHT_REL
+ Link: .symtab
+ Info: .text
+ Relocations:
+ - Offset: 0x1000
+ Symbol: foo
+ Type: R_X86_64_PC32
+
+Symbols:
+ Global:
+ - Name: foo
+ Type: STT_FUNC
+ Size: 4
+
+# CHECK: Symbol table .symtab cannot be removed because it is referenced by the relocation section .rel.text.
OpenPOWER on IntegriCloud