]> granicus.if.org Git - llvm/commitdiff
[llvm-objcopy] - Get rid of dynrel.elf precompiled binary from inputs.
authorGeorge Rimar <grimar@accesssoftek.com>
Fri, 21 Jun 2019 14:15:15 +0000 (14:15 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Fri, 21 Jun 2019 14:15:15 +0000 (14:15 +0000)
We do not have to spread using the precompiled binaries in the tests,
when we can use YAML. This patch removes the dynrel.elf binary and adds
a few comments to the test cases.

Differential revision: https://reviews.llvm.org/D63641

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364052 91177308-0d34-0410-b5e6-96231b3b80d8

test/tools/llvm-objcopy/ELF/Inputs/dynrel.elf [deleted file]
test/tools/llvm-objcopy/ELF/dynamic-relocations.test
test/tools/llvm-objcopy/ELF/prefix-alloc-sections-dynrelocsec.test

diff --git a/test/tools/llvm-objcopy/ELF/Inputs/dynrel.elf b/test/tools/llvm-objcopy/ELF/Inputs/dynrel.elf
deleted file mode 100644 (file)
index fe9d683..0000000
Binary files a/test/tools/llvm-objcopy/ELF/Inputs/dynrel.elf and /dev/null differ
index 1c0fabc7806a01eaeebdcb15c6188d209ff2ab32..9c4d5b70cead6a1f5ba6e2f801812d7b68024441 100644 (file)
@@ -1,19 +1,44 @@
-# RUN: llvm-objcopy %p/Inputs/dynrel.elf %t
-# RUN: llvm-readobj --sections --section-data %t | FileCheck %s
+## Check that llvm-objcopy can handle an object
+## containing dynamic relocations properly.
 
-#CHECK:         Name: .rela.plt
-#CHECK-NEXT:    Type: SHT_RELA
-#CHECK-NEXT:    Flags [
-#CHECK-NEXT:      SHF_ALLOC
-#CHECK-NEXT:    ]
-#CHECK-NEXT:    Address:
-#CHECK-NEXT:    Offset:
-#CHECK-NEXT:    Size: 24
-#CHECK-NEXT:    Link:
-#CHECK-NEXT:    Info:
-#CHECK-NEXT:    AddressAlignment: 8
-#CHECK-NEXT:    EntrySize: 24
-#CHECK-NEXT:    SectionData (
-#CHECK-NEXT:       0000: 18202000 00000000 07000000 01000000  |.  .............|
-#CHECK-NEXT:       0010: 00000000 00000000                    |........|
-#CHECK-NEXT:    )
+# RUN: yaml2obj %s > %t1
+# RUN: llvm-objcopy %t1 %t2
+# RUN: llvm-readobj --sections --section-data %t2 | FileCheck %s
+
+# CHECK:         Name: .rela.plt
+# CHECK-NEXT:    Type: SHT_RELA
+# CHECK-NEXT:    Flags [
+# CHECK-NEXT:      SHF_ALLOC
+# CHECK-NEXT:    ]
+# CHECK-NEXT:    Address:
+# CHECK-NEXT:    Offset:
+# CHECK-NEXT:    Size: 24
+# CHECK-NEXT:    Link:
+# CHECK-NEXT:    Info:
+# CHECK-NEXT:    AddressAlignment: 8
+# CHECK-NEXT:    EntrySize: 24
+# CHECK-NEXT:    SectionData (
+# CHECK-NEXT:       0000: 18202000 00000000 07000000 01000000  |.  .............|
+# CHECK-NEXT:       0010: 00000000 00000000                    |........|
+# CHECK-NEXT:    )
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_EXEC
+  Machine: EM_X86_64
+Sections:
+  - Name:         .rela.plt
+    Type:         SHT_RELA
+    Flags:        [ SHF_ALLOC ]
+    Address:      0x0000000000200220
+    Link:         0
+    AddressAlign: 0x0000000000000008
+    Relocations:
+      - Offset: 0x0000000000202018
+        Symbol: foo
+        Type:   R_X86_64_JUMP_SLOT
+Symbols:
+  - Name:    foo
+    Binding: STB_GLOBAL
index 9e267f6df0e09d3dadd8e3c081d51c5280a74076..217fe55c4463184c6172d6b5914ae2cee1121927 100644 (file)
@@ -1,5 +1,24 @@
-# RUN: llvm-objcopy --prefix-alloc-sections=.prefix %p/Inputs/dynrel.elf %t
-# RUN: llvm-readobj --sections %t | FileCheck %s
+## Check that llvm-objcopy can correctly add a prefix to
+## a dynamic relocation section and its target section.
+
+# RUN: yaml2obj %s > %t1
+# RUN: llvm-objcopy --prefix-alloc-sections=.prefix %t1 %t2
+# RUN: llvm-readobj --sections %t2 | FileCheck %s
 
 # CHECK: Name: .prefix.rela.plt
 # CHECK: Name: .prefix.plt
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_EXEC
+  Machine: EM_X86_64
+Sections:
+  - Name:  .rela.plt
+    Type:  SHT_RELA
+    Flags: [ SHF_ALLOC ]
+    Link:  0
+  - Name:  .plt
+    Type:  SHT_PROGBITS
+    Flags: [ SHF_ALLOC, SHF_EXECINSTR ]