mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 16:16:39 +00:00

When we adjust section sizes while rewriting a binary, we should be using section offsets and not addresses to determine if section overlap. NFC for existing binaries.
53 lines
1.2 KiB
Plaintext
53 lines
1.2 KiB
Plaintext
## Check that llvm-bolt correctly processes a binary with program headers and
|
|
## corresponding sections specified in non-ascending address order.
|
|
|
|
RUN: split-file %s %t
|
|
RUN: yaml2obj %t/yaml -o %t.exe --max-size=0
|
|
RUN: llvm-bolt %t.exe -o %t.bolt --allow-stripped
|
|
RUN: llvm-readelf -WS %t.bolt | FileCheck %s
|
|
|
|
CHECK: .a PROGBITS 0000000000400000 [[#%.6x, OFFSET:]] 000001
|
|
CHECK-NEXT: .b PROGBITS 0000000000000000 [[#%.6x, OFFSET+1]] 000001
|
|
CHECK-NEXT: .c PROGBITS 0000000000600000 [[#%.6x, OFFSET+2]] 000001
|
|
|
|
#--- yaml
|
|
--- !ELF
|
|
FileHeader:
|
|
Class: ELFCLASS64
|
|
Data: ELFDATA2LSB
|
|
Type: ET_EXEC
|
|
Machine: EM_X86_64
|
|
ProgramHeaders:
|
|
- Type: PT_LOAD
|
|
FirstSec: .a
|
|
LastSec: .a
|
|
VAddr: 0x400000
|
|
- Type: PT_LOAD
|
|
FirstSec: .b
|
|
LastSec: .b
|
|
VAddr: 0x0
|
|
- Type: PT_LOAD
|
|
FirstSec: .c
|
|
LastSec: .c
|
|
VAddr: 0x600000
|
|
Sections:
|
|
- Name: .a
|
|
Type: SHT_PROGBITS
|
|
Flags: [ SHF_ALLOC ]
|
|
Content: 00
|
|
AddressAlign: 0x1
|
|
Address: 0x400000
|
|
- Name: .b
|
|
Type: SHT_PROGBITS
|
|
Flags: [ SHF_ALLOC ]
|
|
Content: 00
|
|
AddressAlign: 0x1
|
|
Address: 0x0
|
|
- Name: .c
|
|
Type: SHT_PROGBITS
|
|
Flags: [ SHF_ALLOC ]
|
|
Content: 00
|
|
AddressAlign: 0x1
|
|
Address: 0x600000
|
|
...
|