forked from OSchip/llvm-project
180 lines
5.0 KiB
YAML
180 lines
5.0 KiB
YAML
|
# RUN: lld -flavor darwin -arch armv7 %s -dylib %p/Inputs/libSystem.yaml -o %t
|
||
|
# RUN: macho-dump --dump-section-data %t | FileCheck %s
|
||
|
#
|
||
|
# Test b from arm to thumb or vice versa has shims added.s
|
||
|
#
|
||
|
#
|
||
|
|
||
|
--- !mach-o
|
||
|
arch: armv7
|
||
|
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: [ 0x00, 0xBF, 0xFF, 0xF7, 0xFE, 0xEF, 0xFF, 0xF7,
|
||
|
0xFB, 0xBF, 0x00, 0x00, 0x00, 0xF0, 0x20, 0xE3,
|
||
|
0xFA, 0xFF, 0xFF, 0xFA, 0xF9, 0xFF, 0xFF, 0xEA ]
|
||
|
relocations:
|
||
|
- offset: 0x00000014
|
||
|
type: ARM_RELOC_BR24
|
||
|
length: 2
|
||
|
pc-rel: true
|
||
|
extern: true
|
||
|
symbol: 3
|
||
|
- offset: 0x00000010
|
||
|
type: ARM_RELOC_BR24
|
||
|
length: 2
|
||
|
pc-rel: true
|
||
|
extern: true
|
||
|
symbol: 3
|
||
|
- offset: 0x00000006
|
||
|
type: ARM_THUMB_RELOC_BR22
|
||
|
length: 2
|
||
|
pc-rel: true
|
||
|
extern: true
|
||
|
symbol: 2
|
||
|
- offset: 0x00000002
|
||
|
type: ARM_THUMB_RELOC_BR22
|
||
|
length: 2
|
||
|
pc-rel: true
|
||
|
extern: true
|
||
|
symbol: 2
|
||
|
global-symbols:
|
||
|
- name: _a1
|
||
|
type: N_SECT
|
||
|
scope: [ N_EXT ]
|
||
|
sect: 1
|
||
|
value: 0x000000000000000C
|
||
|
- name: _t1
|
||
|
type: N_SECT
|
||
|
scope: [ N_EXT ]
|
||
|
sect: 1
|
||
|
desc: [ N_ARM_THUMB_DEF ]
|
||
|
value: 0x0000000000000000
|
||
|
undefined-symbols:
|
||
|
- name: _a2
|
||
|
type: N_UNDF
|
||
|
scope: [ N_EXT ]
|
||
|
value: 0x0000000000000000
|
||
|
- name: _t2
|
||
|
type: N_UNDF
|
||
|
scope: [ N_EXT ]
|
||
|
value: 0x0000000000000000
|
||
|
|
||
|
|
||
|
--- !mach-o
|
||
|
arch: armv7
|
||
|
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: [ 0x00, 0xBF, 0xFF, 0xF7, 0xFE, 0xEF, 0xFF, 0xF7,
|
||
|
0xFB, 0xBF, 0x00, 0x00, 0x00, 0xF0, 0x20, 0xE3,
|
||
|
0xFA, 0xFF, 0xFF, 0xFA, 0xF9, 0xFF, 0xFF, 0xEA ]
|
||
|
relocations:
|
||
|
- offset: 0x00000014
|
||
|
type: ARM_RELOC_BR24
|
||
|
length: 2
|
||
|
pc-rel: true
|
||
|
extern: true
|
||
|
symbol: 3
|
||
|
- offset: 0x00000010
|
||
|
type: ARM_RELOC_BR24
|
||
|
length: 2
|
||
|
pc-rel: true
|
||
|
extern: true
|
||
|
symbol: 3
|
||
|
- offset: 0x00000006
|
||
|
type: ARM_THUMB_RELOC_BR22
|
||
|
length: 2
|
||
|
pc-rel: true
|
||
|
extern: true
|
||
|
symbol: 2
|
||
|
- offset: 0x00000002
|
||
|
type: ARM_THUMB_RELOC_BR22
|
||
|
length: 2
|
||
|
pc-rel: true
|
||
|
extern: true
|
||
|
symbol: 2
|
||
|
global-symbols:
|
||
|
- name: _a2
|
||
|
type: N_SECT
|
||
|
scope: [ N_EXT ]
|
||
|
sect: 1
|
||
|
value: 0x000000000000000C
|
||
|
- name: _t2
|
||
|
type: N_SECT
|
||
|
scope: [ N_EXT ]
|
||
|
sect: 1
|
||
|
desc: [ N_ARM_THUMB_DEF ]
|
||
|
value: 0x0000000000000000
|
||
|
undefined-symbols:
|
||
|
- name: _a1
|
||
|
type: N_UNDF
|
||
|
scope: [ N_EXT ]
|
||
|
value: 0x0000000000000000
|
||
|
- name: _t1
|
||
|
type: N_UNDF
|
||
|
scope: [ N_EXT ]
|
||
|
value: 0x0000000000000000
|
||
|
|
||
|
...
|
||
|
|
||
|
|
||
|
# CHECK: (('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
|
||
|
# CHECK: ('segment_name', '__TEXT\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
|
||
|
# CHECK: ('_section_data', '00bf00f0 10e800f0 19b80000 00f020e3 000000fa 0f0000ea 00bffff7 f8ef00f0 07b80000 00f020e3 f4fffffa 050000ea dff804c0 ff446047 d4ffffff dff804c0 ff446047 e0ffffff 04c09fe5 0cc08fe0 1cff2fe1 adffffff 04c09fe5 0cc08fe0 1cff2fe1 b5ffffff')
|
||
|
|
||
|
# When we get a good mach-o disassembler the above __text section content check can be change to be symbolic.
|
||
|
|
||
|
|
||
|
# Input file one:
|
||
|
#
|
||
|
# .align 2
|
||
|
# .code 16
|
||
|
# .globl _t1
|
||
|
# .thumb_func _t1
|
||
|
#_t1:
|
||
|
# nop
|
||
|
# blx _a2
|
||
|
# b _a2
|
||
|
#
|
||
|
# .code 32
|
||
|
# .align 2
|
||
|
# .globl _a1
|
||
|
#_a1:
|
||
|
# nop
|
||
|
# blx _t2
|
||
|
# b _t2
|
||
|
|
||
|
|
||
|
|
||
|
# Input file two:
|
||
|
#
|
||
|
# .align 2
|
||
|
# .code 16
|
||
|
# .globl _t2
|
||
|
# .thumb_func _t2
|
||
|
#_t2:
|
||
|
# nop
|
||
|
# blx _a1
|
||
|
# b _a1
|
||
|
#
|
||
|
# .code 32
|
||
|
# .align 2
|
||
|
# .globl _a2
|
||
|
#_a2:
|
||
|
# nop
|
||
|
# blx _t1
|
||
|
# b _t1
|