llvm-project/lld/test/mach-o/bind-opcodes.yaml
Jez Ng 415c0cd698 [lld-macho] Switch default to new Darwin backend
The new Darwin backend for LLD is now able to link reasonably large
real-world programs on x86_64. For instance, we have achieved
self-hosting for the X86_64 target, where all LLD tests pass when
building lld with itself on macOS. As such, we would like to make it the
default back-end.

The new port is now named `ld64.lld`, and the old port remains
accessible as `ld64.lld.darwinold`

This [annoucement email][1] has some context. (But note that, unlike
what the email says, we are no longer doing this as part of the LLVM 12
branch cut -- instead we will go into LLVM 13.)

Numerous mechanical test changes were required to make this change; in
the interest of creating something that's reviewable on Phabricator,
I've split out the boring changes into a separate diff (D95905). I plan to
merge its contents with those in this diff before landing.

(@gkm made the original draft of this diff, and he has agreed to let me
take over.)

[1]: https://lists.llvm.org/pipermail/llvm-dev/2021-January/147665.html

Reviewed By: #lld-macho, thakis

Differential Revision: https://reviews.llvm.org/D95204
2021-03-01 12:30:10 -05:00

140 lines
5.0 KiB
YAML

# RUN: ld64.lld.darwinold -arch arm64 %s %p/Inputs/hello-world-arm64.yaml -o %t
# RUN: obj2yaml %t | FileCheck %s
#
--- !mach-o
arch: arm64
file-type: MH_OBJECT
flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ]
sections:
- segment: __TEXT
section: __text
type: S_REGULAR
attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
alignment: 2
address: 0x0000000000000000
content: [ 0xFD, 0x7B, 0xBF, 0xA9, 0xFD, 0x03, 0x00, 0x91,
0x08, 0x00, 0x00, 0x90, 0x08, 0x01, 0x40, 0xF9,
0x00, 0x01, 0x40, 0xF9, 0x01, 0x00, 0x00, 0x90,
0x21, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x94,
0x00, 0x00, 0x80, 0x52, 0xFD, 0x7B, 0xC1, 0xA8,
0xC0, 0x03, 0x5F, 0xD6 ]
relocations:
- offset: 0x0000001C
type: ARM64_RELOC_BRANCH26
length: 2
pc-rel: true
extern: true
symbol: 5
- offset: 0x00000018
type: ARM64_RELOC_PAGEOFF12
length: 2
pc-rel: false
extern: true
symbol: 1
- offset: 0x00000014
type: ARM64_RELOC_PAGE21
length: 2
pc-rel: true
extern: true
symbol: 1
- offset: 0x0000000C
type: ARM64_RELOC_GOT_LOAD_PAGEOFF12
length: 2
pc-rel: false
extern: true
symbol: 4
- offset: 0x00000008
type: ARM64_RELOC_GOT_LOAD_PAGE21
length: 2
pc-rel: true
extern: true
symbol: 4
- segment: __TEXT
section: __cstring
type: S_CSTRING_LITERALS
attributes: [ ]
address: 0x000000000000002C
content: [ 0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x0A, 0x00 ]
local-symbols:
- name: ltmp0
type: N_SECT
sect: 1
value: 0x0000000000000000
- name: l_.str
type: N_SECT
sect: 2
value: 0x000000000000002C
- name: ltmp1
type: N_SECT
sect: 2
value: 0x000000000000002C
global-symbols:
- name: _main
type: N_SECT
scope: [ N_EXT ]
sect: 1
value: 0x0000000000000000
undefined-symbols:
- name: ___stdoutp
type: N_UNDF
scope: [ N_EXT ]
value: 0x0000000000000000
- name: _fprintf
type: N_UNDF
scope: [ N_EXT ]
value: 0x0000000000000000
...
# CHECK: BindOpcodes:
# CHECK: - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
# CHECK: Imm: 1
# CHECK: Symbol: ''
# CHECK: - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
# CHECK: Imm: 0
# CHECK: Symbol: dyld_stub_binder
# CHECK: - Opcode: BIND_OPCODE_SET_TYPE_IMM
# CHECK: Imm: 1
# CHECK: Symbol: ''
# CHECK: - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
# CHECK: Imm: 2
# CHECK: ULEBExtraData: [ 0x0 ]
# CHECK: Symbol: ''
# CHECK: - Opcode: BIND_OPCODE_DO_BIND
# CHECK: Imm: 0
# CHECK: Symbol: ''
# CHECK: - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
# CHECK: Imm: 0
# CHECK: Symbol: ___stdoutp
# CHECK: - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
# CHECK: Imm: 2
# CHECK: ULEBExtraData: [ 0x10 ]
# CHECK: Symbol: ''
# CHECK: - Opcode: BIND_OPCODE_DO_BIND
# CHECK: Imm: 0
# CHECK: Symbol: ''
# CHECK: - Opcode: BIND_OPCODE_DONE
# CHECK: Imm: 0
# CHECK: Symbol: ''
# CHECK: LazyBindOpcodes:
# CHECK: - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
# CHECK: Imm: 2
# CHECK: ULEBExtraData: [ 0x18 ]
# CHECK: Symbol: ''
# CHECK: - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
# CHECK: Imm: 1
# CHECK: Symbol: ''
# CHECK: - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
# CHECK: Imm: 0
# CHECK: Symbol: _fprintf
# CHECK: - Opcode: BIND_OPCODE_DO_BIND
# CHECK: Imm: 0
# CHECK: Symbol: ''
# CHECK: - Opcode: BIND_OPCODE_DONE
# CHECK: Imm: 0
# CHECK: Symbol: ''
# CHECK: - Opcode: BIND_OPCODE_DONE
# CHECK: Imm: 0
# CHECK: Symbol: ''