[llvm] r351659 - [llvm-objcopy] [COFF] Add a testcase for patching the debug directory. NFC.

Martin Storsjo via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 19 11:42:27 PST 2019


Author: mstorsjo
Date: Sat Jan 19 11:42:27 2019
New Revision: 351659

URL: http://llvm.org/viewvc/llvm-project?rev=351659&view=rev
Log:
[llvm-objcopy] [COFF] Add a testcase for patching the debug directory. NFC.

The debug directory contains the rwa file address of itself,
which is updated on write. Add a testcase for this existing
functionality.

Differential Revision: https://reviews.llvm.org/D56876

Added:
    llvm/trunk/test/tools/llvm-objcopy/COFF/patch-debug-dir.test

Added: llvm/trunk/test/tools/llvm-objcopy/COFF/patch-debug-dir.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/COFF/patch-debug-dir.test?rev=351659&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/COFF/patch-debug-dir.test (added)
+++ llvm/trunk/test/tools/llvm-objcopy/COFF/patch-debug-dir.test Sat Jan 19 11:42:27 2019
@@ -0,0 +1,64 @@
+# RUN: yaml2obj %s > %t.in.exe
+
+# RUN: llvm-objdump -s %t.in.exe | FileCheck %s --check-prefixes=CONTENTS,CONTENTS-PRE
+# RUN: llvm-readobj --sections %t.in.exe | FileCheck %s --check-prefixes=SECTIONS,SECTIONS-PRE
+# RUN: llvm-objcopy -R .rdata %t.in.exe %t.out.exe
+# RUN: llvm-objdump -s %t.out.exe | FileCheck %s --check-prefixes=CONTENTS,CONTENTS-POST
+# RUN: llvm-readobj --sections %t.out.exe | FileCheck %s --check-prefixes=SECTIONS,SECTIONS-POST
+
+# CONTENTS:           Contents of section .buildid:
+# CONTENTS-NEXT:       {{.*}} 00000000 42ee405c 00000000 02000000
+# CONTENTS-PRE-NEXT:   {{.*}} 19000000 1c300000 1c080000 52534453
+# CONTENTS-POST-NEXT:  {{.*}} 19000000 1c300000 1c040000 52534453
+# CONTENTS-NEXT:       {{.*}} c1330757 2839a337 4c4c4420 5044422e
+# CONTENTS-NEXT:       {{.*}} 01000000 00
+
+# SECTIONS:           Name: .buildid
+# SECTIONS-NEXT:      VirtualSize:
+# SECTIONS-NEXT:      VirtualAddress:
+# SECTIONS-NEXT:      RawDataSize:
+# SECTIONS-NEXT-PRE:  PointerToRawData: 0x800
+# SECTIONS-NEXT-POST: PointerToRawData: 0x400
+
+--- !COFF
+OptionalHeader:  
+  AddressOfEntryPoint: 4096
+  ImageBase:       1073741824
+  SectionAlignment: 4096
+  FileAlignment:   512
+  MajorOperatingSystemVersion: 6
+  MinorOperatingSystemVersion: 0
+  MajorImageVersion: 0
+  MinorImageVersion: 0
+  MajorSubsystemVersion: 6
+  MinorSubsystemVersion: 0
+  Subsystem:       IMAGE_SUBSYSTEM_WINDOWS_CUI
+  DLLCharacteristics: [  ]
+  SizeOfStackReserve: 1048576
+  SizeOfStackCommit: 4096
+  SizeOfHeapReserve: 1048576
+  SizeOfHeapCommit: 4096
+  Debug:           
+    RelativeVirtualAddress: 12288
+    Size:            28
+header:          
+  Machine:         IMAGE_FILE_MACHINE_AMD64
+  Characteristics: [  ]
+sections:        
+  - Name:            .text
+    Characteristics: [  ]
+    VirtualAddress:  4096
+    VirtualSize:     16
+    SectionData:     C3909090909090909090909090909090
+  - Name:            .rdata
+    Characteristics: [  ]
+    VirtualAddress:  8192
+    VirtualSize:     32
+    SectionData:     FFFFFFFF00000000FFFFFFFF00000000
+  - Name:            .buildid
+    Characteristics: [  ]
+    VirtualAddress:  12288
+    VirtualSize:     53
+    SectionData:     0000000042EE405C0000000002000000190000001C3000001C08000052534453C13307572839A3374C4C44205044422E0100000000
+symbols:         
+...




More information about the llvm-commits mailing list