zig/deps/lld/test/mach-o/eh-frame-relocs-arm64.yaml

318 lines
13 KiB
YAML

# RUN: lld -flavor darwin -arch arm64 -r -print_atoms %s -o %t | FileCheck %s
# RUN: lld -flavor darwin -arch arm64 -r -print_atoms %t -o %t2 | FileCheck %s
# RUN: llvm-objdump -r -s -section="__eh_frame" -macho %t | FileCheck -check-prefix=CODE %s
# RUN: llvm-objdump -r -s -section="__eh_frame" -macho %t2 | FileCheck -check-prefix=CODE %s
--- !mach-o
arch: arm64
file-type: MH_OBJECT
flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ]
compat-version: 0.0
current-version: 0.0
has-UUID: false
OS: unknown
sections:
- segment: __TEXT
section: __text
type: S_REGULAR
attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
alignment: 4
address: 0x0000000000000000
content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xC0, 0x03, 0x5F, 0xD6, 0xC0, 0x03, 0x5F, 0xD6,
0xC0, 0x03, 0x5F, 0xD6 ]
- segment: __TEXT
section: __gcc_except_tab
type: S_REGULAR
attributes: [ ]
address: 0x0000000000000014
content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
- segment: __DATA
section: __data
type: S_REGULAR
attributes: [ ]
address: 0x000000000000001C
content: [ 0x00, 0x00, 0x00, 0x00 ]
- segment: __LD
section: __compact_unwind
type: S_REGULAR
attributes: [ ]
alignment: 8
address: 0x0000000000000020
content: [ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
relocations:
- offset: 0x00000020
type: ARM64_RELOC_UNSIGNED
length: 3
pc-rel: false
extern: false
symbol: 1
- offset: 0x00000000
type: ARM64_RELOC_UNSIGNED
length: 3
pc-rel: false
extern: false
symbol: 1
- segment: __TEXT
section: __eh_frame
type: S_COALESCED
attributes: [ ]
alignment: 8
address: 0x0000000000000060
content: [ 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x7A, 0x50, 0x4C, 0x52, 0x00, 0x01, 0x78,
0x1E, 0x07, 0x9B, 0xED, 0xFF, 0xFF, 0xFF, 0x10,
0x10, 0x0C, 0x1F, 0x00, 0x28, 0x00, 0x00, 0x00,
0x20, 0x00, 0x00, 0x00, 0xDC, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0xCB, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0E, 0x10, 0x9E,
0x01, 0x9D, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x7A, 0x50, 0x4C, 0x52, 0x00, 0x01, 0x78,
0x1E, 0x07, 0x9B, 0xA9, 0xFF, 0xFF, 0xFF, 0x10,
0x10, 0x0C, 0x1F, 0x00, 0x28, 0x00, 0x00, 0x00,
0x20, 0x00, 0x00, 0x00, 0x94, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x83, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0E, 0x10, 0x9E,
0x01, 0x9D, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 ]
relocations:
- offset: 0x0000007D
type: ARM64_RELOC_SUBTRACTOR
length: 3
pc-rel: false
extern: true
symbol: 6
- offset: 0x0000007D
type: ARM64_RELOC_UNSIGNED
length: 3
pc-rel: false
extern: true
symbol: 3
- offset: 0x0000006C
type: ARM64_RELOC_SUBTRACTOR
length: 3
pc-rel: false
extern: true
symbol: 6
- offset: 0x0000006C
type: ARM64_RELOC_UNSIGNED
length: 3
pc-rel: false
extern: true
symbol: 8
- offset: 0x0000005B
type: ARM64_RELOC_POINTER_TO_GOT
length: 2
pc-rel: true
extern: true
symbol: 10
- offset: 0x00000035
type: ARM64_RELOC_SUBTRACTOR
length: 3
pc-rel: false
extern: true
symbol: 6
- offset: 0x00000035
type: ARM64_RELOC_UNSIGNED
length: 3
pc-rel: false
extern: true
symbol: 2
- offset: 0x00000024
type: ARM64_RELOC_SUBTRACTOR
length: 3
pc-rel: false
extern: true
symbol: 6
- offset: 0x00000024
type: ARM64_RELOC_UNSIGNED
length: 3
pc-rel: false
extern: true
symbol: 7
- offset: 0x00000013
type: ARM64_RELOC_POINTER_TO_GOT
length: 2
pc-rel: true
extern: true
symbol: 9
local-symbols:
- name: ltmp0
type: N_SECT
sect: 1
value: 0x0000000000000000
- name: ltmp1
type: N_SECT
sect: 2
value: 0x0000000000000014
- name: _bar1
type: N_SECT
sect: 2
value: 0x0000000000000014
- name: _bar2
type: N_SECT
sect: 2
value: 0x0000000000000018
- name: ltmp12
type: N_SECT
sect: 3
value: 0x000000000000001C
- name: ltmp13
type: N_SECT
sect: 4
value: 0x0000000000000020
- name: ltmp16
type: N_SECT
sect: 5
value: 0x0000000000000060
global-symbols:
- name: __Z3fooi
type: N_SECT
scope: [ N_EXT ]
sect: 1
value: 0x0000000000000008
- name: __Z4foo2i
type: N_SECT
scope: [ N_EXT ]
sect: 1
value: 0x000000000000000C
- name: __gxx_personality_v0
type: N_SECT
scope: [ N_EXT ]
sect: 1
value: 0x0000000000000000
- name: __gxx_personality_v1
type: N_SECT
scope: [ N_EXT ]
sect: 1
value: 0x0000000000000004
- name: _main
type: N_SECT
scope: [ N_EXT ]
sect: 1
value: 0x0000000000000010
- name: _someData
type: N_SECT
scope: [ N_EXT ]
sect: 3
value: 0x000000000000001C
page-size: 0x00000000
...
# CHECK: --- !native
# CHECK: path: '<linker-internal>'
# CHECK: defined-atoms:
# CHECK: - ref-name: L000
# CHECK: type: unwind-cfi
# CHECK: content: [ 18, 00, 00, 00, 00, 00, 00, 00, 03, 7A, 50, 4C,
# CHECK: 52, 00, 01, 78, 1E, 07, 9B, {{..}}, {{..}}, {{..}}, {{..}}, 10,
# CHECK: 10, 0C, 1F, 00 ]
# CHECK: alignment: 8
# CHECK: references:
# CHECK: - kind: unwindCIEToPersonalityFunction
# CHECK: offset: 19
# CHECK: target: __gxx_personality_v0
# CHECK: - type: unwind-cfi
# CHECK: content: [ 28, 00, 00, 00, 20, 00, 00, 00, {{..}}, {{..}}, {{..}}, {{..}},
# CHECK: {{..}}, {{..}}, {{..}}, {{..}}, 04, 00, 00, 00, 00, 00, 00, 00,
# CHECK: 08, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, 0E, 10, 9E,
# CHECK: 01, 9D, 02, 00, 00, 00, 00, 00 ]
# CHECK: alignment: 4 mod 8
# CHECK: references:
# CHECK: - kind: negDelta32
# CHECK: offset: 4
# CHECK: target: L000
# CHECK: - kind: unwindFDEToFunction
# CHECK: offset: 8
# CHECK: target: __Z3fooi
# CHECK: - kind: unwindFDEToFunction
# CHECK: offset: 25
# CHECK: target: _bar1
# CHECK: - ref-name: L001
# CHECK: type: unwind-cfi
# CHECK: content: [ 18, 00, 00, 00, 00, 00, 00, 00, 03, 7A, 50, 4C,
# CHECK: 52, 00, 01, 78, 1E, 07, 9B, {{..}}, {{..}}, {{..}}, {{..}}, 10,
# CHECK: 10, 0C, 1F, 00 ]
# CHECK: alignment: 8
# CHECK: references:
# CHECK: - kind: unwindCIEToPersonalityFunction
# CHECK: offset: 19
# CHECK: target: __gxx_personality_v1
# CHECK: - type: unwind-cfi
# CHECK: content: [ 28, 00, 00, 00, 20, 00, 00, 00, {{..}}, {{..}}, {{..}}, {{..}},
# CHECK: {{..}}, {{..}}, {{..}}, {{..}}, 04, 00, 00, 00, 00, 00, 00, 00,
# CHECK: 08, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, 0E, 10, 9E,
# CHECK: 01, 9D, 02, 00, 00, 00, 00, 00 ]
# CHECK: alignment: 4 mod 8
# CHECK: references:
# CHECK: - kind: negDelta32
# CHECK: offset: 4
# CHECK: target: L001
# CHECK: - kind: unwindFDEToFunction
# CHECK: offset: 8
# CHECK: target: __Z4foo2i
# CHECK: - kind: unwindFDEToFunction
# CHECK: offset: 25
# CHECK: target: _bar2
# CHECK: - name: _bar1
# CHECK: type: unwind-lsda
# CHECK: content: [ 00, 00, 00, 00 ]
# CHECK: - name: _bar2
# CHECK: type: unwind-lsda
# CHECK: content: [ 00, 00, 00, 00 ]
# CHECK: - name: _someData
# CHECK: scope: global
# CHECK: type: data
# CHECK: content: [ 00, 00, 00, 00 ]
# CHECK: - name: __gxx_personality_v0
# CHECK: scope: global
# CHECK: content: [ 00, 00, 00, 00 ]
# CHECK: alignment: 4
# CHECK: - name: __gxx_personality_v1
# CHECK: scope: global
# CHECK: content: [ 00, 00, 00, 00 ]
# CHECK: alignment: 4
# CHECK: - name: __Z3fooi
# CHECK: scope: global
# CHECK: content: [ C0, 03, 5F, D6 ]
# CHECK: alignment: 4
# CHECK: - name: __Z4foo2i
# CHECK: scope: global
# CHECK: content: [ C0, 03, 5F, D6 ]
# CHECK: alignment: 4
# CHECK: - name: _main
# CHECK: scope: global
# CHECK: content: [ C0, 03, 5F, D6 ]
# CHECK: alignment: 4
# CHECK: ...
# # Make sure we don't have any relocations in the __eh_frame section
# CODE-NOT: RELOCATION RECORDS FOR [__eh_frame]
# Also make sure the reloc for the CIE->personality function is the
# correct offset
# It should be the offset from the fixup location back to the address
# of the function we are referencing
# CODE: Contents of section __eh_frame:
# This is the CIE:
# CODE-NEXT: {{[0-9abcdef]*}} 18000000 00000000 037a504c 52000178
# CODE-NEXT: {{[0-9abcdef]*}} 1e079bd1 ffffff10 100c1f00 28000000
# This is the important offset for CIE->pfunc
# ^~~~~~~~~
# Then we have an FDE starting from 28000000 above
# CODE-NEXT: {{[0-9abcdef]*}} 20000000 c8ffffff ffffffff 04000000
# CODE-NEXT: {{[0-9abcdef]*}} 00000000 08c3ffff ffffffff ff0e109e
# And a new CIE starts at this 00000018 right below here
# CODE-NEXT: {{[0-9abcdef]*}} 019d0200 00000000 18000000 00000000
# CODE-NEXT: {{[0-9abcdef]*}} 037a504c 52000178 1e079b8d ffffff10
# This is the important offset for its CIE->pfunc ^~~~~~~~~