COFF: Layout sections in the same order as link.exe

One place where this seems to matter is to make sure the .rsrc section comes
after .text. The Win32 UpdateResource() function can change the contents of
.rsrc. It will move the sections that come after, but if .text gets moved, the
entry point header will not get updated and the executable breaks. This was
found by a test in Chromium.

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

llvm-svn: 329221
This commit is contained in:
Hans Wennborg 2018-04-04 19:15:55 +00:00
parent bccd18b816
commit 9a9fc78744
38 changed files with 323 additions and 293 deletions

View File

@ -644,6 +644,24 @@ void Writer::createSymbolAndStringTable() {
FileSize = alignTo(FileOff, SectorSize);
}
static int sectionIndex(StringRef Name) {
// Try to match the section order used by link.exe. In particular, it's
// important that .reloc comes last since it refers to RVA's of data in
// the previous sections. .rsrc should come late because its size may
// change by the Win32 UpdateResources() function, causing subsequent
// sections to move (see https://crbug.com/827082).
return StringSwitch<int>(Name)
.Case(".text", 1)
.Case(".bss", 2)
.Case(".rdata", 3)
.Case(".data", 4)
.Case(".pdata", 5)
.Case(".idata", 6)
.Case(".rsrc", 99)
.Case(".reloc", 100)
.Default(50); // Default to somewhere in the middle.
}
// Visits all sections to assign incremental, non-overlapping RVAs and
// file offsets.
void Writer::assignAddresses() {
@ -655,6 +673,13 @@ void Writer::assignAddresses() {
SizeOfHeaders = alignTo(SizeOfHeaders, SectorSize);
uint64_t RVA = PageSize; // The first page is kept unmapped.
FileSize = SizeOfHeaders;
// Reorder the sections.
std::stable_sort(OutputSections.begin(), OutputSections.end(),
[](OutputSection *S, OutputSection *T) {
return sectionIndex(S->Name) < sectionIndex(T->Name);
});
// Move DISCARDABLE (or non-memory-mapped) sections to the end of file because
// the loader cannot handle holes.
std::stable_partition(

View File

@ -43,44 +43,44 @@
# BEFORE: 88: 00 00 40 f9 ldr x0, [x0]
# AFTER: Disassembly of section .text:
# AFTER: 140002000: fe 0f 1f f8 str x30, [sp, #-16]!
# AFTER: 140002004: e0 ff ff f0 adrp x0, #-4096
# AFTER: 140002008: 00 18 00 91 add x0, x0, #6
# AFTER: 14000200c: 20 00 00 94 bl #128
# AFTER: 140002010: 00 21 40 39 ldrb w0, [x8, #8]
# AFTER: 140002014: 00 11 40 79 ldrh w0, [x8, #8]
# AFTER: 140002018: 00 09 40 b9 ldr w0, [x8, #8]
# AFTER: 14000201c: 00 05 40 f9 ldr x0, [x8, #8]
# AFTER: 140002020: 00 21 00 39 strb w0, [x8, #8]
# AFTER: 140002024: 00 11 00 79 strh w0, [x8, #8]
# AFTER: 140002028: 00 09 00 b9 str w0, [x8, #8]
# AFTER: 14000202c: 00 05 00 f9 str x0, [x8, #8]
# AFTER: 140002030: 00 41 40 3d ldr b0, [x8, #16]
# AFTER: 140002034: 00 21 40 7d ldr h0, [x8, #16]
# AFTER: 140002038: 00 11 40 bd ldr s0, [x8, #16]
# AFTER: 14000203c: 00 09 40 fd ldr d0, [x8, #16]
# AFTER: 140002040: 00 05 c0 3d ldr q0, [x8, #16]
# AFTER: 140002044: 00 41 00 3d str b0, [x8, #16]
# AFTER: 140002048: 00 21 00 7d str h0, [x8, #16]
# AFTER: 14000204c: 00 11 00 bd str s0, [x8, #16]
# AFTER: 140002050: 00 09 00 fd str d0, [x8, #16]
# AFTER: 140002054: 00 05 80 3d str q0, [x8, #16]
# AFTER: 140002058: 00 09 40 f9 ldr x0, [x8, #16]
# AFTER: 14000205c: 00 00 00 b0 adrp x0, #4096
# AFTER: 140002060: 00 fc 47 f9 ldr x0, [x0, #4088]
# AFTER: 140002064: e0 03 1f 2a mov w0, wzr
# AFTER: 140002068: fe 07 41 f8 ldr x30, [sp], #16
# AFTER: 14000206c: c0 03 5f d6 ret
# AFTER: 140002070: 10 10 00 40 <unknown>
# AFTER: 140002074: 01 00 00 00 <unknown>
# AFTER: 140002078: 09 10 00 00 <unknown>
# AFTER: 14000207c: 09 00 00 00 <unknown>
# AFTER: 140002080: 00 20 0e 91 add x0, x0, #904
# AFTER: 140002084: 00 04 40 91 add x0, x0, #1, lsl #12
# AFTER: 140002088: 00 c4 41 f9 ldr x0, [x0, #904]
# AFTER: 14000208c: 10 00 00 b0 adrp x16, #4096
# AFTER: 140002090: 10 1e 40 f9 ldr x16, [x16, #56]
# AFTER: 140002094: 00 02 1f d6 br x16
# AFTER: 140001000: fe 0f 1f f8 str x30, [sp, #-16]!
# AFTER: 140001004: 00 00 00 b0 adrp x0, #4096
# AFTER: 140001008: 00 18 00 91 add x0, x0, #6
# AFTER: 14000100c: 20 00 00 94 bl #128
# AFTER: 140001010: 00 21 40 39 ldrb w0, [x8, #8]
# AFTER: 140001014: 00 11 40 79 ldrh w0, [x8, #8]
# AFTER: 140001018: 00 09 40 b9 ldr w0, [x8, #8]
# AFTER: 14000101c: 00 05 40 f9 ldr x0, [x8, #8]
# AFTER: 140001020: 00 21 00 39 strb w0, [x8, #8]
# AFTER: 140001024: 00 11 00 79 strh w0, [x8, #8]
# AFTER: 140001028: 00 09 00 b9 str w0, [x8, #8]
# AFTER: 14000102c: 00 05 00 f9 str x0, [x8, #8]
# AFTER: 140001030: 00 41 40 3d ldr b0, [x8, #16]
# AFTER: 140001034: 00 21 40 7d ldr h0, [x8, #16]
# AFTER: 140001038: 00 11 40 bd ldr s0, [x8, #16]
# AFTER: 14000103c: 00 09 40 fd ldr d0, [x8, #16]
# AFTER: 140001040: 00 05 c0 3d ldr q0, [x8, #16]
# AFTER: 140001044: 00 41 00 3d str b0, [x8, #16]
# AFTER: 140001048: 00 21 00 7d str h0, [x8, #16]
# AFTER: 14000104c: 00 11 00 bd str s0, [x8, #16]
# AFTER: 140001050: 00 09 00 fd str d0, [x8, #16]
# AFTER: 140001054: 00 05 80 3d str q0, [x8, #16]
# AFTER: 140001058: 00 09 40 f9 ldr x0, [x8, #16]
# AFTER: 14000105c: 00 00 00 f0 adrp x0, #12288
# AFTER: 140001060: 00 fc 47 f9 ldr x0, [x0, #4088]
# AFTER: 140001064: e0 03 1f 2a mov w0, wzr
# AFTER: 140001068: fe 07 41 f8 ldr x30, [sp], #16
# AFTER: 14000106c: c0 03 5f d6 ret
# AFTER: 140001070: 10 20 00 40 <unknown>
# AFTER: 140001074: 01 00 00 00 <unknown>
# AFTER: 140001078: 09 20 00 00 <unknown>
# AFTER: 14000107c: 09 00 00 00 <unknown>
# AFTER: 140001080: 00 20 0e 91 add x0, x0, #904
# AFTER: 140001084: 00 04 40 91 add x0, x0, #1, lsl #12
# AFTER: 140001088: 00 c4 41 f9 ldr x0, [x0, #904]
# AFTER: 14000108c: 10 00 00 d0 adrp x16, #8192
# AFTER: 140001090: 10 1e 40 f9 ldr x16, [x16, #56]
# AFTER: 140001094: 00 02 1f d6 br x16
--- !COFF
header:

View File

@ -11,7 +11,7 @@
# BEFORE: 8: 70 47 bx lr
# AFTER: Disassembly of section .text:
# AFTER: 0: 41 f2 00 00 movw r0, #4096
# AFTER: 0: 42 f2 00 00 movw r0, #8192
# AFTER: 4: c0 f2 40 00 movt r0, #64
# AFTER: 8: 70 47 bx lr

View File

@ -9,14 +9,15 @@
# CHECK: Sections [
# CHECK: Section {
# CHECK: Number: 1
# CHECK-LABEL: Name: .data (2E 64 61 74 61 00 00 00)
# CHECK-NEXT: VirtualSize: 0x4
# CHECK: Section {
# CHECK: Number: 2
# CHECK-LABEL: Name: .rdata (2E 72 64 61 74 61 00 00)
# This is the critical check to show that only *one* definition of
# foo_assoc was retained. This *must* be 8, not 16.
# CHECK-NEXT: VirtualSize: 0x8
# CHECK: Section {
# CHECK: Number: 3
# CHECK-LABEL: Name: .data (2E 64 61 74 61 00 00 00)
# CHECK-NEXT: VirtualSize: 0x4
.text
.def main;

View File

@ -9,35 +9,35 @@
# BASEREL: BaseReloc [
# BASEREL-NEXT: Entry {
# BASEREL-NEXT: Type: DIR64
# BASEREL-NEXT: Address: 0x2007
# BASEREL-NEXT: Address: 0x1007
# BASEREL-NEXT: }
# BASEREL-NEXT: Entry {
# BASEREL-NEXT: Type: DIR64
# BASEREL-NEXT: Address: 0x200C
# BASEREL-NEXT: Address: 0x100C
# BASEREL-NEXT: }
# BASEREL-NEXT: Entry {
# BASEREL-NEXT: Type: DIR64
# BASEREL-NEXT: Address: 0x201E
# BASEREL-NEXT: Address: 0x101E
# BASEREL-NEXT: }
# BASEREL-NEXT: Entry {
# BASEREL-NEXT: Type: ABSOLUTE
# BASEREL-NEXT: Address: 0x2000
# BASEREL-NEXT: Address: 0x1000
# BASEREL-NEXT: }
# BASEREL-NEXT: Entry {
# BASEREL-NEXT: Type: DIR64
# BASEREL-NEXT: Address: 0x3007
# BASEREL-NEXT: Address: 0x4007
# BASEREL-NEXT: }
# BASEREL-NEXT: Entry {
# BASEREL-NEXT: Type: DIR64
# BASEREL-NEXT: Address: 0x300C
# BASEREL-NEXT: Address: 0x400C
# BASEREL-NEXT: }
# BASEREL-NEXT: Entry {
# BASEREL-NEXT: Type: DIR64
# BASEREL-NEXT: Address: 0x301E
# BASEREL-NEXT: Address: 0x401E
# BASEREL-NEXT: }
# BASEREL-NEXT: Entry {
# BASEREL-NEXT: Type: ABSOLUTE
# BASEREL-NEXT: Address: 0x3000
# BASEREL-NEXT: Address: 0x4000
# BASEREL-NEXT: }
#
# NOBASEREL: BaseReloc [

View File

@ -11,7 +11,7 @@
# RUN: llvm-readobj -coff-resources -file-headers -section-data %t.exe | \
# RUN: FileCheck %s
CHECK: ResourceTableRVA: 0x1000
CHECK: ResourceTableRVA: 0x2000
CHECK-NEXT: ResourceTableSize: 0xC1C
CHECK-DAG: Resources [
CHECK-NEXT: Total Number of Resources: 13
@ -49,19 +49,19 @@ CHECK-NEXT: 01D0: 00000000 00000000 00000000 00000100 |................|
CHECK-NEXT: 01E0: 09040000 A0020000 00000000 00000000 |................|
CHECK-NEXT: 01F0: 00000000 00000300 09040000 B0020000 |................|
CHECK-NEXT: 0200: 04080000 C0020000 07100000 D0020000 |................|
CHECK-NEXT: 0210: FC1A0000 39000000 00000000 00000000 |....9...........|
CHECK-NEXT: 0220: C4130000 28030000 00000000 00000000 |....(...........|
CHECK-NEXT: 0230: EC160000 28030000 00000000 00000000 |....(...........|
CHECK-NEXT: 0240: CC1A0000 30000000 00000000 00000000 |....0...........|
CHECK-NEXT: 0250: 141A0000 2E000000 00000000 00000000 |................|
CHECK-NEXT: 0260: 441A0000 6C000000 00000000 00000000 |D...l...........|
CHECK-NEXT: 0270: 7C130000 2A000000 00000000 00000000 ||...*...........|
CHECK-NEXT: 0280: AC130000 18000000 00000000 00000000 |................|
CHECK-NEXT: 0290: 041C0000 18000000 00000000 00000000 |................|
CHECK-NEXT: 02A0: B41A0000 18000000 00000000 00000000 |................|
CHECK-NEXT: 02B0: 3C1B0000 36000000 00000000 00000000 |<...6...........|
CHECK-NEXT: 02C0: 741B0000 43000000 00000000 00000000 |t...C...........|
CHECK-NEXT: 02D0: BC1B0000 42000000 00000000 00000000 |....B...........|
CHECK-NEXT: 0210: FC2A0000 39000000 00000000 00000000 |.*..9...........|
CHECK-NEXT: 0220: C4230000 28030000 00000000 00000000 |.#..(...........|
CHECK-NEXT: 0230: EC260000 28030000 00000000 00000000 |.&..(...........|
CHECK-NEXT: 0240: CC2A0000 30000000 00000000 00000000 |.*..0...........|
CHECK-NEXT: 0250: 142A0000 2E000000 00000000 00000000 |.*..............|
CHECK-NEXT: 0260: 442A0000 6C000000 00000000 00000000 |D*..l...........|
CHECK-NEXT: 0270: 7C230000 2A000000 00000000 00000000 ||#..*...........|
CHECK-NEXT: 0280: AC230000 18000000 00000000 00000000 |.#..............|
CHECK-NEXT: 0290: 042C0000 18000000 00000000 00000000 |.,..............|
CHECK-NEXT: 02A0: B42A0000 18000000 00000000 00000000 |.*..............|
CHECK-NEXT: 02B0: 3C2B0000 36000000 00000000 00000000 |<+..6...........|
CHECK-NEXT: 02C0: 742B0000 43000000 00000000 00000000 |t+..C...........|
CHECK-NEXT: 02D0: BC2B0000 42000000 00000000 00000000 |.+..B...........|
CHECK-NEXT: 02E0: 0E004D00 59004100 43004300 45004C00 |..M.Y.A.C.C.E.L.|
CHECK-NEXT: 02F0: 45005200 41005400 4F005200 53000600 |E.R.A.T.O.R.S...|
CHECK-NEXT: 0300: 43005500 52005300 4F005200 04004F00 |C.U.R.S.O.R...O.|

View File

@ -4,8 +4,8 @@
# RUN: llvm-objdump -d %t.exe | FileCheck %s
# Operands of B8 (MOV EAX) are common symbols
# CHECK: 3000: b8 00 10 00 40
# CHECK: 3005: b8 10 10 00 40
# CHECK: 1000: b8 00 20 00 40
# CHECK: 1005: b8 10 20 00 40
--- !COFF
header:

View File

@ -4,11 +4,11 @@
# RUN: llvm-objdump -d %t.exe | FileCheck %s
# Operands of B8 (MOV EAX) are common symbols
# CHECK: 3000: b8 00 10 00 40
# CHECK: 3005: b8 04 10 00 40
# CHECK: 300a: b8 20 10 00 40
# CHECK: 300f: b8 60 10 00 40
# CHECK: 3014: b8 70 10 00 40
# CHECK: 1000: b8 00 20 00 40
# CHECK: 1005: b8 04 20 00 40
# CHECK: 100a: b8 20 20 00 40
# CHECK: 100f: b8 60 20 00 40
# CHECK: 1014: b8 70 20 00 40
--- !COFF
header:

View File

@ -22,9 +22,9 @@ main:
.quad 2
# CHECK: Contents of section .ctors:
# CHECK-NEXT: 140001000 01000000 00000000 02000000 00000000
# CHECK-NEXT: 140001010 03000000 00000000
# CHECK: Contents of section .dtors:
# CHECK-NEXT: 140002000 01000000 00000000 02000000 00000000
# CHECK-NEXT: 140002010 03000000 00000000
# CHECK: Contents of section .dtors:
# CHECK-NEXT: 140003000 01000000 00000000 02000000 00000000
# CHECK-NEXT: 140003010 03000000 00000000

View File

@ -13,9 +13,9 @@
# IMPORT-NEXT: DelayImport {
# IMPORT-NEXT: Name: library.dll
# IMPORT-NEXT: Attributes: 0x1
# IMPORT-NEXT: ModuleHandle: 0x3000
# IMPORT-NEXT: ImportAddressTable: 0x3008
# IMPORT-NEXT: ImportNameTable: 0x2040
# IMPORT-NEXT: ModuleHandle: 0x2000
# IMPORT-NEXT: ImportAddressTable: 0x2008
# IMPORT-NEXT: ImportNameTable: 0x3040
# IMPORT-NEXT: BoundDelayImportTable: 0x0
# IMPORT-NEXT: UnloadDelayImportTable: 0x0
# IMPORT-NEXT: Import {
@ -43,21 +43,21 @@
# BASEREL-NEXT: }
# BASEREL-NEXT: Entry {
# BASEREL-NEXT: Type: HIGHLOW
# BASEREL-NEXT: Address: 0x3008
# BASEREL-NEXT: Address: 0x2008
# BASEREL-NEXT: }
# BASEREL-NEXT: Entry {
# BASEREL-NEXT: Type: ABSOLUTE
# BASEREL-NEXT: Address: 0x3000
# BASEREL-NEXT: Address: 0x2000
# BASEREL-NEXT: }
# BASEREL-NEXT: ]
#
# DISASM: 401018: 43 f2 08 0c movw r12, #12296
# DISASM: 401018: 42 f2 08 0c movw r12, #8200
# DISASM-NEXT: 40101c: c0 f2 40 0c movt r12, #64
# DISASM-NEXT: 401020: 2d e9 0f 48 push.w {r0, r1, r2, r3, r11, lr}
# DISASM-NEXT: 401024: 0d f2 10 0b addw r11, sp, #16
# DISASM-NEXT: 401028: 2d ed 10 0b vpush {d0, d1, d2, d3, d4, d5, d6, d7}
# DISASM-NEXT: 40102c: 61 46 mov r1, r12
# DISASM-NEXT: 40102e: 42 f2 00 00 movw r0, #8192
# DISASM-NEXT: 40102e: 43 f2 00 00 movw r0, #12288
# DISASM-NEXT: 401032: c0 f2 40 00 movt r0, #64
# DISASM-NEXT: 401036: ff f7 e3 ff bl #-58
# DISASM-NEXT: 40103a: 84 46 mov r12, r0

View File

@ -7,35 +7,35 @@
IMPORT: DelayImport {
IMPORT-NEXT: Name: std64.dll
IMPORT-NEXT: Attributes: 0x1
IMPORT-NEXT: ModuleHandle: 0x1018
IMPORT-NEXT: ImportAddressTable: 0x1020
IMPORT-NEXT: ModuleHandle: 0x2018
IMPORT-NEXT: ImportAddressTable: 0x2020
IMPORT-NEXT: ImportNameTable: 0x3040
IMPORT-NEXT: BoundDelayImportTable: 0x0
IMPORT-NEXT: UnloadDelayImportTable: 0x0
IMPORT-NEXT: Import {
IMPORT-NEXT: Symbol: ExitProcess (0)
IMPORT-NEXT: Address: 0x140002066
IMPORT-NEXT: Address: 0x140001066
IMPORT-NEXT: }
IMPORT-NEXT: Import {
IMPORT-NEXT: Symbol: (50)
IMPORT-NEXT: Address: 0x1400020BD
IMPORT-NEXT: Address: 0x1400010BD
IMPORT-NEXT: }
IMPORT-NEXT: Import {
IMPORT-NEXT: Symbol: MessageBoxA (0)
IMPORT-NEXT: Address: 0x140002114
IMPORT-NEXT: Address: 0x140001114
IMPORT-NEXT: }
IMPORT-NEXT: }
BASEREL: BaseReloc [
BASEREL-NEXT: Entry {
BASEREL-NEXT: Type: DIR64
BASEREL-NEXT: Address: 0x1020
BASEREL-NEXT: Address: 0x2020
BASEREL-NEXT: }
BASEREL-NEXT: Entry {
BASEREL-NEXT: Type: DIR64
BASEREL-NEXT: Address: 0x1028
BASEREL-NEXT: Address: 0x2028
BASEREL-NEXT: }
BASEREL-NEXT: Entry {
BASEREL-NEXT: Type: DIR64
BASEREL-NEXT: Address: 0x1030
BASEREL-NEXT: Address: 0x2030
BASEREL-NEXT: }

View File

@ -13,75 +13,75 @@ IMPORT-NEXT: AddressSize: 32bit
IMPORT-NEXT: DelayImport {
IMPORT-NEXT: Name: std32.dll
IMPORT-NEXT: Attributes: 0x1
IMPORT-NEXT: ModuleHandle: 0x1018
IMPORT-NEXT: ImportAddressTable: 0x1020
IMPORT-NEXT: ModuleHandle: 0x3018
IMPORT-NEXT: ImportAddressTable: 0x3020
IMPORT-NEXT: ImportNameTable: 0x4040
IMPORT-NEXT: BoundDelayImportTable: 0x0
IMPORT-NEXT: UnloadDelayImportTable: 0x0
IMPORT-NEXT: Import {
IMPORT-NEXT: Symbol: ExitProcess (0)
IMPORT-NEXT: Address: 0x402029
IMPORT-NEXT: Address: 0x401029
IMPORT-NEXT: }
IMPORT-NEXT: Import {
IMPORT-NEXT: Symbol: MessageBoxA (0)
IMPORT-NEXT: Address: 0x40203E
IMPORT-NEXT: Address: 0x40103E
IMPORT-NEXT: }
IMPORT-NEXT: }
BASEREL: BaseReloc [
BASEREL-NEXT: Entry {
BASEREL-NEXT: Type: HIGHLOW
BASEREL-NEXT: Address: 0x1020
BASEREL-NEXT: Address: 0x1005
BASEREL-NEXT: }
BASEREL-NEXT: Entry {
BASEREL-NEXT: Type: HIGHLOW
BASEREL-NEXT: Address: 0x1024
BASEREL-NEXT: Address: 0x100C
BASEREL-NEXT: }
BASEREL-NEXT: Entry {
BASEREL-NEXT: Type: HIGHLOW
BASEREL-NEXT: Address: 0x2005
BASEREL-NEXT: Address: 0x101F
BASEREL-NEXT: }
BASEREL-NEXT: Entry {
BASEREL-NEXT: Type: HIGHLOW
BASEREL-NEXT: Address: 0x200C
BASEREL-NEXT: Address: 0x1025
BASEREL-NEXT: }
BASEREL-NEXT: Entry {
BASEREL-NEXT: Type: HIGHLOW
BASEREL-NEXT: Address: 0x201F
BASEREL-NEXT: Address: 0x102C
BASEREL-NEXT: }
BASEREL-NEXT: Entry {
BASEREL-NEXT: Type: HIGHLOW
BASEREL-NEXT: Address: 0x2025
BASEREL-NEXT: Address: 0x1031
BASEREL-NEXT: }
BASEREL-NEXT: Entry {
BASEREL-NEXT: Type: HIGHLOW
BASEREL-NEXT: Address: 0x202C
BASEREL-NEXT: Address: 0x1041
BASEREL-NEXT: }
BASEREL-NEXT: Entry {
BASEREL-NEXT: Type: HIGHLOW
BASEREL-NEXT: Address: 0x2031
BASEREL-NEXT: Address: 0x1046
BASEREL-NEXT: }
BASEREL-NEXT: Entry {
BASEREL-NEXT: Type: HIGHLOW
BASEREL-NEXT: Address: 0x2041
BASEREL-NEXT: Address: 0x3020
BASEREL-NEXT: }
BASEREL-NEXT: Entry {
BASEREL-NEXT: Type: HIGHLOW
BASEREL-NEXT: Address: 0x2046
BASEREL-NEXT: Address: 0x3024
BASEREL-NEXT: }
BASEREL-NEXT: ]
DISASM: 202b: 68 20 10 40 00 pushl $4198432
DISASM-NEXT: 2030: 68 00 40 40 00 pushl $4210688
DISASM-NEXT: 2035: e8 c6 ff ff ff calll -58 <.text>
DISASM-NEXT: 203a: 5a popl %edx
DISASM-NEXT: 203b: 59 popl %ecx
DISASM-NEXT: 203c: ff e0 jmpl *%eax
DISASM-NEXT: 203e: 51 pushl %ecx
DISASM-NEXT: 203f: 52 pushl %edx
DISASM-NEXT: 2040: 68 24 10 40 00 pushl $4198436
DISASM-NEXT: 2045: 68 00 40 40 00 pushl $4210688
DISASM-NEXT: 204a: e8 b1 ff ff ff calll -79 <.text>
DISASM-NEXT: 204f: 5a popl %edx
DISASM-NEXT: 2050: 59 popl %ecx
DISASM-NEXT: 2051: ff e0 jmpl *%eax
DISASM: 102b: 68 20 30 40 00 pushl $4206624
DISASM-NEXT: 1030: 68 00 40 40 00 pushl $4210688
DISASM-NEXT: 1035: e8 c6 ff ff ff calll -58 <.text>
DISASM-NEXT: 103a: 5a popl %edx
DISASM-NEXT: 103b: 59 popl %ecx
DISASM-NEXT: 103c: ff e0 jmpl *%eax
DISASM-NEXT: 103e: 51 pushl %ecx
DISASM-NEXT: 103f: 52 pushl %edx
DISASM-NEXT: 1040: 68 24 30 40 00 pushl $4206628
DISASM-NEXT: 1045: 68 00 40 40 00 pushl $4210688
DISASM-NEXT: 104a: e8 b1 ff ff ff calll -79 <.text>
DISASM-NEXT: 104f: 5a popl %edx
DISASM-NEXT: 1050: 59 popl %ecx
DISASM-NEXT: 1051: ff e0 jmpl *%eax

View File

@ -9,10 +9,10 @@
# CHECK: DLL name: export-armnt.yaml.tmp.dll
# CHECK: Ordinal RVA Name
# CHECK-NEXT: 0 0
# CHECK-NEXT: 1 0x1000 exportdata
# CHECK-NEXT: 2 0x2005 exportfn1
# CHECK-NEXT: 3 0x2009 exportfn2
# CHECK-NEXT: 4 0x2009 exportfn3
# CHECK-NEXT: 1 0x2000 exportdata
# CHECK-NEXT: 2 0x1005 exportfn1
# CHECK-NEXT: 3 0x1009 exportfn2
# CHECK-NEXT: 4 0x1009 exportfn3
--- !COFF
header:

View File

@ -27,8 +27,8 @@ HEADER-NEXT: MinorLinkerVersion: 0
HEADER-NEXT: SizeOfCode: 512
HEADER-NEXT: SizeOfInitializedData: 1536
HEADER-NEXT: SizeOfUninitializedData: 0
HEADER-NEXT: AddressOfEntryPoint: 0x2000
HEADER-NEXT: BaseOfCode: 0x2000
HEADER-NEXT: AddressOfEntryPoint: 0x1000
HEADER-NEXT: BaseOfCode: 0x1000
HEADER-NEXT: BaseOfData: 0x0
HEADER-NEXT: ImageBase: 0x400000
HEADER-NEXT: SectionAlignment: 4096
@ -123,10 +123,10 @@ IMPORTS: }
BASEREL: BaseReloc [
BASEREL: Entry {
BASEREL: Type: HIGHLOW
BASEREL: Address: 0x2005
BASEREL: Address: 0x1005
BASEREL: }
BASEREL: Entry {
BASEREL: Type: HIGHLOW
BASEREL: Address: 0x200C
BASEREL: Address: 0x100C
BASEREL: }
BASEREL: ]

View File

@ -15,16 +15,16 @@ TEXT: Disassembly of section .text:
TEXT-NEXT: .text:
TEXT-NEXT: subq $40, %rsp
TEXT-NEXT: movq $0, %rcx
TEXT-NEXT: leaq -4108(%rip), %rdx
TEXT-NEXT: leaq -4121(%rip), %r8
TEXT-NEXT: leaq 4084(%rip), %rdx
TEXT-NEXT: leaq 4071(%rip), %r8
TEXT-NEXT: movl $0, %r9d
TEXT-NEXT: callq 60
TEXT-NEXT: movl $0, %ecx
TEXT-NEXT: callq 18
TEXT-NEXT: callq 29
TEXT: jmpq *4098(%rip)
TEXT: jmpq *4090(%rip)
TEXT: jmpq *4082(%rip)
TEXT: jmpq *8194(%rip)
TEXT: jmpq *8186(%rip)
TEXT: jmpq *8178(%rip)
IMPORT: Import {
IMPORT-NEXT: Name: std64.dll

View File

@ -2,7 +2,7 @@
; RUN: lld-link /out:%t.exe %t.obj /entry:main /subsystem:console
; RUN: llvm-readobj -file-headers %t.exe | FileCheck %s
; CHECK: LoadConfigTableRVA: 0x1000
; CHECK: LoadConfigTableRVA: 0x2000
; CHECK: LoadConfigTableSize: 0x70
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"

View File

@ -2,7 +2,7 @@
# RUN: lld-link /out:%t.exe %t.obj /entry:main /subsystem:console
# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s
# CHECK: LoadConfigTableRVA: 0x1000
# CHECK: LoadConfigTableRVA: 0x2000
# CHECK: LoadConfigTableSize: 0x70
--- !COFF

View File

@ -2,7 +2,7 @@
# RUN: lld-link /out:%t.exe %t.obj /entry:main /subsystem:console
# RUN: llvm-readobj -file-headers %t.exe | FileCheck %s
# CHECK: LoadConfigTableRVA: 0x1000
# CHECK: LoadConfigTableRVA: 0x2000
# CHECK: LoadConfigTableSize: 0x40
--- !COFF

View File

@ -45,7 +45,7 @@
; TEXT-11-NEXT: xorl %eax, %eax
; TEXT-11-NEXT: retq
; HEADERS-01: AddressOfEntryPoint: 0x2000
; HEADERS-01: AddressOfEntryPoint: 0x1000
; TEXT-01: Disassembly of section .text:
; TEXT-01-NEXT: .text:
; TEXT-01-NEXT: subq $40, %rsp
@ -62,7 +62,7 @@
; TEXT-01: int3
; TEXT-01-NOT: {{.}}
; HEADERS-10: AddressOfEntryPoint: 0x2020
; HEADERS-10: AddressOfEntryPoint: 0x1020
; TEXT-10: Disassembly of section .text:
; TEXT-10-NEXT: .text:
; TEXT-10-NEXT: subq $40, %rsp

View File

@ -52,7 +52,7 @@
; TEXT-11-NEXT: movl $2, %eax
; TEXT-11-NEXT: retq
; HEADERS-01: AddressOfEntryPoint: 0x2000
; HEADERS-01: AddressOfEntryPoint: 0x1000
; TEXT-01: Disassembly of section .text:
; TEXT-01-NEXT: .text:
; TEXT-01-NEXT: subq $40, %rsp
@ -78,7 +78,7 @@
; TEXT-01-NEXT: int3
; TEXT-01-NEXT: retq
; HEADERS-10: AddressOfEntryPoint: 0x2020
; HEADERS-10: AddressOfEntryPoint: 0x1020
; TEXT-10: Disassembly of section .text:
; TEXT-10-NEXT: .text:
; TEXT-10-NEXT: retq

View File

@ -8,7 +8,7 @@
# RUN: llvm-readobj -coff-resources -file-headers %t.exe | FileCheck %s \
# RUN: -check-prefix TEST_EMBED
TEST_EMBED: ResourceTableRVA: 0x1000
TEST_EMBED: ResourceTableRVA: 0x2000
TEST_EMBED-NEXT: ResourceTableSize: 0x298
TEST_EMBED-DAG: Resources [
TEST_EMBED-NEXT: Total Number of Resources: 1

View File

@ -3,7 +3,7 @@
# RUN: lld-link /out:%t.exe /entry:func1 /subsystem:console %t.obj
# RUN: llvm-objdump -s -section=.pdata %t.exe | FileCheck -check-prefix=PDATA %s
# PDATA: 00200000 2500a100 24200000 31002201
# PDATA: 00100000 2500a100 24100000 31002201
--- !COFF
header:

View File

@ -61,7 +61,7 @@ CHECK: machine = intel x86-x64, Ver = Microsoft (R) Optimizing Compiler,
CHECK: frontend = 19.0.24215.1, backend = 19.0.24215.1
CHECK: flags = security checks | hot patchable
CHECK: 120 | S_GPROC32 [size = 44] `main`
CHECK: parent = 0, end = 196, addr = 0002:0000, code size = 24
CHECK: parent = 0, end = 196, addr = 0001:0000, code size = 24
CHECK: debug start = 4, debug end = 19, flags = none
CHECK: 164 | S_FRAMEPROC [size = 32]
CHECK: size = 40, padding size = 0, offset to padding = 0
@ -70,7 +70,7 @@ CHECK: flags = has async eh | opt speed
CHECK: 196 | S_END [size = 4]
CHECK: 200 | S_BUILDINFO [size = 8] BuildId = `0x100A`
CHECK: 208 | S_GPROC32 [size = 44] `foo`
CHECK: parent = 0, end = 284, addr = 0002:0032, code size = 15
CHECK: parent = 0, end = 284, addr = 0001:0032, code size = 15
CHECK: debug start = 0, debug end = 14, flags = none
CHECK: 252 | S_FRAMEPROC [size = 32]
CHECK: size = 0, padding size = 0, offset to padding = 0
@ -84,7 +84,7 @@ CHECK: machine = intel x86-x64, Ver = Microsoft (R) Optimizing Compiler, l
CHECK: frontend = 19.0.24215.1, backend = 19.0.24215.1
CHECK: flags = security checks | hot patchable
CHECK: 120 | S_GPROC32 [size = 44] `bar`
CHECK: parent = 0, end = 196, addr = 0002:0048, code size = 14
CHECK: parent = 0, end = 196, addr = 0001:0048, code size = 14
CHECK: debug start = 4, debug end = 9, flags = none
CHECK: 164 | S_FRAMEPROC [size = 32]
CHECK: size = 40, padding size = 0, offset to padding = 0

View File

@ -26,7 +26,7 @@ CHECK-NEXT: module = 1, sum name = 0, offset = 376
CHECK-NEXT: 232 | S_GDATA32 [size = 28] `__purecall`
CHECK-NEXT: type = 0x0403 (void*), addr = 0000:0000
CHECK-NEXT: 260 | S_GDATA32 [size = 24] `GlobalVar`
CHECK-NEXT: type = 0x100B (const int*), addr = 0001:0000
CHECK-NEXT: type = 0x100B (const int*), addr = 0003:0000
CHECK-NEXT: 284 | S_LDATA32 [size = 28] `ConstantVar`
CHECK-NEXT: type = 0x100A (const int), addr = 0002:0000

View File

@ -9,7 +9,7 @@ CHECK: Symbols
CHECK-NEXT: ============================================================
CHECK-LABEL: Mod 0000 |
CHECK: 92 | S_GPROC32 [size = 44] `main`
CHECK-NEXT: parent = 0, end = 168, addr = 0002:0000, code size = 14
CHECK-NEXT: parent = 0, end = 168, addr = 0001:0000, code size = 14
CHECK-NEXT: type = `0x1004 (int (<no type>))`, debug start = 4, debug end = 9, flags = none
CHECK-NEXT: 136 | S_FRAMEPROC [size = 32]
CHECK-NEXT: size = 40, padding size = 0, offset to padding = 0
@ -18,7 +18,7 @@ CHECK-NEXT: flags = has async eh | opt speed
CHECK-NEXT: 168 | S_END [size = 4]
CHECK-LABEL: Mod 0001 |
CHECK: 92 | S_GPROC32 [size = 44] `foo`
CHECK-NEXT: parent = 0, end = 168, addr = 0002:0016, code size = 6
CHECK-NEXT: parent = 0, end = 168, addr = 0001:0016, code size = 6
CHECK-NEXT: type = `0x1001 (int ())`, debug start = 0, debug end = 5, flags = none
CHECK-NEXT: 136 | S_FRAMEPROC [size = 32]
CHECK-NEXT: size = 0, padding size = 0, offset to padding = 0

View File

@ -35,39 +35,39 @@ RUN: llvm-pdbutil dump -symbols %t.pdb | FileCheck %s
CHECK-LABEL: Mod 0000 | `{{.*}}pdb-scopes.test.tmp-a.obj`:
CHECK: 104 | S_GPROC32 [size = 44] `g`
CHECK: parent = 0, end = 196, addr = 0002:0000, code size = 5
CHECK: parent = 0, end = 196, addr = 0001:0000, code size = 5
CHECK: debug start = 4, debug end = 4, flags = none
CHECK: 180 | S_REGREL32 [size = 16] `x`
CHECK: 196 | S_END [size = 4]
CHECK: 200 | S_GPROC32 [size = 44] `main`
CHECK: parent = 0, end = 384, addr = 0002:0016, code size = 58
CHECK: parent = 0, end = 384, addr = 0001:0016, code size = 58
CHECK: debug start = 8, debug end = 53, flags = none
CHECK: 276 | S_REGREL32 [size = 20] `argc`
CHECK: 296 | S_BLOCK32 [size = 24] ``
CHECK: parent = 200, end = 336
CHECK: code size = 17, addr = 0002:0031
CHECK: code size = 17, addr = 0001:0031
CHECK: 320 | S_REGREL32 [size = 16] `x`
CHECK: 336 | S_END [size = 4]
CHECK: 340 | S_BLOCK32 [size = 24] ``
CHECK: parent = 200, end = 380
CHECK: code size = 17, addr = 0002:0050
CHECK: code size = 17, addr = 0001:0050
CHECK: 364 | S_REGREL32 [size = 16] `y`
CHECK: 380 | S_END [size = 4]
CHECK: 384 | S_END [size = 4]
CHECK-LABEL: Mod 0001 | `{{.*}}pdb-scopes.test.tmp-b.obj`:
CHECK: 104 | S_GPROC32 [size = 44] `f`
CHECK: parent = 0, end = 284, addr = 0002:0080, code size = 62
CHECK: parent = 0, end = 284, addr = 0001:0080, code size = 62
CHECK: debug start = 8, debug end = 57, flags = none
CHECK: 180 | S_REGREL32 [size = 16] `x`
CHECK: 196 | S_BLOCK32 [size = 24] ``
CHECK: parent = 104, end = 236
CHECK: code size = 20, addr = 0002:0095
CHECK: code size = 20, addr = 0001:0095
CHECK: 220 | S_REGREL32 [size = 16] `y`
CHECK: 236 | S_END [size = 4]
CHECK: 240 | S_BLOCK32 [size = 24] ``
CHECK: parent = 104, end = 280
CHECK: code size = 20, addr = 0002:0117
CHECK: code size = 20, addr = 0001:0117
CHECK: 264 | S_REGREL32 [size = 16] `w`
CHECK: 280 | S_END [size = 4]
CHECK: 284 | S_END [size = 4]

View File

@ -43,7 +43,7 @@ CHECK-NEXT: - !Lines
CHECK-NEXT: CodeSize: 19
CHECK-NEXT: Flags: [ ]
CHECK-NEXT: RelocOffset: 0
CHECK-NEXT: RelocSegment: 2
CHECK-NEXT: RelocSegment: 1
CHECK-NEXT: Blocks:
CHECK-NEXT: - FileName: '{{.*}}pdb_lines_1.c'
CHECK-NEXT: Lines:
@ -68,7 +68,7 @@ CHECK-NEXT: - !Lines
CHECK-NEXT: CodeSize: 14
CHECK-NEXT: Flags: [ ]
CHECK-NEXT: RelocOffset: 32
CHECK-NEXT: RelocSegment: 2
CHECK-NEXT: RelocSegment: 1
CHECK-NEXT: Blocks:
CHECK-NEXT: - FileName: '{{.*}}foo.h'
CHECK-NEXT: Lines:
@ -103,7 +103,7 @@ CHECK-NEXT: - !Lines
CHECK-NEXT: CodeSize: 1
CHECK-NEXT: Flags: [ ]
CHECK-NEXT: RelocOffset: 48
CHECK-NEXT: RelocSegment: 2
CHECK-NEXT: RelocSegment: 1
CHECK-NEXT: Blocks:
CHECK-NEXT: - FileName: '{{.*}}pdb_lines_2.c'
CHECK-NEXT: Lines:

View File

@ -19,7 +19,7 @@
# CHECK-NEXT: 48 | S_PROCREF [size = 20] `main`
# CHECK-NEXT: module = 1, sum name = 0, offset = 116
# CHECK-NEXT: 68 | S_GDATA32 [size = 28] `global_foo`
# CHECK-NEXT: type = 0x1004 (Foo), addr = 0001:0000
# CHECK-NEXT: type = 0x1004 (Foo), addr = 0003:0000
# CHECK: Symbols
# CHECK: ============================================================
@ -30,7 +30,7 @@
# CHECK: frontend = 19.0.24215.1, backend = 19.0.24215.1
# CHECK: flags = security checks | hot patchable
# CHECK: 116 | S_GPROC32 [size = 44] `main`
# CHECK: parent = 0, end = 192, addr = 0002:0000, code size = 7
# CHECK: parent = 0, end = 192, addr = 0001:0000, code size = 7
# CHECK: debug start = 0, debug end = 6, flags = none
# CHECK: 160 | S_FRAMEPROC [size = 32]
# CHECK: size = 0, padding size = 0, offset to padding = 0

View File

@ -72,7 +72,7 @@ CHECK: ============================================================
CHECK-LABEL: Mod 0000 | `{{.*}}a.obj`:
CHECK: 4 | S_OBJNAME [size = 40] sig=0, `C:\src\llvm-project\build\a.obj`
CHECK: 104 | S_GPROC32 [size = 44] `main`
CHECK: parent = 0, end = 196, addr = 0002:0000, code size = 27
CHECK: parent = 0, end = 196, addr = 0001:0000, code size = 27
CHECK: type = {{.*}}, debug start = 4, debug end = 22, flags = none
CHECK: 200 | S_BUILDINFO [size = 8] BuildId = `[[A_BUILD]]`
CHECK-LABEL: Mod 0001 | `{{.*}}b.obj`:
@ -82,7 +82,7 @@ CHECK: machine = intel x86-x64, Ver = Microsoft (R) Optimizing Compil
CHECK: frontend = 19.0.24215.1, backend = 19.0.24215.1
CHECK: flags = security checks | hot patchable
CHECK: 104 | S_GPROC32 [size = 44] `g`
CHECK: parent = 0, end = 196, addr = 0002:0032, code size = 13
CHECK: parent = 0, end = 196, addr = 0001:0032, code size = 13
CHECK: type = {{.*}}, debug start = 5, debug end = 12, flags = none
CHECK: 148 | S_FRAMEPROC [size = 32]
CHECK: size = 0, padding size = 0, offset to padding = 0

View File

@ -181,9 +181,9 @@ RAW-NEXT: GSI Header
RAW-NEXT: sig = 0xFFFFFFFF, hdr = 0xF12F091A, hr size = 16, num buckets = 524
RAW-NEXT: Records
RAW-NEXT: 20 | S_PUB32 [size = 20] `main`
RAW-NEXT: flags = function, addr = 0002:0000
RAW-NEXT: flags = function, addr = 0001:0000
RAW-NEXT: 0 | S_PUB32 [size = 20] `foo`
RAW-NEXT: flags = function, addr = 0002:0016
RAW-NEXT: flags = function, addr = 0001:0016
RAW-NOT: S_PUB32
RAW-NEXT: Hash Entries
RAW-NEXT: off = 21, refcnt = 1
@ -196,93 +196,96 @@ RAW-NEXT: off = 20
RAW-NEXT: off = 0
RAW: Section Headers
RAW-NEXT: ============================================================
RAW: SECTION HEADER #1
RAW-NEXT: .pdata name
RAW-NEXT: virtual size
RAW-NEXT: 1000 virtual address
RAW-NEXT: 200 size of raw data
RAW-NEXT: 400 file pointer to raw data
RAW-NEXT: 0 file pointer to relocation table
RAW-NEXT: 0 file pointer to line numbers
RAW-NEXT: 0 number of relocations
RAW-NEXT: 0 number of line numbers
RAW-NEXT: 40000040 flags
RAW-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA
RAW-NEXT: IMAGE_SCN_MEM_READ
RAW-NEXT: .text name
RAW-NEXT: 16 virtual size
RAW-NEXT: 1000 virtual address
RAW-NEXT: 200 size of raw data
RAW-NEXT: 400 file pointer to raw data
RAW-NEXT: 0 file pointer to relocation table
RAW-NEXT: 0 file pointer to line numbers
RAW-NEXT: 0 number of relocations
RAW-NEXT: 0 number of line numbers
RAW-NEXT: 60000020 flags
RAW-NEXT: IMAGE_SCN_CNT_CODE
RAW-NEXT: IMAGE_SCN_MEM_EXECUTE
RAW-NEXT: IMAGE_SCN_MEM_READ
RAW: SECTION HEADER #2
RAW-NEXT: .text name
RAW-NEXT: virtual size
RAW-NEXT: 2000 virtual address
RAW-NEXT: 200 size of raw data
RAW-NEXT: 600 file pointer to raw data
RAW-NEXT: 0 file pointer to relocation table
RAW-NEXT: 0 file pointer to line numbers
RAW-NEXT: 0 number of relocations
RAW-NEXT: 0 number of line numbers
RAW-NEXT: 60000020 flags
RAW-NEXT: IMAGE_SCN_CNT_CODE
RAW-NEXT: IMAGE_SCN_MEM_EXECUTE
RAW-NEXT: IMAGE_SCN_MEM_READ
RAW-NEXT: .rdata name
RAW-NEXT: 79 virtual size
RAW-NEXT: 2000 virtual address
RAW-NEXT: 200 size of raw data
RAW-NEXT: 600 file pointer to raw data
RAW-NEXT: 0 file pointer to relocation table
RAW-NEXT: 0 file pointer to line numbers
RAW-NEXT: 0 number of relocations
RAW-NEXT: 0 number of line numbers
RAW-NEXT: 40000040 flags
RAW-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA
RAW-NEXT: IMAGE_SCN_MEM_READ
RAW: SECTION HEADER #3
RAW-NEXT: .xdata name
RAW-NEXT: virtual size
RAW-NEXT: 3000 virtual address
RAW-NEXT: 200 size of raw data
RAW-NEXT: 800 file pointer to raw data
RAW-NEXT: 0 file pointer to relocation table
RAW-NEXT: 0 file pointer to line numbers
RAW-NEXT: 0 number of relocations
RAW-NEXT: 0 number of line numbers
RAW-NEXT: 40000040 flags
RAW-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA
RAW-NEXT: IMAGE_SCN_MEM_READ
RAW-NEXT: .pdata name
RAW-NEXT: C virtual size
RAW-NEXT: 3000 virtual address
RAW-NEXT: 200 size of raw data
RAW-NEXT: 800 file pointer to raw data
RAW-NEXT: 0 file pointer to relocation table
RAW-NEXT: 0 file pointer to line numbers
RAW-NEXT: 0 number of relocations
RAW-NEXT: 0 number of line numbers
RAW-NEXT: 40000040 flags
RAW-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA
RAW-NEXT: IMAGE_SCN_MEM_READ
RAW: SECTION HEADER #4
RAW-NEXT: .rdata name
RAW-NEXT: virtual size
RAW-NEXT: 4000 virtual address
RAW-NEXT: 200 size of raw data
RAW-NEXT: A00 file pointer to raw data
RAW-NEXT: 0 file pointer to relocation table
RAW-NEXT: 0 file pointer to line numbers
RAW-NEXT: 0 number of relocations
RAW-NEXT: 0 number of line numbers
RAW-NEXT: 40000040 flags
RAW-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA
RAW-NEXT: IMAGE_SCN_MEM_READ
RAW-NEXT: .xdata name
RAW-NEXT: 8 virtual size
RAW-NEXT: 4000 virtual address
RAW-NEXT: 200 size of raw data
RAW-NEXT: A00 file pointer to raw data
RAW-NEXT: 0 file pointer to relocation table
RAW-NEXT: 0 file pointer to line numbers
RAW-NEXT: 0 number of relocations
RAW-NEXT: 0 number of line numbers
RAW-NEXT: 40000040 flags
RAW-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA
RAW-NEXT: IMAGE_SCN_MEM_READ
RAW: Original Section Headers
RAW-NEXT: ============================================================
RAW-NEXT: PDB does not contain the requested image section header type
RAW: Section Contributions
RAW-NEXT: ============================================================
RAW-NEXT: SC[.pdata] | mod = 0, 0001:0000, size = 12, data crc = 361370162, reloc crc = 0
RAW-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_ALIGN_4BYTES | IMAGE_SCN_MEM_READ
RAW-NEXT: SC[.text] | mod = 0, 0002:0000, size = 14, data crc = 1682752513, reloc crc = 0
RAW-NEXT: SC[.text] | mod = 0, 0001:0000, size = 14, data crc = 1682752513, reloc crc = 0
RAW-NEXT: IMAGE_SCN_CNT_CODE | IMAGE_SCN_ALIGN_16BYTES | IMAGE_SCN_MEM_EXECUTE |
RAW-NEXT: IMAGE_SCN_MEM_READ
RAW-NEXT: SC[.text] | mod = 1, 0002:0016, size = 6, data crc = 2139436471, reloc crc = 0
RAW-NEXT: SC[.text] | mod = 1, 0001:0016, size = 6, data crc = 2139436471, reloc crc = 0
RAW-NEXT: IMAGE_SCN_CNT_CODE | IMAGE_SCN_ALIGN_16BYTES | IMAGE_SCN_MEM_EXECUTE |
RAW-NEXT: IMAGE_SCN_MEM_READ
RAW-NEXT: SC[.xdata] | mod = 0, 0003:0000, size = 8, data crc = 264583633, reloc crc = 0
RAW-NEXT: SC[.rdata] | mod = 2, 0002:0000, size = 28, data crc = 0, reloc crc = 0
RAW-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
RAW-NEXT: SC[.rdata] | mod = 2, 0002:0028, size = 93, data crc = 0, reloc crc = 0
RAW-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
RAW-NEXT: SC[.pdata] | mod = 0, 0003:0000, size = 12, data crc = 361370162, reloc crc = 0
RAW-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_ALIGN_4BYTES | IMAGE_SCN_MEM_READ
RAW-NEXT: SC[???] | mod = 0, 0004:0000, size = 8, data crc = 264583633, reloc crc = 0
RAW-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_ALIGN_4BYTES | IMAGE_SCN_MEM_READ
RAW-NEXT: SC[???] | mod = 2, 0004:0000, size = {{[0-9]+}}, data crc = 0, reloc crc = 0
RAW-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
RAW-NEXT: SC[???] | mod = 2, 0004:0028, size = {{[0-9]+}}, data crc = 0, reloc crc = 0
RAW-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
RAW-NOT: SC[
RAW: Section Map
RAW-NEXT: ============================================================
RAW-NEXT: Section 0000 | ovl = 0, group = 0, frame = 1, name = 65535
RAW-NEXT: class = 65535, offset = 0, size =
RAW-NEXT: flags = read | 32 bit addr | selector
RAW-NEXT: Section 0001 | ovl = 0, group = 0, frame = 2, name = 65535
RAW-NEXT: class = 65535, offset = 0, size =
RAW-NEXT: class = 65535, offset = 0, size = 22
RAW-NEXT: flags = read | execute | 32 bit addr | selector
RAW-NEXT: Section 0001 | ovl = 0, group = 0, frame = 2, name = 65535
RAW-NEXT: class = 65535, offset = 0, size = 121
RAW-NEXT: flags = read | 32 bit addr | selector
RAW-NEXT: Section 0002 | ovl = 0, group = 0, frame = 3, name = 65535
RAW-NEXT: class = 65535, offset = 0, size =
RAW-NEXT: class = 65535, offset = 0, size = 12
RAW-NEXT: flags = read | 32 bit addr | selector
RAW-NEXT: Section 0003 | ovl = 0, group = 0, frame = 4, name = 65535
RAW-NEXT: class = 65535, offset = 0, size =
RAW-NEXT: class = 65535, offset = 0, size = 8
RAW-NEXT: flags = read | 32 bit addr | selector
RAW-NEXT: Section 0004 | ovl = 0, group = 0, frame = 5, name = 65535
RAW-NEXT: class = 65535, offset = 0, size =
RAW-NEXT: class = 65535, offset = 0, size = 4294967295
RAW-NEXT: flags = 32 bit addr | absolute addr

View File

@ -3,14 +3,14 @@
# RUN: llvm-objdump -s %t.exe | FileCheck %s
# CHECK: .text:
# CHECK: 402000 01104000 00000000 00000000 00000000
# CHECK: 402010 01100000 00000000 00000000 00000000
# CHECK: 402020 41f20009 c0f24009 00000000 00000000
# CHECK: 402030 fe07e62f 00000000 00000000 00000000
# CHECK: 402040 3e04de2f 00000000 00000000 00000000
# CHECK: 402050 fe07d62f 00000000 00000000 00000000
# CHECK: 402060 fef0cef7 00000000 00000000 00000000
# CHECK: 402070 00005000 00000000 00000000 00000000
# CHECK: 401000 01204000 00000000 00000000 00000000
# CHECK: 401010 01200000 00000000 00000000 00000000
# CHECK: 401020 42f20009 c0f24009 00000000 00000000
# CHECK: 401030 0000e62f 00000000 00000000 00000000
# CHECK: 401040 0000de07 00000000 00000000 00000000
# CHECK: 401050 0000d62f 00000000 00000000 00000000
# CHECK: 401060 00f1cef7 00000000 00000000 00000000
# CHECK: 401070 00005000 00000000 00000000 00000000
--- !COFF
header:

View File

@ -10,11 +10,11 @@ EXE: {{H.e.l.l.o}}
# RUN: llvm-readobj -file-headers -coff-resources -section-data %t.exe | \
# RUN: FileCheck --check-prefix=RESOURCE_INFO %s
RESOURCE_INFO: ResourceTableRVA: 0x1000
RESOURCE_INFO: ResourceTableRVA: 0x2000
RESOURCE_INFO-NEXT: ResourceTableSize: 0x88
RESOURCE_INFO-DAG: Resources [
RESOURCE_INFO-NEXT: Total Number of Resources: 1
RESOURCE_INFO-NEXT: Base Table Address: 0x400
RESOURCE_INFO-NEXT: Base Table Address: 0x600
RESOURCE_INFO-DAG: Number of String Entries: 0
RESOURCE_INFO-NEXT: Number of ID Entries: 1
RESOURCE_INFO-NEXT: Type: kRT_STRING (ID 6) [
@ -36,7 +36,7 @@ RESOURCE_INFO-NEXT: 0000: 00000000 00000000 00000000 00000100 |................
RESOURCE_INFO-NEXT: 0010: 06000000 18000080 00000000 00000000 |................|
RESOURCE_INFO-NEXT: 0020: 00000000 00000100 01000000 30000080 |............0...|
RESOURCE_INFO-NEXT: 0030: 00000000 00000000 00000000 00000100 |................|
RESOURCE_INFO-NEXT: 0040: 09040000 48000000 58100000 2A000000 |....H...X...*...|
RESOURCE_INFO-NEXT: 0040: 09040000 48000000 58200000 2A000000 |....H...X ..*...|
RESOURCE_INFO-NEXT: 0050: 00000000 00000000 00000500 48006500 |............H.e.|
RESOURCE_INFO-NEXT: 0060: 6C006C00 6F000000 00000000 00000000 |l.l.o...........|
RESOURCE_INFO-NEXT: 0070: 00000000 00000000 00000000 00000000 |................|

View File

@ -12,11 +12,11 @@
# CHECK-NOGC: Type: HIGHLOW
# CHECK-NOGC: LoadConfig [
# CHECK-NOGC: Size: 0x48
# CHECK-NOGC: SEHandlerTable: 0x401048
# CHECK-NOGC: SEHandlerTable: 0x402048
# CHECK-NOGC: SEHandlerCount: 1
# CHECK-NOGC: ]
# CHECK-NOGC: SEHTable [
# CHECK-NOGC-NEXT: 0x402006
# CHECK-NOGC-NEXT: 0x401006
# CHECK-NOGC-NEXT: ]
# Without the SEH table, the address is absolute, so check that we do

View File

@ -16,18 +16,18 @@ ret
# CHECK: Sections [
# CHECK: Section {
# CHECK: Number: 1
# CHECK: Name: .rdata (2E 72 64 61 74 61 00 00)
# CHECK: SectionData (
# CHECK: 0000: 0300 |..|
# CHECK: )
# CHECK: }
# CHECK: Section {
# CHECK: Number: 2
# CHECK: Name: .text (2E 74 65 78 74 00 00 00)
# CHECK: VirtualSize: 0x1
# CHECK: SectionData (
# CHECK: 0000: C3 |.|
# CHECK: )
# CHECK: }
# CHECK: Section {
# CHECK: Number: 2
# CHECK: Name: .rdata (2E 72 64 61 74 61 00 00)
# CHECK: SectionData (
# CHECK: 0000: 0300 |..|
# CHECK: )
# CHECK: }
# CHECK-NOT: Section
# CHECK: ]

View File

@ -7,24 +7,24 @@
# CHECK: Sections [
# CHECK: Section {
# CHECK: Number: 1
# CHECK: Name: .bss (2E 62 73 73 00 00 00 00)
# CHECK: VirtualSize: 0x4
# CHECK: }
# CHECK: Section {
# CHECK: Number: 2
# CHECK: Name: .rdata (2E 72 64 61 74 61 00 00)
# CHECK: SectionData (
# CHECK: 0000: 00000000 01000000 |........|
# CHECK: )
# CHECK: }
# CHECK: Section {
# CHECK: Number: 3
# CHECK: Name: .text (2E 74 65 78 74 00 00 00)
# CHECK: VirtualSize: 0x1
# CHECK: SectionData (
# CHECK: 0000: C3 |.|
# CHECK: )
# CHECK: }
# CHECK: Section {
# CHECK: Number: 2
# CHECK: Name: .bss (2E 62 73 73 00 00 00 00)
# CHECK: VirtualSize: 0x4
# CHECK: }
# CHECK: Section {
# CHECK: Number: 3
# CHECK: Name: .rdata (2E 72 64 61 74 61 00 00)
# CHECK: SectionData (
# CHECK: 0000: 00000000 02000000 |........|
# CHECK: )
# CHECK: }
# CHECK-NOT: Section
# CHECK: ]

View File

@ -3,28 +3,29 @@
# RUN: lld-link %t.obj /out:%t.exe /entry:main /subsystem:console
# RUN: llvm-objdump -s %t.exe | FileCheck %s
# CHECK: Contents of section .text:
.globl main
main:
# CHECK-NEXT: 140001000 11200040 01000000 17200040 01000000
.8byte "??_C@_0M@LACCCNMM@hello?5world?$AA@"
.8byte "??_C@_05MCBCHHEJ@world?$AA@"
# CHECK-NEXT: 140001010 2a200040 01000000 36200040 01000000
.8byte "??_C@_1BI@HHJHKLLN@?$AAh?$AAe?$AAl?$AAl?$AAo?$AA?5?$AAw?$AAo?$AAr?$AAl?$AAd?$AA?$AA@"
.8byte "??_C@_1M@NBBDDHIO@?$AAw?$AAo?$AAr?$AAl?$AAd?$AA?$AA@"
# CHECK-NEXT: 140001020 00200040 01000000 0c200040 01000000
.8byte "??_D@not_a_string_literal"
.8byte "??_C@string_literal_with_relocs"
# CHECK-NEXT: 140001030 00300040 01000000 1e200040 01000000
.8byte "??_C@string_literal_in_wrong_section"
.8byte "??_C@overaligned_string_literal"
# CHECK: Contents of section .rdata:
# CHECK-NEXT: 140002000 68656c6c 6f20776f 726c6400 6fa26ca4 hello world.o.l.
# CHECK-NEXT: 140002000 68656c6c 6f20776f 726c6400 6f826ca4 hello world.o.l.
# CHECK-NEXT: 140002010 0068656c 6c6f2077 6f726c64 00006865 .hello world..he
# CHECK-NEXT: 140002020 6c6c6f20 776f726c 64006800 65006c00 llo world.h.e.l.
# CHECK-NEXT: 140002030 6c006f00 20007700 6f007200 6c006400 l.o. .w.o.r.l.d.
# CHECK-NEXT: 140002040 0000 ..
# CHECK: Contents of section .text:
.globl main
main:
# CHECK-NEXT: 140003000 11200040 01000000 17200040 01000000
.8byte "??_C@_0M@LACCCNMM@hello?5world?$AA@"
.8byte "??_C@_05MCBCHHEJ@world?$AA@"
# CHECK-NEXT: 140003010 2a200040 01000000 36200040 01000000
.8byte "??_C@_1BI@HHJHKLLN@?$AAh?$AAe?$AAl?$AAl?$AAo?$AA?5?$AAw?$AAo?$AAr?$AAl?$AAd?$AA?$AA@"
.8byte "??_C@_1M@NBBDDHIO@?$AAw?$AAo?$AAr?$AAl?$AAd?$AA?$AA@"
# CHECK-NEXT: 140003020 00200040 01000000 0c200040 01000000
.8byte "??_D@not_a_string_literal"
.8byte "??_C@string_literal_with_relocs"
# CHECK-NEXT: 140003030 00100040 01000000 1e200040 01000000
.8byte "??_C@string_literal_in_wrong_section"
.8byte "??_C@overaligned_string_literal"
.section .rdata,"dr",discard,"??_C@_0M@LACCCNMM@hello?5world?$AA@"
.globl "??_C@_0M@LACCCNMM@hello?5world?$AA@"

View File

@ -11,7 +11,7 @@
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: .text
# CHECK-NEXT: Value: 0
# CHECK-NEXT: Section: .text (2)
# CHECK-NEXT: Section: .text (1)
# CHECK-NEXT: BaseType: Null (0x0)
# CHECK-NEXT: ComplexType: Null (0x0)
# CHECK-NEXT: StorageClass: Static (0x3)
@ -20,7 +20,7 @@
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: .text2
# CHECK-NEXT: Value: 0
# CHECK-NEXT: Section: .text (2)
# CHECK-NEXT: Section: .text (1)
# CHECK-NEXT: BaseType: Null (0x0)
# CHECK-NEXT: ComplexType: Null (0x0)
# CHECK-NEXT: StorageClass: Static (0x3)
@ -29,7 +29,7 @@
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: .data
# CHECK-NEXT: Value: 0
# CHECK-NEXT: Section: .data (1)
# CHECK-NEXT: Section: .data (3)
# CHECK-NEXT: BaseType: Null (0x0)
# CHECK-NEXT: ComplexType: Null (0x0)
# CHECK-NEXT: StorageClass: Static (0x3)
@ -38,7 +38,7 @@
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: MessageBoxA
# CHECK-NEXT: Value: 80
# CHECK-NEXT: Section: .text (2)
# CHECK-NEXT: Section: .text (1)
# CHECK-NEXT: BaseType: Null (0x0)
# CHECK-NEXT: ComplexType: Null (0x0)
# CHECK-NEXT: StorageClass: External (0x2)
@ -47,7 +47,7 @@
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: ExitProcess
# CHECK-NEXT: Value: 64
# CHECK-NEXT: Section: .text (2)
# CHECK-NEXT: Section: .text (1)
# CHECK-NEXT: BaseType: Null (0x0)
# CHECK-NEXT: ComplexType: Null (0x0)
# CHECK-NEXT: StorageClass: External (0x2)
@ -56,7 +56,7 @@
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: message
# CHECK-NEXT: Value: 6
# CHECK-NEXT: Section: .text2 (3)
# CHECK-NEXT: Section: .text2 (5)
# CHECK-NEXT: BaseType: Null (0x0)
# CHECK-NEXT: ComplexType: Null (0x0)
# CHECK-NEXT: StorageClass: Static (0x3)
@ -65,7 +65,7 @@
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: main
# CHECK-NEXT: Value: 0
# CHECK-NEXT: Section: .text (2)
# CHECK-NEXT: Section: .text (1)
# CHECK-NEXT: BaseType: Null (0x0)
# CHECK-NEXT: ComplexType: Null (0x0)
# CHECK-NEXT: StorageClass: External (0x2)
@ -74,7 +74,7 @@
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: caption
# CHECK-NEXT: Value: 0
# CHECK-NEXT: Section: .text2 (3)
# CHECK-NEXT: Section: .text2 (5)
# CHECK-NEXT: BaseType: Null (0x0)
# CHECK-NEXT: ComplexType: Null (0x0)
# CHECK-NEXT: StorageClass: Static (0x3)

View File

@ -4,11 +4,11 @@
# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=HEADER %s
# RUN: llvm-objdump -unwind-info %t.exe | FileCheck -check-prefix=UNWIND %s
#
# HEADER: ExceptionTableRVA: 0x1000
# HEADER: ExceptionTableRVA: 0x2000
#
# UNWIND: Function Table:
# UNWIND: Start Address: 0x2000
# UNWIND: End Address: 0x201b
# UNWIND: Start Address: 0x1000
# UNWIND: End Address: 0x101b
# UNWIND: Unwind Info Address: 0x3000
# UNWIND: Version: 1
# UNWIND: Flags: 1 UNW_ExceptionHandler
@ -24,8 +24,8 @@
# UNWIND: 0x04: UOP_AllocSmall 24
# UNWIND: 0x00: UOP_PushMachFrame w/o error code
# UNWIND: Function Table:
# UNWIND: Start Address: 0x2012
# UNWIND: End Address: 0x2012
# UNWIND: Start Address: 0x1012
# UNWIND: End Address: 0x1012
# UNWIND: Unwind Info Address: 0x301c
# UNWIND: Version: 1
# UNWIND: Flags: 4 UNW_ChainInfo
@ -33,8 +33,8 @@
# UNWIND: Number of Codes: 0
# UNWIND: No frame pointer used
# UNWIND: Function Table:
# UNWIND: Start Address: 0x201b
# UNWIND: End Address: 0x201c
# UNWIND: Start Address: 0x101b
# UNWIND: End Address: 0x101c
# UNWIND: Unwind Info Address: 0x302c
# UNWIND: Version: 1
# UNWIND: Flags: 0
@ -42,8 +42,8 @@
# UNWIND: Number of Codes: 0
# UNWIND: No frame pointer used
# UNWIND: Function Table:
# UNWIND: Start Address: 0x201c
# UNWIND: End Address: 0x2039
# UNWIND: Start Address: 0x101c
# UNWIND: End Address: 0x1039
# UNWIND: Unwind Info Address: 0x3034
# UNWIND: Version: 1
# UNWIND: Flags: 0