[PATCH] D63641: [llvm-objcopy] - Get rid of dynrel.elf precompiled binary from inputs.

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


This revision was automatically updated to reflect the committed changes.
Closed by commit rL364052: [llvm-objcopy] - Get rid of dynrel.elf precompiled binary from inputs. (authored by grimar, committed by ).
Herald added a project: LLVM.

Changed prior to commit:
  https://reviews.llvm.org/D63641?vs=205960&id=205995#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63641/new/

https://reviews.llvm.org/D63641

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


Index: llvm/trunk/test/tools/llvm-objcopy/ELF/dynamic-relocations.test
===================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/dynamic-relocations.test
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/dynamic-relocations.test
@@ -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: llvm/trunk/test/tools/llvm-objcopy/ELF/prefix-alloc-sections-dynrelocsec.test
===================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/prefix-alloc-sections-dynrelocsec.test
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/prefix-alloc-sections-dynrelocsec.test
@@ -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 ]


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63641.205995.patch
Type: text/x-patch
Size: 3254 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190621/15dbc48f/attachment.bin>


More information about the llvm-commits mailing list