2015-08-05 23:08:40 +08:00
|
|
|
# RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %s -o %t
|
2015-11-18 14:11:01 +08:00
|
|
|
# RUN: ld.lld %t -o %t2
|
2015-08-05 23:08:40 +08:00
|
|
|
# RUN: llvm-readobj -file-headers -sections -program-headers %t2 | FileCheck %s
|
|
|
|
# REQUIRES: x86
|
|
|
|
|
|
|
|
# exits with return code 42 on linux
|
|
|
|
.globl _start;
|
|
|
|
_start:
|
|
|
|
mov $1, %eax
|
|
|
|
mov $42, %ebx
|
|
|
|
int $0x80
|
|
|
|
|
|
|
|
# CHECK: ElfHeader {
|
|
|
|
# CHECK-NEXT: Ident {
|
|
|
|
# CHECK-NEXT: Magic: (7F 45 4C 46)
|
|
|
|
# CHECK-NEXT: Class: 32-bit (0x1)
|
|
|
|
# CHECK-NEXT: DataEncoding: LittleEndian (0x1)
|
|
|
|
# CHECK-NEXT: FileVersion: 1
|
|
|
|
# CHECK-NEXT: OS/ABI: SystemV (0x0)
|
|
|
|
# CHECK-NEXT: ABIVersion: 0
|
|
|
|
# CHECK-NEXT: Unused: (00 00 00 00 00 00 00)
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: Type: Executable (0x2)
|
|
|
|
# CHECK-NEXT: Machine: EM_386 (0x3)
|
|
|
|
# CHECK-NEXT: Version: 1
|
2015-09-10 23:41:34 +08:00
|
|
|
# CHECK-NEXT: Entry: 0x11000
|
2015-08-05 23:08:40 +08:00
|
|
|
# CHECK-NEXT: ProgramHeaderOffset: 0x34
|
2015-11-04 05:35:14 +08:00
|
|
|
# CHECK-NEXT: SectionHeaderOffset: 0x1058
|
2015-08-05 23:08:40 +08:00
|
|
|
# CHECK-NEXT: Flags [ (0x0)
|
|
|
|
# CHECK-NEXT: ]
|
|
|
|
# CHECK-NEXT: HeaderSize: 52
|
|
|
|
# CHECK-NEXT: ProgramHeaderEntrySize: 32
|
2015-11-15 04:56:08 +08:00
|
|
|
# CHECK-NEXT: ProgramHeaderCount: 4
|
2015-08-05 23:08:40 +08:00
|
|
|
# CHECK-NEXT: SectionHeaderEntrySize: 40
|
2015-11-04 05:35:14 +08:00
|
|
|
# CHECK-NEXT: SectionHeaderCount: 5
|
|
|
|
# CHECK-NEXT: StringTableSectionIndex: 3
|
2015-08-05 23:08:40 +08:00
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: Sections [
|
|
|
|
# CHECK-NEXT: Section {
|
|
|
|
# CHECK-NEXT: Index: 0
|
|
|
|
# CHECK-NEXT: Name: (0)
|
|
|
|
# CHECK-NEXT: Type: SHT_NULL (0x0)
|
|
|
|
# CHECK-NEXT: Flags [ (0x0)
|
|
|
|
# CHECK-NEXT: ]
|
|
|
|
# CHECK-NEXT: Address: 0x0
|
|
|
|
# CHECK-NEXT: Offset: 0x0
|
|
|
|
# CHECK-NEXT: Size: 0
|
|
|
|
# CHECK-NEXT: Link: 0
|
|
|
|
# CHECK-NEXT: Info: 0
|
|
|
|
# CHECK-NEXT: AddressAlignment: 0
|
|
|
|
# CHECK-NEXT: EntrySize: 0
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: Section {
|
|
|
|
# CHECK-NEXT: Index: 1
|
2015-10-02 05:15:02 +08:00
|
|
|
# CHECK-NEXT: Name: .text
|
|
|
|
# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
|
|
|
|
# CHECK-NEXT: Flags [ (0x6)
|
2015-08-05 23:08:40 +08:00
|
|
|
# CHECK-NEXT: SHF_ALLOC (0x2)
|
2015-10-02 05:15:02 +08:00
|
|
|
# CHECK-NEXT: SHF_EXECINSTR (0x4)
|
2015-08-05 23:08:40 +08:00
|
|
|
# CHECK-NEXT: ]
|
2015-09-10 23:41:34 +08:00
|
|
|
# CHECK-NEXT: Address: 0x11000
|
2015-08-05 23:08:40 +08:00
|
|
|
# CHECK-NEXT: Offset: 0x1000
|
2015-10-02 05:15:02 +08:00
|
|
|
# CHECK-NEXT: Size: 12
|
2015-08-05 23:08:40 +08:00
|
|
|
# CHECK-NEXT: Link: 0
|
|
|
|
# CHECK-NEXT: Info: 0
|
2015-08-14 04:13:39 +08:00
|
|
|
# CHECK-NEXT: AddressAlignment: 4
|
2015-08-05 23:08:40 +08:00
|
|
|
# CHECK-NEXT: EntrySize: 0
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: Section {
|
|
|
|
# CHECK-NEXT: Index: 2
|
2015-08-14 10:42:20 +08:00
|
|
|
# CHECK-NEXT: Name: .symtab
|
|
|
|
# CHECK-NEXT: Type: SHT_SYMTAB
|
|
|
|
# CHECK-NEXT: Flags [
|
|
|
|
# CHECK-NEXT: ]
|
|
|
|
# CHECK-NEXT: Address: 0x0
|
|
|
|
# CHECK-NEXT: Offset: 0x100C
|
2015-08-14 21:07:05 +08:00
|
|
|
# CHECK-NEXT: Size: 32
|
2015-11-04 05:35:14 +08:00
|
|
|
# CHECK-NEXT: Link: 4
|
2015-08-14 10:42:20 +08:00
|
|
|
# CHECK-NEXT: Info: 1
|
|
|
|
# CHECK-NEXT: AddressAlignment: 4
|
|
|
|
# CHECK-NEXT: EntrySize: 16
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: Section {
|
2015-11-04 05:35:14 +08:00
|
|
|
# CHECK-NEXT: Index: 3
|
2015-10-21 01:21:35 +08:00
|
|
|
# CHECK-NEXT: Name: .shstrtab
|
2015-08-12 08:00:24 +08:00
|
|
|
# CHECK-NEXT: Type: SHT_STRTAB (0x3)
|
|
|
|
# CHECK-NEXT: Flags [ (0x0)
|
|
|
|
# CHECK-NEXT: ]
|
|
|
|
# CHECK-NEXT: Address: 0x0
|
2015-08-14 21:07:05 +08:00
|
|
|
# CHECK-NEXT: Offset: 0x102C
|
2015-11-04 05:35:14 +08:00
|
|
|
# CHECK-NEXT: Size: 33
|
2015-10-21 01:21:35 +08:00
|
|
|
# CHECK-NEXT: Link: 0
|
|
|
|
# CHECK-NEXT: Info: 0
|
|
|
|
# CHECK-NEXT: AddressAlignment: 1
|
|
|
|
# CHECK-NEXT: EntrySize: 0
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: Section {
|
2015-11-04 05:35:14 +08:00
|
|
|
# CHECK-NEXT: Index: 4
|
|
|
|
# CHECK-NEXT: Name: .strtab (17)
|
2015-10-21 01:21:35 +08:00
|
|
|
# CHECK-NEXT: Type: SHT_STRTAB (0x3)
|
|
|
|
# CHECK-NEXT: Flags [ (0x0)
|
|
|
|
# CHECK-NEXT: ]
|
|
|
|
# CHECK-NEXT: Address: 0x0
|
2015-11-04 05:35:14 +08:00
|
|
|
# CHECK-NEXT: Offset: 0x104D
|
2015-10-21 01:21:35 +08:00
|
|
|
# CHECK-NEXT: Size: 8
|
2015-08-12 08:00:24 +08:00
|
|
|
# CHECK-NEXT: Link: 0
|
|
|
|
# CHECK-NEXT: Info: 0
|
|
|
|
# CHECK-NEXT: AddressAlignment: 1
|
|
|
|
# CHECK-NEXT: EntrySize: 0
|
|
|
|
# CHECK-NEXT: }
|
2015-08-05 23:08:40 +08:00
|
|
|
# CHECK-NEXT: ]
|
|
|
|
# CHECK-NEXT: ProgramHeaders [
|
|
|
|
# CHECK-NEXT: ProgramHeader {
|
2015-10-09 23:31:49 +08:00
|
|
|
# CHECK-NEXT: Type: PT_PHDR (0x6)
|
|
|
|
# CHECK-NEXT: Offset: 0x34
|
|
|
|
# CHECK-NEXT: VirtualAddress: 0x10034
|
|
|
|
# CHECK-NEXT: PhysicalAddress: 0x10034
|
2015-11-15 04:56:08 +08:00
|
|
|
# CHECK-NEXT: FileSize: 128
|
|
|
|
# CHECK-NEXT: MemSize: 128
|
2015-10-09 23:31:49 +08:00
|
|
|
# CHECK-NEXT: Flags [ (0x4)
|
|
|
|
# CHECK-NEXT: PF_R (0x4)
|
|
|
|
# CHECK-NEXT: ]
|
|
|
|
# CHECK-NEXT: Alignment: 8
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: ProgramHeader {
|
2015-08-05 23:08:40 +08:00
|
|
|
# CHECK-NEXT: Type: PT_LOAD (0x1)
|
2015-09-10 23:41:34 +08:00
|
|
|
# CHECK-NEXT: Offset: 0x0
|
2015-09-10 06:53:55 +08:00
|
|
|
# CHECK-NEXT: VirtualAddress: 0x10000
|
|
|
|
# CHECK-NEXT: PhysicalAddress: 0x10000
|
2015-11-15 04:56:08 +08:00
|
|
|
# CHECK-NEXT: FileSize: 180
|
|
|
|
# CHECK-NEXT: MemSize: 180
|
2015-09-10 23:41:34 +08:00
|
|
|
# CHECK-NEXT: Flags [
|
|
|
|
# CHECK-NEXT: PF_R
|
|
|
|
# CHECK-NEXT: ]
|
|
|
|
# CHECK-NEXT: Alignment: 4096
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: ProgramHeader {
|
|
|
|
# CHECK-NEXT: Type: PT_LOAD (0x1)
|
|
|
|
# CHECK-NEXT: Offset: 0x1000
|
|
|
|
# CHECK-NEXT: VirtualAddress: 0x11000
|
|
|
|
# CHECK-NEXT: PhysicalAddress: 0x11000
|
2015-09-10 04:48:09 +08:00
|
|
|
# CHECK-NEXT: FileSize: 12
|
|
|
|
# CHECK-NEXT: MemSize: 12
|
2015-08-05 23:08:40 +08:00
|
|
|
# CHECK-NEXT: Flags [ (0x5)
|
|
|
|
# CHECK-NEXT: PF_R (0x4)
|
|
|
|
# CHECK-NEXT: PF_X (0x1)
|
|
|
|
# CHECK-NEXT: ]
|
2015-09-10 04:48:09 +08:00
|
|
|
# CHECK-NEXT: Alignment: 4096
|
2015-08-05 23:08:40 +08:00
|
|
|
# CHECK-NEXT: }
|
2015-11-15 04:56:08 +08:00
|
|
|
# CHECK-NEXT: ProgramHeader {
|
|
|
|
# CHECK-NEXT: Type: PT_GNU_STACK
|
|
|
|
# CHECK-NEXT: Offset: 0x0
|
|
|
|
# CHECK-NEXT: VirtualAddress: 0x0
|
|
|
|
# CHECK-NEXT: PhysicalAddress: 0x0
|
|
|
|
# CHECK-NEXT: FileSize: 0
|
|
|
|
# CHECK-NEXT: MemSize: 0
|
|
|
|
# CHECK-NEXT: Flags [
|
|
|
|
# CHECK-NEXT: PF_R
|
|
|
|
# CHECK-NEXT: PF_W
|
|
|
|
# CHECK-NEXT: ]
|
|
|
|
# CHECK-NEXT: Alignment: 0
|
|
|
|
# CHECK-NEXT: }
|
2015-08-05 23:08:40 +08:00
|
|
|
# CHECK-NEXT: ]
|