
When loading split debug files for PE/COFF executables (produced with `objcopy --only-keep-debug`), the tables or directories in such files may point to data inside sections that may have been stripped. COFFObjectFile shall detect and gracefully handle this, to allow the object file be loaded without considering these tables or directories. This is required for LLDB to load these files for use as debug symbols. COFFObjectFile shall also check these pointers more carefully to account for cases in which the section contains less raw data than the size given by VirtualSize, to prevent going out of bounds. This commit also changes COFFDump in llvm-objdump to reuse the pointers that are already range-checked in COFFObjectFile. This fixes a crash when trying to dump the TLS directory from a stripped file. Fixes https://github.com/mstorsjo/llvm-mingw/issues/284 Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D126898
29 lines
1.7 KiB
Plaintext
29 lines
1.7 KiB
Plaintext
RUN: yaml2obj %p/Inputs/COFF/dwarf-debug-only.yaml | llvm-objdump -p -h - | FileCheck %s
|
|
|
|
CHECK: The Data Directory
|
|
CHECK-NEXT: Entry 0 00000000006a3f20 0000004b Export Directory [.edata (or where ever we found it)]
|
|
CHECK-NEXT: Entry 1 00000000006a3f6b 000001a4 Import Directory [parts of .idata]
|
|
CHECK-NEXT: Entry 2 0000000000000000 00000000 Resource Directory [.rsrc]
|
|
CHECK-NEXT: Entry 3 00000000006ac000 00000714 Exception Directory [.pdata]
|
|
CHECK-NEXT: Entry 4 0000000000000000 00000000 Security Directory
|
|
CHECK-NEXT: Entry 5 00000000006ae000 0000009c Base Relocation Directory [.reloc]
|
|
CHECK-NEXT: Entry 6 00000000006aa000 0000001c Debug Directory
|
|
CHECK-NEXT: Entry 7 0000000000000000 00000000 Description Directory
|
|
CHECK-NEXT: Entry 8 0000000000000000 00000000 Special Directory
|
|
CHECK-NEXT: Entry 9 00000000006a3bf8 00000028 Thread Storage Directory [.tls]
|
|
CHECK-NEXT: Entry a 0000000000000000 00000000 Load Configuration Directory
|
|
CHECK-NEXT: Entry b 0000000000000000 00000000 Bound Import Directory
|
|
CHECK-NEXT: Entry c 00000000006a48f8 000007e8 Import Address Table Directory
|
|
CHECK-NEXT: Entry d 0000000000000000 00000000 Delay Import Directory
|
|
CHECK-NEXT: Entry e 0000000000000000 00000000 CLR Runtime Header
|
|
CHECK-NEXT: Entry f 0000000000000000 00000000 Reserved
|
|
|
|
CHECK: 0 .text 00000000 0000000180001000 TEXT
|
|
CHECK-NEXT: 1 .rdata 00000000 0000000180010000 DATA
|
|
CHECK-NEXT: 2 .buildid 00000035 00000001806aa000 DATA
|
|
CHECK-NEXT: 3 .data 00000000 00000001806ab000 DATA
|
|
CHECK-NEXT: 4 .pdata 00000000 00000001806ac000 DATA
|
|
CHECK-NEXT: 5 .tls 00000000 00000001806ad000 DATA
|
|
CHECK-NEXT: 6 .reloc 00000000 00000001806ae000 DATA
|
|
CHECK-NEXT: 7 .debug_info 00000040 00000001806af000 DATA, DEBUG
|