[PATCH] D67610: [llvm-objcopy] - Remove python invocations from 2 test cases.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 16 02:50:05 PDT 2019


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.
Herald added subscribers: seiya, abrachet, jakehehrlich, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a reviewer: alexshap.
Herald added a reviewer: rupprecht.

It is possible to use yaml2obj to create sections with overlapping sh_offset now.
This patch does that.


https://reviews.llvm.org/D67610

Files:
  test/tools/llvm-objcopy/ELF/overlapping-sections-in-segments.test
  test/tools/llvm-objcopy/ELF/overlapping-sections.test


Index: test/tools/llvm-objcopy/ELF/overlapping-sections.test
===================================================================
--- test/tools/llvm-objcopy/ELF/overlapping-sections.test
+++ test/tools/llvm-objcopy/ELF/overlapping-sections.test
@@ -3,15 +3,7 @@
 ## inputs somehow.
 # RUN: yaml2obj %s -o %t.o
 
-## First, check the address of the section header table.
-# RUN: llvm-readobj --file-headers %t.o | FileCheck %s --check-prefix=SHDRS-OFFSET
-# SHDRS-OFFSET: SectionHeaderOffset: 0x1050{{$}}
-
-## Binary edit the section header sh_offset field of the second section to
-## (e_shoff+64*2+24 = 0x10e8) overlap the first one.
-# RUN: %python -c "with open('%/t.o', 'r+b') as input: import struct; bytes = struct.pack('<Q', 0x1001); input.seek(0x10e8); input.write(bytes)"
-
-## Sanity check that the binary editing modified the correct field.
+## Sanity check that section offsets overlap.
 # RUN: llvm-readobj --section-headers %t.o | FileCheck %s --check-prefix=VALIDATE
 
 # VALIDATE: Name: .first
@@ -54,3 +46,4 @@
   - Name: .second
     Type: SHT_PROGBITS
     Content: '89abcdef'
+    ShOffset: 0x1001
Index: test/tools/llvm-objcopy/ELF/overlapping-sections-in-segments.test
===================================================================
--- test/tools/llvm-objcopy/ELF/overlapping-sections-in-segments.test
+++ test/tools/llvm-objcopy/ELF/overlapping-sections-in-segments.test
@@ -4,15 +4,7 @@
 ## inputs somehow.
 # RUN: yaml2obj %s -o %t.o
 
-## First, check the address of the section header table.
-# RUN: llvm-readobj --file-headers %t.o | FileCheck %s --check-prefix=SHDRS-OFFSET
-# SHDRS-OFFSET: SectionHeaderOffset: 0x1050{{$}}
-
-## Binary edit the section header sh_offset field of the second section to
-## (e_shoff+64*2+24 = 0x10e8) overlap the first one.
-# RUN: %python -c "with open('%/t.o', 'r+b') as input: import struct; bytes = struct.pack('<Q', 0x1001); input.seek(0x10e8); input.write(bytes)"
-
-## Sanity check that the binary editing modified the correct field.
+## Sanity check that section offsets overlap.
 # RUN: llvm-readobj --section-headers %t.o | FileCheck %s
 
 ## Check that the contents are as expected before the copy.
@@ -49,6 +41,7 @@
   - Name: .second
     Type: SHT_PROGBITS
     Content: '89abcdef'
+    ShOffset: 0x1001
 ProgramHeaders:
   - Type:     PT_LOAD
     FileSize: 5


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67610.220298.patch
Type: text/x-patch
Size: 2342 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190916/eafe0af9/attachment.bin>


More information about the llvm-commits mailing list