2015-09-26 08:32:04 +08:00
|
|
|
# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-freebsd %s -o %t
|
2015-11-18 14:11:01 +08:00
|
|
|
# RUN: ld.lld %t -o %t2
|
2015-09-26 08:43:49 +08:00
|
|
|
# RUN: llvm-readobj -file-headers -sections -program-headers -symbols %t2 \
|
2015-09-26 08:32:04 +08:00
|
|
|
# RUN: | FileCheck %s
|
2015-09-28 20:22:25 +08:00
|
|
|
# REQUIRES: aarch64
|
2015-09-26 08:32:04 +08:00
|
|
|
|
|
|
|
# exits with return code 42 on FreeBSD/AArch64
|
2016-04-27 10:58:27 +08:00
|
|
|
.globl _start
|
2015-09-26 08:32:04 +08:00
|
|
|
_start:
|
|
|
|
mov x0, 42
|
|
|
|
mov x8, 1
|
|
|
|
svc 0
|
|
|
|
|
|
|
|
# CHECK: ElfHeader {
|
|
|
|
# CHECK-NEXT: Ident {
|
|
|
|
# CHECK-NEXT: Magic: (7F 45 4C 46)
|
|
|
|
# CHECK-NEXT: Class: 64-bit (0x2)
|
|
|
|
# CHECK-NEXT: DataEncoding: LittleEndian (0x1)
|
|
|
|
# CHECK-NEXT: FileVersion: 1
|
|
|
|
# CHECK-NEXT: OS/ABI: FreeBSD (0x9)
|
|
|
|
# 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_AARCH64 (0xB7)
|
|
|
|
# CHECK-NEXT: Version: 1
|
|
|
|
# CHECK-NEXT: Entry: [[ENTRY:0x[0-9A-F]+]]
|
|
|
|
# CHECK-NEXT: ProgramHeaderOffset: 0x40
|
2015-11-04 05:35:14 +08:00
|
|
|
# CHECK-NEXT: SectionHeaderOffset: 0x1088
|
2015-09-26 08:32:04 +08:00
|
|
|
# CHECK-NEXT: Flags [ (0x0)
|
|
|
|
# CHECK-NEXT: ]
|
|
|
|
# CHECK-NEXT: HeaderSize: 64
|
|
|
|
# CHECK-NEXT: ProgramHeaderEntrySize: 56
|
2015-11-25 02:48:16 +08:00
|
|
|
# CHECK-NEXT: ProgramHeaderCount: 4
|
2015-09-26 08:32:04 +08:00
|
|
|
# CHECK-NEXT: SectionHeaderEntrySize: 64
|
2015-11-04 05:35:14 +08:00
|
|
|
# CHECK-NEXT: SectionHeaderCount: 5
|
|
|
|
# CHECK-NEXT: StringTableSectionIndex: 3
|
2015-09-26 08:32:04 +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-09-26 08:32:04 +08:00
|
|
|
# CHECK-NEXT: SHF_ALLOC (0x2)
|
2015-10-02 05:15:02 +08:00
|
|
|
# CHECK-NEXT: SHF_EXECINSTR (0x4)
|
2015-09-26 08:32:04 +08:00
|
|
|
# CHECK-NEXT: ]
|
2015-10-14 02:50:28 +08:00
|
|
|
# CHECK-NEXT: Address: 0x11000
|
2015-09-26 08:32:04 +08:00
|
|
|
# CHECK-NEXT: Offset: 0x1000
|
2015-10-02 05:15:02 +08:00
|
|
|
# CHECK-NEXT: Size: 12
|
2015-09-26 08:32:04 +08:00
|
|
|
# CHECK-NEXT: Link: 0
|
|
|
|
# CHECK-NEXT: Info: 0
|
|
|
|
# CHECK-NEXT: AddressAlignment: 4
|
|
|
|
# CHECK-NEXT: EntrySize: 0
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: Section {
|
|
|
|
# CHECK-NEXT: Index: 2
|
|
|
|
# CHECK-NEXT: Name: .symtab
|
|
|
|
# CHECK-NEXT: Type: SHT_SYMTAB (0x2)
|
|
|
|
# CHECK-NEXT: Flags [ (0x0)
|
|
|
|
# CHECK-NEXT: ]
|
|
|
|
# CHECK-NEXT: Address: 0x0
|
|
|
|
# CHECK-NEXT: Offset: 0x1010
|
|
|
|
# CHECK-NEXT: Size: 72
|
2015-11-04 05:35:14 +08:00
|
|
|
# CHECK-NEXT: Link: 4
|
2015-09-26 08:32:04 +08:00
|
|
|
# CHECK-NEXT: Info: 2
|
|
|
|
# CHECK-NEXT: AddressAlignment: 8
|
|
|
|
# CHECK-NEXT: EntrySize: 24
|
2015-10-21 01:21:35 +08:00
|
|
|
# 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-09-26 08:32:04 +08:00
|
|
|
# CHECK-NEXT: Type: SHT_STRTAB (0x3)
|
|
|
|
# CHECK-NEXT: Flags [ (0x0)
|
|
|
|
# CHECK-NEXT: ]
|
|
|
|
# CHECK-NEXT: Address: 0x0
|
|
|
|
# CHECK-NEXT: Offset: 0x1058
|
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
|
2016-01-07 10:35:32 +08:00
|
|
|
# CHECK-NEXT: Name: .strtab (25)
|
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: 0x1079
|
2015-10-21 01:21:35 +08:00
|
|
|
# CHECK-NEXT: Size: 13
|
2015-09-26 08:32:04 +08:00
|
|
|
# CHECK-NEXT: Link: 0
|
|
|
|
# CHECK-NEXT: Info: 0
|
|
|
|
# CHECK-NEXT: AddressAlignment: 1
|
|
|
|
# CHECK-NEXT: EntrySize: 0
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: ]
|
|
|
|
# CHECK-NEXT: Symbols [
|
|
|
|
# CHECK-NEXT: Symbol {
|
|
|
|
# CHECK-NEXT: Name: (0)
|
|
|
|
# CHECK-NEXT: Value: 0x0
|
|
|
|
# CHECK-NEXT: Size: 0
|
|
|
|
# CHECK-NEXT: Binding: Local (0x0)
|
|
|
|
# CHECK-NEXT: Type: None (0x0)
|
|
|
|
# CHECK-NEXT: Other: 0
|
|
|
|
# CHECK-NEXT: Section: Undefined (0x0)
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: Symbol {
|
2015-10-21 01:21:35 +08:00
|
|
|
# CHECK-NEXT: Name: $x.0
|
2015-10-14 02:50:28 +08:00
|
|
|
# CHECK-NEXT: Value: 0x11000
|
2015-09-26 08:32:04 +08:00
|
|
|
# CHECK-NEXT: Size: 0
|
|
|
|
# CHECK-NEXT: Binding: Local (0x0)
|
|
|
|
# CHECK-NEXT: Type: None (0x0)
|
|
|
|
# CHECK-NEXT: Other: 0
|
2015-10-02 05:15:02 +08:00
|
|
|
# CHECK-NEXT: Section: .text
|
2015-09-26 08:32:04 +08:00
|
|
|
# CHECK-NEXT: }
|
|
|
|
# CHECK-NEXT: Symbol {
|
2015-10-21 01:21:35 +08:00
|
|
|
# CHECK-NEXT: Name: _start
|
2015-09-26 08:32:04 +08:00
|
|
|
# CHECK-NEXT: Value: [[ENTRY]]
|
|
|
|
# CHECK-NEXT: Size: 0
|
|
|
|
# CHECK-NEXT: Binding: Global (0x1)
|
|
|
|
# CHECK-NEXT: Type: None (0x0)
|
|
|
|
# CHECK-NEXT: Other: 0
|
|
|
|
# CHECK-NEXT: Section: .text
|
|
|
|
# CHECK-NEXT: }
|
|
|
|
# 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: 0x40
|
2015-10-14 02:50:28 +08:00
|
|
|
# CHECK-NEXT: VirtualAddress: 0x10040
|
|
|
|
# CHECK-NEXT: PhysicalAddress: 0x10040
|
2015-11-25 02:48:16 +08:00
|
|
|
# CHECK-NEXT: FileSize: 224
|
|
|
|
# CHECK-NEXT: MemSize: 224
|
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-09-26 08:32:04 +08:00
|
|
|
# CHECK-NEXT: Type: PT_LOAD (0x1)
|
|
|
|
# CHECK-NEXT: Offset: 0x0
|
2015-10-14 02:50:28 +08:00
|
|
|
# CHECK-NEXT: VirtualAddress: 0x10000
|
|
|
|
# CHECK-NEXT: PhysicalAddress: 0x10000
|
2015-11-25 02:48:16 +08:00
|
|
|
# CHECK-NEXT: FileSize: 288
|
|
|
|
# CHECK-NEXT: MemSize: 288
|
2015-09-26 08:32:04 +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
|
2015-10-14 02:50:28 +08:00
|
|
|
# CHECK-NEXT: VirtualAddress: 0x11000
|
|
|
|
# CHECK-NEXT: PhysicalAddress: 0x11000
|
2015-10-02 01:33:36 +08:00
|
|
|
# CHECK-NEXT: FileSize: 12
|
2015-09-26 08:32:04 +08:00
|
|
|
# CHECK-NEXT: MemSize: 12
|
|
|
|
# CHECK-NEXT: Flags [ (0x5)
|
|
|
|
# CHECK-NEXT: PF_R (0x4)
|
|
|
|
# CHECK-NEXT: PF_X (0x1)
|
|
|
|
# CHECK-NEXT: ]
|
|
|
|
# CHECK-NEXT: Alignment: 4096
|
|
|
|
# CHECK-NEXT: }
|
2015-11-25 02:48:16 +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-09-26 08:32:04 +08:00
|
|
|
# CHECK-NEXT: ]
|