Changeset View
Standalone View
llvm/test/Object/objdump-no-sectionheaders.test
; RUN: llvm-objdump -h %p/Inputs/no-sections.elf-x86-64 \ | ## This test checks llvm-objdump -h can handle ELF files without section info. | |||||||||
; RUN: | FileCheck %s | ## Only PT_LOAD segments with the PF_X flag will be displayed as fake sections. | |||||||||
jhendersonUnsubmitted Not Done ReplyInline Actions
jhenderson: | ||||||||||
ok namhyung: ok | ||||||||||
Not Done ReplyInline Actions
I misread this sentence. Here's a better improvement. jhenderson: I misread this sentence. Here's a better improvement. | ||||||||||
Not Done ReplyInline ActionsNit: "This test " can be omitted. Use an imperative sentence. MaskRay: Nit: "This test " can be omitted. Use an imperative sentence. | ||||||||||
Not Done ReplyInline ActionsConcretely: "Check llvm-objdump -h ..." jhenderson: Concretely: "Check llvm-objdump -h ..." | ||||||||||
; CHECK: Sections: | # RUN: yaml2obj %s -o %t | |||||||||
; CHECK-NEXT: Idx Name Size VMA Type | # RUN: llvm-objdump -h %t | FileCheck %s | |||||||||
; CHECK-NEXT: 0 000006ec 0000000000400000 TEXT | ||||||||||
; CHECK-NEXT: 1 00000000 0000000000000000 TEXT | # CHECK: Sections: | |||||||||
; CHECK-NOT: {{.}} | # CHECK-NEXT: Idx Name Size VMA Type | |||||||||
# CHECK-NEXT: 0 PT_LOAD#1 00000100 0000000000400000 TEXT | ||||||||||
# CHECK-NEXT: 1 PT_LOAD#3 00000200 0000000000600400 TEXT | ||||||||||
# CHECK-NOT: {{.}} | ||||||||||
!ELF | ||||||||||
FileHeader: | ||||||||||
Class: ELFCLASS64 | ||||||||||
Data: ELFDATA2LSB | ||||||||||
Type: ET_CORE | ||||||||||
Machine: EM_X86_64 | ||||||||||
Sections: | ||||||||||
- Type: SectionHeaderTable | ||||||||||
NoHeaders: true | ||||||||||
- Type: Fill | ||||||||||
Not Done ReplyInline ActionsI think I see a potential problem here, which could explain the problem you're seeing: you haven't specified any contents or explicit offsets of any of these program headers, which may mean that even though they have addresses specified, they'll start at the same offset within the file. This might result in something bad such as only the one section appearing in the output, although I don't know the llvm-objdump code well enough to be certain. jhenderson: I think I see a potential problem here, which could explain the problem you're seeing: you… | ||||||||||
Will check with contents and offsets. namhyung: Will check with contents and offsets. | ||||||||||
Not Done ReplyInline ActionsThe Offset will physically impact the size of the file on disk, meaning this generated YAML file will be huge. Instead, use offset values around 0x100 - 0x200, which are significantly smaller (and adjust the addresses to line up too, I recommend) (you can't use 0 because of the ELF header and Program Header table). Also, the sizes of the individual blobs of data can be only a couple of bytes for the test purposes to be satisfied. jhenderson: The `Offset` will physically impact the size of the file on disk, meaning this generated YAML… | ||||||||||
Name: code1 | ||||||||||
Pattern: "cc" | ||||||||||
Size: 0x100 | ||||||||||
Offset: 0x200 | ||||||||||
- Type: Fill | ||||||||||
Name: data1 | ||||||||||
Pattern: "aa55" | ||||||||||
Size: 0x100 | ||||||||||
Offset: 0x300 | ||||||||||
- Type: Fill | ||||||||||
Name: code2 | ||||||||||
Pattern: "ff" | ||||||||||
Size: 0x200 | ||||||||||
Offset: 0x400 | ||||||||||
ProgramHeaders: | ||||||||||
- Type: PT_PHDR | ||||||||||
Flags: [ PF_X ] | ||||||||||
VAddr: 0x400000 | ||||||||||
MemSize: 0x100 | ||||||||||
- Type: PT_LOAD | ||||||||||
Flags: [ PF_X ] | ||||||||||
VAddr: 0x400000 | ||||||||||
MemSize: 0x100 | ||||||||||
FirstSec: code1 | ||||||||||
LastSec: code1 | ||||||||||
- Type: PT_LOAD | ||||||||||
Flags: [ PF_R ] | ||||||||||
VAddr: 0x500300 | ||||||||||
MemSize: 0x100 | ||||||||||
FirstSec: data1 | ||||||||||
LastSec: data1 | ||||||||||
- Type: PT_LOAD | ||||||||||
Flags: [ PF_R, PF_X ] | ||||||||||
VAddr: 0x600400 | ||||||||||
MemSize: 0x200 | ||||||||||
FirstSec: code2 | ||||||||||
LastSec: code2 | ||||||||||
Not Done ReplyInline ActionsI'd strongly support replacing the pre-canned ELF with a YAML input in this test. At the moment, I have no idea if the behaviour is correct without digging out a binary inspection tool to look at the ELF object. Some key characteristics I think that need testing:
To achieve these points, I think it would be sufficient to have an ELF with the following program headers:
jhenderson: I'd strongly support replacing the pre-canned ELF with a YAML input in this test. At the moment… | ||||||||||
Not Done ReplyInline ActionsSounds good! namhyung: Sounds good! |