mirror of
https://github.com/RPCS3/llvm.git
synced 2026-01-31 01:25:19 +01:00
yaml2obj currently derives the p_filesz, p_memsz, and p_offset values of program headers from their sections. This makes writing tests for certain formats more complex, and sometimes impossible. This patch allows setting these fields explicitly, overriding the default value, when relevant. Reviewed by: jakehehrlich, Higuoxing Differential Revision: https://reviews.llvm.org/D59372 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356247 91177308-0d34-0410-b5e6-96231b3b80d8
86 lines
1.9 KiB
YAML
86 lines
1.9 KiB
YAML
# Show that yaml2obj properly emits program headers with explicit file size,
|
|
# memory size and offset parameters.
|
|
|
|
# RUN: yaml2obj %s -o %t
|
|
# RUN: llvm-readobj %t --program-headers | FileCheck %s
|
|
|
|
# CHECK: ProgramHeaders [
|
|
# CHECK: Offset: 0x1234
|
|
# CHECK: FileSize: 1111
|
|
# CHECK: MemSize: 9999
|
|
|
|
# CHECK: Offset: 0x2000
|
|
# CHECK: FileSize: 6
|
|
# CHECK: MemSize: 6
|
|
|
|
# CHECK: Offset: 0x2000
|
|
# CHECK: FileSize: 4
|
|
# CHECK: MemSize: 6
|
|
|
|
# CHECK: Offset: 0x1FFF
|
|
# CHECK: FileSize: 5
|
|
# CHECK: MemSize: 5
|
|
|
|
# CHECK: Offset: 0xFFE
|
|
# CHECK: FileSize: 7
|
|
# CHECK: MemSize: 9
|
|
|
|
# CHECK: Offset: 0x3000
|
|
# CHECK: FileSize: 3
|
|
# CHECK: MemSize: 2
|
|
# CHECK: ]
|
|
|
|
!ELF
|
|
FileHeader:
|
|
Class: ELFCLASS64
|
|
Data: ELFDATA2LSB
|
|
Type: ET_EXEC
|
|
Machine: EM_X86_64
|
|
Sections:
|
|
- Name: .text
|
|
Type: SHT_PROGBITS
|
|
Size: 4
|
|
AddressAlign: 0x1000
|
|
- Name: .rodata
|
|
Type: SHT_PROGBITS
|
|
Size: 4
|
|
AddressAlign: 0x1000
|
|
- Name: .data
|
|
Type: SHT_PROGBITS
|
|
Size: 4
|
|
ProgramHeaders:
|
|
# Program header with no sections.
|
|
- Type: 0x6abcdef0 # arbitrary type
|
|
Offset: 0x1234
|
|
FileSize: 1111
|
|
MemSize: 9999
|
|
# Program header with only file size set.
|
|
- Type: 0x6abcdef0
|
|
FileSize: 6
|
|
Sections:
|
|
- Section: .rodata
|
|
# Program header with only mem size set.
|
|
- Type: 0x6abcdef0
|
|
MemSize: 6
|
|
Sections:
|
|
- Section: .rodata
|
|
# Program header with only offset set.
|
|
- Type: 0x6abcdef0
|
|
Offset: 0x1fff
|
|
Sections:
|
|
- Section: .rodata
|
|
# Program header with sections, valid properties.
|
|
- Type: 0x6abcdef0
|
|
Offset: 0xffe
|
|
FileSize: 7
|
|
MemSize: 9
|
|
Sections:
|
|
- Section: .text
|
|
# Program header with sections, invalid properties.
|
|
- Type: 0x6abcdef0
|
|
Offset: 0x3000
|
|
FileSize: 3
|
|
MemSize: 2
|
|
Sections:
|
|
- Section: .data
|