mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-14 03:29:57 +00:00
9a9fc78744
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
85 lines
3.1 KiB
Plaintext
85 lines
3.1 KiB
Plaintext
# RUN: yaml2obj < %s > %t.obj
|
|
# RUN: lld-link /out:%t.exe /entry:main %t.obj
|
|
# RUN: llvm-objdump -s %t.exe | FileCheck %s
|
|
|
|
# CHECK: .text:
|
|
# 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:
|
|
Machine: IMAGE_FILE_MACHINE_ARMNT
|
|
Characteristics: []
|
|
sections:
|
|
- Name: .aaa
|
|
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_PURGEABLE, IMAGE_SCN_MEM_16BIT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
|
|
Alignment: 4096
|
|
SectionData: 0000000000000000
|
|
- Name: .text
|
|
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_PURGEABLE, IMAGE_SCN_MEM_16BIT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
|
|
Alignment: 4096
|
|
SectionData: 00000000000000000000000000000000000000000000000000000000000000004ff6ff79cff6ff79000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f000f800000000000000000000000000000000000000000000000000000000
|
|
Relocations:
|
|
- VirtualAddress: 0
|
|
SymbolName: foo
|
|
Type: IMAGE_REL_ARM_ADDR32
|
|
- VirtualAddress: 16
|
|
SymbolName: foo
|
|
Type: IMAGE_REL_ARM_ADDR32NB
|
|
- VirtualAddress: 32
|
|
SymbolName: foo
|
|
Type: IMAGE_REL_ARM_MOV32T
|
|
- VirtualAddress: 48
|
|
SymbolName: foo
|
|
Type: IMAGE_REL_ARM_BRANCH24T
|
|
- VirtualAddress: 64
|
|
SymbolName: foo
|
|
Type: IMAGE_REL_ARM_BRANCH20T
|
|
- VirtualAddress: 80
|
|
SymbolName: foo
|
|
Type: IMAGE_REL_ARM_BLX23T
|
|
- VirtualAddress: 96
|
|
SymbolName: bar
|
|
Type: IMAGE_REL_ARM_BRANCH24T
|
|
- VirtualAddress: 112
|
|
SymbolName: bar
|
|
Type: IMAGE_REL_ARM_SECREL
|
|
symbols:
|
|
- Name: .aaa
|
|
Value: 0
|
|
SectionNumber: 1
|
|
SimpleType: IMAGE_SYM_TYPE_NULL
|
|
ComplexType: IMAGE_SYM_DTYPE_NULL
|
|
StorageClass: IMAGE_SYM_CLASS_STATIC
|
|
- Name: .text
|
|
Value: 0
|
|
SectionNumber: 2
|
|
SimpleType: IMAGE_SYM_TYPE_NULL
|
|
ComplexType: IMAGE_SYM_DTYPE_NULL
|
|
StorageClass: IMAGE_SYM_CLASS_STATIC
|
|
- Name: main
|
|
Value: 0
|
|
SectionNumber: 1
|
|
SimpleType: IMAGE_SYM_TYPE_NULL
|
|
ComplexType: IMAGE_SYM_DTYPE_NULL
|
|
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
|
- Name: foo
|
|
Value: 0
|
|
SectionNumber: 1
|
|
SimpleType: IMAGE_SYM_TYPE_NULL
|
|
ComplexType: IMAGE_SYM_DTYPE_NULL
|
|
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
|
- Name: bar
|
|
Value: 0x500000
|
|
SectionNumber: 1
|
|
SimpleType: IMAGE_SYM_TYPE_NULL
|
|
ComplexType: IMAGE_SYM_DTYPE_NULL
|
|
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
|
|
...
|