[llvm] r364052 - [llvm-objcopy] - Get rid of dynrel.elf precompiled binary from inputs.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 21 07:15:15 PDT 2019


Author: grimar
Date: Fri Jun 21 07:15:15 2019
New Revision: 364052

URL: http://llvm.org/viewvc/llvm-project?rev=364052&view=rev
Log:
[llvm-objcopy] - Get rid of dynrel.elf precompiled binary from inputs.

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

Removed:
    llvm/trunk/test/tools/llvm-objcopy/ELF/Inputs/dynrel.elf
Modified:
    llvm/trunk/test/tools/llvm-objcopy/ELF/dynamic-relocations.test
    llvm/trunk/test/tools/llvm-objcopy/ELF/prefix-alloc-sections-dynrelocsec.test

Removed: llvm/trunk/test/tools/llvm-objcopy/ELF/Inputs/dynrel.elf
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/Inputs/dynrel.elf?rev=364051&view=auto
==============================================================================
Binary files llvm/trunk/test/tools/llvm-objcopy/ELF/Inputs/dynrel.elf (original) and llvm/trunk/test/tools/llvm-objcopy/ELF/Inputs/dynrel.elf (removed) differ

Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/dynamic-relocations.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/dynamic-relocations.test?rev=364052&r1=364051&r2=364052&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/dynamic-relocations.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/dynamic-relocations.test Fri Jun 21 07:15:15 2019
@@ -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

Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/prefix-alloc-sections-dynrelocsec.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/prefix-alloc-sections-dynrelocsec.test?rev=364052&r1=364051&r2=364052&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/prefix-alloc-sections-dynrelocsec.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/prefix-alloc-sections-dynrelocsec.test Fri Jun 21 07:15:15 2019
@@ -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 ]




More information about the llvm-commits mailing list