diff options
Diffstat (limited to 'llvm/test/tools/yaml2obj/ELF/program-header-size-offset.yaml')
-rw-r--r-- | llvm/test/tools/yaml2obj/ELF/program-header-size-offset.yaml | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/llvm/test/tools/yaml2obj/ELF/program-header-size-offset.yaml b/llvm/test/tools/yaml2obj/ELF/program-header-size-offset.yaml new file mode 100644 index 00000000000..a2f727dab5f --- /dev/null +++ b/llvm/test/tools/yaml2obj/ELF/program-header-size-offset.yaml @@ -0,0 +1,108 @@ +## 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: 4 + +# 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: Offset: 0x2004 +# CHECK: FileSize: 4 +# CHECK: MemSize: 6 +# CHECK: ] + +!ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS + Size: 4 + ShOffset: 0x1000 + AddressAlign: 0x1000 + - Name: .rodata + Type: SHT_PROGBITS + Size: 4 + ShOffset: 0x2000 + AddressAlign: 0x1000 + - Name: .data + Type: SHT_PROGBITS + ShOffset: 0x2004 + Size: 4 + - Name: .nobits1 + Type: SHT_NOBITS + ShOffset: 0x2008 + Size: 1 + - Name: .nobits2 + Type: SHT_NOBITS + # Intentionally set to 0x2009 though the previous section is SHT_NOBITS. + ShOffset: 0x2009 + Size: 1 +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 + # Program header with 2 SHT_NOBITS sections. + - Type: 0x6abcdef0 + Offset: 0x2004 + Sections: + - Section: .data + - Section: .nobits1 + - Section: .nobits2 |