llvm-project/lld/test/mach-o/hello-world-x86_64.yaml

120 lines
4.3 KiB
YAML

# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/hello-world-x86_64.yaml \
# RUN: -o %t
# RUN: llvm-nm -m -n %t | FileCheck %s
#
# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/hello-world-x86_64.yaml \
# RUN: -dead_strip -o %t2
# RUN: llvm-nm -m -n %t2 | FileCheck %s
#
# Test that x86_64 hello-world can be linked into a mach-o executable
#
--- !mach-o
arch: x86_64
file-type: MH_OBJECT
flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ]
has-UUID: false
OS: unknown
sections:
- segment: __TEXT
section: __text
type: S_REGULAR
attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
address: 0x0000000000000000
content: [ 0x55, 0x48, 0x89, 0xE5, 0x48, 0x8B, 0x05, 0x00,
0x00, 0x00, 0x00, 0x48, 0x8B, 0x38, 0x48, 0x8D,
0x35, 0x00, 0x00, 0x00, 0x00, 0x31, 0xC0, 0xE8,
0x00, 0x00, 0x00, 0x00, 0x31, 0xC0, 0x5D, 0xC3 ]
relocations:
- offset: 0x00000018
type: X86_64_RELOC_BRANCH
length: 2
pc-rel: true
extern: true
symbol: 5
- offset: 0x00000011
type: X86_64_RELOC_SIGNED
length: 2
pc-rel: true
extern: true
symbol: 0
- offset: 0x00000007
type: X86_64_RELOC_GOT_LOAD
length: 2
pc-rel: true
extern: true
symbol: 4
- segment: __TEXT
section: __cstring
type: S_CSTRING_LITERALS
attributes: [ ]
address: 0x0000000000000020
content: [ 0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x0A, 0x00 ]
- segment: __LD
section: __compact_unwind
type: S_REGULAR
attributes: [ ]
alignment: 3
address: 0x0000000000000028
content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
relocations:
- offset: 0x00000000
type: X86_64_RELOC_UNSIGNED
length: 3
pc-rel: false
extern: false
symbol: 1
- segment: __TEXT
section: __eh_frame
type: S_COALESCED
attributes: [ ]
alignment: 3
address: 0x0000000000000048
content: [ 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x7A, 0x52, 0x00, 0x01, 0x78, 0x10, 0x01,
0x10, 0x0C, 0x07, 0x08, 0x90, 0x01, 0x00, 0x00,
0x24, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00,
0x98, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x41, 0x0E, 0x10, 0x86, 0x02, 0x43, 0x0D,
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
local-symbols:
- name: L1
type: N_SECT
sect: 2
value: 0x0000000000000020
- name: EH_frame0
type: N_SECT
sect: 4
value: 0x0000000000000048
global-symbols:
- name: _main
type: N_SECT
scope: [ N_EXT ]
sect: 1
value: 0x0000000000000000
- name: _main.eh
type: N_SECT
scope: [ N_EXT ]
sect: 4
value: 0x0000000000000060
undefined-symbols:
- name: ___stdoutp
type: N_UNDF
scope: [ N_EXT ]
value: 0x0000000000000000
- name: _fprintf
type: N_UNDF
scope: [ N_EXT ]
value: 0x0000000000000000
...
# CHECK: {{[0-9a-f]+}} (__TEXT,__text) external _main
# CHECK: (undefined) external ___stdoutp (from libSystem)
# CHECK: (undefined) external _fprintf (from libSystem)
# CHECK: (undefined) external dyld_stub_binder (from libSystem)