2018-02-17 05:16:57 +08:00
|
|
|
# RUN: ld64.lld -arch armv7 -r -print_atoms %s -o %t | FileCheck %s
|
|
|
|
# RUN: ld64.lld -arch armv7 -r -print_atoms %t -o %t2 | FileCheck %s
|
|
|
|
# RUN: ld64.lld -arch armv7 -dylib %s -o %t3.dylib %p/Inputs/armv7/libSystem.yaml \
|
2014-10-29 06:21:10 +08:00
|
|
|
# RUN: && llvm-objdump -macho -private-headers %t3.dylib | FileCheck --check-prefix=CHECK2 %s
|
2014-07-25 07:06:56 +08:00
|
|
|
#
|
|
|
|
# Test parsing LC_DATA_IN_CODE
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
--- !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
|
2015-04-28 01:18:04 +08:00
|
|
|
content: [ 0x00, 0xBF, 0x00, 0xBF, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
|
|
|
|
0x03, 0x00, 0x00, 0x00, 0x00, 0xBF, 0x00, 0xBF,
|
|
|
|
0x00, 0xF0, 0x20, 0xE3, 0x0A, 0x00, 0x00, 0x00,
|
|
|
|
0x0B, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00,
|
2014-07-25 07:06:56 +08:00
|
|
|
0x0D, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x20, 0xE3 ]
|
|
|
|
local-symbols:
|
|
|
|
- name: _foo_thumb
|
|
|
|
type: N_SECT
|
|
|
|
sect: 1
|
|
|
|
desc: [ N_ARM_THUMB_DEF ]
|
|
|
|
value: 0x0000000000000000
|
|
|
|
- name: _foo_arm
|
|
|
|
type: N_SECT
|
|
|
|
sect: 1
|
|
|
|
value: 0x0000000000000018
|
|
|
|
dataInCode:
|
|
|
|
- offset: 0x00000004
|
|
|
|
length: 0x0004
|
|
|
|
kind: DICE_KIND_DATA
|
|
|
|
- offset: 0x00000008
|
|
|
|
length: 0x0004
|
|
|
|
kind: DICE_KIND_JUMP_TABLE32
|
|
|
|
- offset: 0x0000000C
|
|
|
|
length: 0x0004
|
|
|
|
kind: DICE_KIND_JUMP_TABLE16
|
|
|
|
- offset: 0x00000010
|
|
|
|
length: 0x0004
|
|
|
|
kind: DICE_KIND_JUMP_TABLE8
|
|
|
|
- offset: 0x0000001C
|
|
|
|
length: 0x0004
|
|
|
|
kind: DICE_KIND_DATA
|
|
|
|
- offset: 0x00000020
|
|
|
|
length: 0x0004
|
|
|
|
kind: DICE_KIND_JUMP_TABLE32
|
|
|
|
- offset: 0x00000024
|
|
|
|
length: 0x0004
|
|
|
|
kind: DICE_KIND_JUMP_TABLE16
|
|
|
|
- offset: 0x00000028
|
|
|
|
length: 0x0004
|
|
|
|
kind: DICE_KIND_JUMP_TABLE8
|
|
|
|
...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# CHECK: defined-atoms:
|
|
|
|
# CHECK: - name: _foo_thumb
|
|
|
|
# CHECK: references:
|
|
|
|
# CHECK: - kind: modeThumbCode
|
|
|
|
# CHECK: offset: 0
|
|
|
|
# CHECK: - kind: modeData
|
|
|
|
# CHECK: offset: 4
|
|
|
|
# CHECK: addend: 1
|
|
|
|
# CHECK: - kind: modeData
|
|
|
|
# CHECK: offset: 8
|
|
|
|
# CHECK: addend: 4
|
|
|
|
# CHECK: - kind: modeData
|
|
|
|
# CHECK: offset: 12
|
|
|
|
# CHECK: addend: 3
|
|
|
|
# CHECK: - kind: modeData
|
|
|
|
# CHECK: offset: 16
|
|
|
|
# CHECK: addend: 2
|
|
|
|
# CHECK: - kind: modeThumbCode
|
|
|
|
# CHECK: offset: 20
|
|
|
|
# CHECK: - name: _foo_arm
|
|
|
|
# CHECK: references:
|
|
|
|
# CHECK: - kind: modeData
|
|
|
|
# CHECK: offset: 4
|
|
|
|
# CHECK: addend: 1
|
|
|
|
# CHECK: - kind: modeData
|
|
|
|
# CHECK: offset: 8
|
|
|
|
# CHECK: addend: 4
|
|
|
|
# CHECK: - kind: modeData
|
|
|
|
# CHECK: offset: 12
|
|
|
|
# CHECK: addend: 3
|
|
|
|
# CHECK: - kind: modeData
|
|
|
|
# CHECK: offset: 16
|
|
|
|
# CHECK: addend: 2
|
|
|
|
# CHECK: - kind: modeArmCode
|
|
|
|
# CHECK: offset: 20
|
|
|
|
|
|
|
|
|
2014-10-29 06:21:10 +08:00
|
|
|
# CHECK2: cmd LC_DATA_IN_CODE
|
|
|
|
# CHECK2: cmdsize 16
|
|
|
|
# CHECK2: datasize 64
|
|
|
|
|
2014-07-25 07:06:56 +08:00
|
|
|
|
|
|
|
# .code 16
|
|
|
|
# .thumb_func _foo_thumb
|
|
|
|
#_foo_thumb:
|
|
|
|
# nop
|
|
|
|
# nop
|
|
|
|
#
|
|
|
|
# .data_region
|
|
|
|
# .long 0
|
|
|
|
# .end_data_region
|
|
|
|
#
|
|
|
|
# .data_region jt32
|
|
|
|
# .long 1
|
|
|
|
# .end_data_region
|
|
|
|
#
|
|
|
|
# .data_region jt16
|
|
|
|
# .long 2
|
|
|
|
# .end_data_region
|
|
|
|
#
|
|
|
|
# .data_region jt8
|
|
|
|
# .long 3
|
|
|
|
# .end_data_region
|
|
|
|
#
|
|
|
|
# nop
|
|
|
|
# nop
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# .code 32
|
2015-04-28 01:18:04 +08:00
|
|
|
# .align 2
|
2014-07-25 07:06:56 +08:00
|
|
|
#_foo_arm:
|
|
|
|
# nop
|
|
|
|
#
|
|
|
|
# .data_region
|
|
|
|
# .long 10
|
|
|
|
# .end_data_region
|
|
|
|
#
|
|
|
|
# .data_region jt32
|
|
|
|
# .long 11
|
|
|
|
# .end_data_region
|
|
|
|
#
|
|
|
|
# .data_region jt16
|
|
|
|
# .long 12
|
|
|
|
# .end_data_region
|
|
|
|
#
|
|
|
|
# .data_region jt8
|
|
|
|
# .long 13
|
|
|
|
# .end_data_region
|
|
|
|
#
|
|
|
|
# nop
|
|
|
|
#
|