Imported Upstream version 6.10.0.49

Former-commit-id: 1d6753294b2993e1fbf92de9366bb9544db4189b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2020-01-16 16:38:04 +00:00
parent d94e79959b
commit 468663ddbb
48518 changed files with 2789335 additions and 61176 deletions

View File

@@ -0,0 +1,115 @@
// RUN: llvm-mc -triple thumbv7m-apple-darwin-eabi %s -filetype=obj -o %t
// RUN: llvm-readobj -symbols %t | FileCheck %s
.data
var1 = var2
.long var1
.long var2
.long var2 + 4
defined_early:
.long 0
alias_to_early = defined_early
alias_to_late = defined_late
defined_late:
.long 0
.global extern_test
extern_test = var2
alias_to_local = Ltmp0
Ltmp0:
// CHECK: Symbols [
// defined_early was defined. Actually has value 0xc.
// CHECK: Symbol {
// CHECK-NEXT: Name: defined_early
// CHECK-NEXT: Type: Section (0xE)
// CHECK-NEXT: Section: __data (0x2)
// CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
// CHECK-NEXT: Flags [ (0x0)
// CHECK-NEXT: ]
// CHECK-NEXT: Value: 0x[[DEFINED_EARLY:[0-9A-F]+]]
// CHECK-NEXT: }
// alias_to_early was an alias to defined_early. But we can resolve it.
// CHECK: Symbol {
// CHECK-NEXT: Name: alias_to_early
// CHECK-NEXT: Type: Section (0xE)
// CHECK-NEXT: Section: __data (0x2)
// CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
// CHECK-NEXT: Flags [ (0x0)
// CHECK-NEXT: ]
// CHECK-NEXT: Value: 0x[[DEFINED_EARLY]]
// CHECK-NEXT: }
// alias_to_late was an alias to defined_late. But we can resolve it.
// CHECK: Symbol {
// CHECK-NEXT: Name: alias_to_late
// CHECK-NEXT: Type: Section (0xE)
// CHECK-NEXT: Section: __data (0x2)
// CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
// CHECK-NEXT: Flags [ (0x0)
// CHECK-NEXT: ]
// CHECK-NEXT: Value: 0x[[DEFINED_LATE:[0-9A-F]+]]
// CHECK-NEXT: }
// defined_late was defined. Just after defined_early.
// CHECK: Symbol {
// CHECK-NEXT: Name: defined_late
// CHECK-NEXT: Type: Section (0xE)
// CHECK-NEXT: Section: __data (0x2)
// CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
// CHECK-NEXT: Flags [ (0x0)
// CHECK-NEXT: ]
// CHECK-NEXT: Value: 0x[[DEFINED_LATE]]
// CHECK-NEXT: }
// alias_to_local is an alias, but what it points to has no
// MachO representation. We must resolve it.
// CHECK: Symbol {
// CHECK-NEXT: Name: alias_to_local (42)
// CHECK-NEXT: Type: Section (0xE)
// CHECK-NEXT: Section: __data (0x2)
// CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
// CHECK-NEXT: Flags [ (0x0)
// CHECK-NEXT: ]
// CHECK-NEXT: Value: 0x14
// CHECK-NEXT: }
// extern_test was a pure alias to the unknown "var2".
// N_INDR and Extern.
// CHECK: Name: extern_test
// CHECK-NEXT: Extern
// CHECK-NEXT: Type: Indirect (0xA)
// CHECK-NEXT: Section: (0x0)
// CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
// CHECK-NEXT: Flags [ (0x0)
// CHECK-NEXT: ]
// CHECK-NEXT: Value: 0x[[VAR2_STRINGINDEX:[0-9a-f]+]]
// CHECK-NEXT: }
// var1 was another alias to an unknown variable. Not extern this time.
// CHECK: Symbol {
// CHECK-NEXT: Name: var1 (89)
// CHECK-NEXT: Type: Indirect (0xA)
// CHECK-NEXT: Section: (0x0)
// CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
// CHECK-NEXT: Flags [ (0x0)
// CHECK-NEXT: ]
// CHECK-NEXT: Value: 0x[[VAR2_STRINGINDEX]]
// CHECK-NEXT: }
// var2 was a normal undefined (extern) symbol.
// CHECK: Symbol {
// CHECK-NEXT: Name: var2
// CHECK-NEXT: Extern
// CHECK-NEXT: Type: Undef (0x0)
// CHECK-NEXT: Section: (0x0)
// CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
// CHECK-NEXT: Flags [ (0x0)
// CHECK-NEXT: ]
// CHECK-NEXT: Value: 0x0
// CHECK-NEXT: }

View File

@@ -0,0 +1,15 @@
@ RUN: not llvm-mc -n -triple armv7-apple-darwin10 %s -filetype=obj -o - 2> %t.err > %t
@ RUN: FileCheck --check-prefix=CHECK-ERROR < %t.err %s
@ rdar://15586725
.text
ldr r3, L___fcommon
.section myseg, mysect
L___fcommon:
.word 0
@ CHECK-ERROR: unsupported relocation on symbol
c:
.word a - b
@ CHECK-ERROR: symbol 'a' can not be undefined in a subtraction expression
.word c - b
@ CHECK-ERROR: symbol 'b' can not be undefined in a subtraction expression

View File

@@ -0,0 +1,29 @@
@ RUN: not llvm-mc -n -triple armv7-apple-darwin10 %s -filetype asm -o /dev/null 2>&1 \
@ RUN: | FileCheck --check-prefix CHECK-ERROR %s
@ RUN: not llvm-mc -n -triple armv7-apple-darwin10 %s -filetype obj -o /dev/null 2>&1 \
@ RUN: | FileCheck --check-prefix CHECK-ERROR %s
@ rdar://16335232
.eabi_attribute 8, 1
@ CHECK-ERROR: error: unknown directive
.cpu
@ CHECK-ERROR: error: unknown directive
.fpu neon
@ CHECK-ERROR: error: unknown directive
.arch armv7
@ CHECK-ERROR: error: unknown directive
.fnstart
@ CHECK-ERROR: error: unknown directive
.tlsdescseq
@ CHECK-ERROR: error: unknown directive
.object_arch armv7
@ CHECK-ERROR: error: unknown directive

View File

@@ -0,0 +1,56 @@
// RUN: not llvm-mc -triple x86_64-apple-tvos %s 2>&1 | FileCheck %s
.build_version tvos,65535,0,255
// CHECK-NOT: build-version-diagnostics.s:[[@LINE-1]]
.build_version macos,1,2,3
// CHECK: build-version-diagnostics.s:[[@LINE-1]]:1: warning: .build_version macos used while targeting tvos
// CHECK: build-version-diagnostics.s:[[@LINE-2]]:1: warning: overriding previous version directive
.build_version 1,2,3
// CHECK: build-version-diagnostics.s:[[@LINE-1]]:16: error: platform name expected
.build_version macos 1,2
// CHECK: build-version-diagnostics.s:[[@LINE-1]]:22: error: version number required, comma expected
.build_version noos,1,2
// CHECK: build-version-diagnostics.s:[[@LINE-1]]:16: error: unknown platform name
.build_version macos,a
// CHECK: build-version-diagnostics.s:[[@LINE-1]]:22: error: invalid OS major version number, integer expected
.build_version macos,0,1
// CHECK: build-version-diagnostics.s:[[@LINE-1]]:22: error: invalid OS major version number
.build_version macos,-1,1
// CHECK: build-version-diagnostics.s:[[@LINE-1]]:22: error: invalid OS major version number
.build_version macos,65536,1
// CHECK: build-version-diagnostics.s:[[@LINE-1]]:22: error: invalid OS major version number
.build_version ios,10 0
// CHECK: build-version-diagnostics.s:[[@LINE-1]]:23: error: OS minor version number required, comma expected
.build_version ios,10,
// CHECK: build-version-diagnostics.s:[[@LINE-1]]:23: error: invalid OS minor version number, integer expected
.build_version ios,10,-1
// CHECK: build-version-diagnostics.s:[[@LINE-1]]:23: error: invalid OS minor version number
.build_version ios,10,256
// CHECK: build-version-diagnostics.s:[[@LINE-1]]:23: error: invalid OS minor version number
.build_version watchos,10,0 a
// CHECK: build-version-diagnostics.s:[[@LINE-1]]:29: error: invalid OS update specifier, comma expected
.build_version watchos,10,0 ,
// CHECK: build-version-diagnostics.s:[[@LINE-1]]:30: error: invalid OS update version number, integer expected
.build_version ios,10,0,-1
// CHECK: build-version-diagnostics.s:[[@LINE-1]]:25: error: invalid OS update version number
.build_version ios,10,0,256
// CHECK: build-version-diagnostics.s:[[@LINE-1]]:25: error: invalid OS update version number
.build_version ios,10,0,0,
// CHECK: build-version-diagnostics.s:[[@LINE-1]]:26: error: unexpected token in '.build_version' directive

View File

@@ -0,0 +1,10 @@
// RUN: llvm-mc %s -triple x86_64-apple-tvos -filetype=obj | llvm-readobj -macho-version-min | FileCheck %s
.build_version tvos,1,2,3
// CHECK: MinVersion {
// CHECK: Cmd: LC_BUILD_VERSION
// CHECK: Size: 24
// CHECK: Platform: tvos
// CHECK: Version: 1.2.3
// CHECK: SDK: n/a
// CHECK: }

View File

@@ -0,0 +1,19 @@
// RUN: llvm-mc -triple x86_64-apple-macos %s | FileCheck %s
.build_version macos,1,2
// CHECK: .build_version macos, 1, 2
.build_version macos,1,2,0
// CHECK: .build_version macos, 1, 2
.build_version macos,3,4,5
// CHECK: .build_version macos, 3, 4, 5
.build_version ios,6,7
// CHECK: .build_version ios, 6, 7
.build_version tvos,8,9
// CHECK: .build_version tvos, 8, 9
.build_version watchos,10,11
// CHECK: .build_version watchos, 10, 11

View File

@@ -0,0 +1,124 @@
@ RUN: llvm-mc -triple=thumbv7k-apple-watchos2.0.0 -filetype=obj -o %t < %s && llvm-objdump -unwind-info %t | FileCheck %s
@ CHECK: Contents of __compact_unwind section:
.syntax unified
.align 2
.code 16
@ CHECK-LABEL: start: {{.*}} _test_r4_r5_r6
@ CHECK: compact encoding: 0x01000007
.thumb_func _test_r4_r5_r6
_test_r4_r5_r6:
.cfi_startproc
push {r4, r5, r6, r7, lr}
add r7, sp, #12
sub sp, #16
.cfi_def_cfa r7, 8
.cfi_offset lr, -4
.cfi_offset r7, -8
.cfi_offset r6, -12
.cfi_offset r5, -16
.cfi_offset r4, -20
.cfi_endproc
@ CHECK-LABEL: start: {{.*}} _test_r4_r5_r10_r11
@ CHECK: compact encoding: 0x01000063
.thumb_func _test_r4_r5_r10_r11
_test_r4_r5_r10_r11:
.cfi_startproc
push {r4, r5, r7, lr}
add r7, sp, #8
.cfi_def_cfa r7, 8
.cfi_offset lr, -4
.cfi_offset r7, -8
.cfi_offset r5, -12
.cfi_offset r4, -16
push.w {r10, r11}
.cfi_offset r11, -20
.cfi_offset r10, -24
.cfi_endproc
@ CHECK-LABEL: start: {{.*}} _test_d8
@ CHECK: compact encoding: 0x02000000
.thumb_func _test_d8
_test_d8:
.cfi_startproc
push {r7, lr}
mov r7, sp
.cfi_def_cfa r7, 8
.cfi_offset lr, -4
.cfi_offset r7, -8
vpush {d8}
.cfi_offset d8, -16
.cfi_endproc
@ CHECK-LABEL: start: {{.*}} _test_d8_d10_d12_d14
@ CHECK: compact encoding: 0x02000300
.thumb_func _test_d8_d10_d12_d14
_test_d8_d10_d12_d14:
.cfi_startproc
push {r7, lr}
mov r7, sp
.cfi_def_cfa r7, 8
.cfi_offset lr, -4
.cfi_offset r7, -8
vpush {d14}
vpush {d12}
vpush {d10}
vpush {d8}
.cfi_offset d14, -16
.cfi_offset d12, -24
.cfi_offset d10, -32
.cfi_offset d8, -40
.cfi_endproc
@ CHECK-LABEL: start: {{.*}} _test_varargs
@ CHECK: compact encoding: 0x01c00001
.thumb_func _test_varargs
_test_varargs:
.cfi_startproc
sub sp, #12
push {r4, r7, lr}
add r7, sp, #4
.cfi_def_cfa r7, 20
.cfi_offset lr, -16
.cfi_offset r7, -20
.cfi_offset r4, -24
add.w r9, r7, #8
mov r4, r0
stm.w r9, {r1, r2, r3}
.cfi_endproc
@ CHECK-LABEL: start: {{.*}} _test_missing_lr
@ CHECK: compact encoding: 0x04000000
.thumb_func _test_missing_lr
_test_missing_lr:
.cfi_startproc
push {r7}
.cfi_def_cfa r7, 4
.cfi_offset r7, -4
pop {r7}
bx lr
.cfi_endproc
@ CHECK-LABEL: start: {{.*}} _test_swapped_offsets
@ CHECK: compact encoding: 0x04000000
.thumb_func _test_swapped_offsets
_test_swapped_offsets:
.cfi_startproc
push {r7, lr}
push {r10}
push {r4}
.cfi_def_cfa r7, 8
.cfi_offset lr, -4
.cfi_offset r7, -8
.cfi_offset r10, -12
.cfi_offset r4, -16
pop {r4}
pop {r10}
pop {r7, pc}
.cfi_endproc

View File

@@ -0,0 +1,74 @@
; RUN: llc -mtriple=arm-apple-darwin %s -o %t
; RUN: FileCheck %s < %t
; RUN: FileCheck %s -check-prefix=GOT-EQUIV < %t
; GOT equivalent globals references can be replaced by the GOT entry of the
; final symbol instead.
%struct.data = type { i32, %struct.anon }
%struct.anon = type { i32, i32 }
; Check that these got equivalent symbols are never emitted or used
; GOT-EQUIV-NOT: _localgotequiv
; GOT-EQUIV-NOT: _extgotequiv
@localfoo = global i32 42
@localgotequiv = private unnamed_addr constant i32* @localfoo
@extfoo = external global i32
@extgotequiv = private unnamed_addr constant i32* @extfoo
; Don't replace GOT equivalent usage within instructions and emit the GOT
; equivalent since it can't be replaced by the GOT entry. @bargotequiv is
; used by an instruction inside @t0.
;
; CHECK: l_bargotequiv:
; CHECK-NEXT: .long _extbar
@extbar = external global i32
@bargotequiv = private unnamed_addr constant i32* @extbar
@table = global [4 x %struct.data] [
; CHECK-LABEL: _table
%struct.data { i32 1, %struct.anon { i32 2, i32 3 } },
; Test GOT equivalent usage inside nested constant arrays.
; CHECK: .long 5
; CHECK-NOT: l_localgotequiv-(_table+20)
; CHECK-NEXT: L_localfoo$non_lazy_ptr-(_table+20)
%struct.data { i32 4, %struct.anon { i32 5,
i32 sub (i32 ptrtoint (i32** @localgotequiv to i32),
i32 ptrtoint (i32* getelementptr inbounds ([4 x %struct.data], [4 x %struct.data]* @table, i32 0, i32 1, i32 1, i32 1) to i32))}
},
; CHECK: .long 5
; CHECK-NOT: l_extgotequiv-(_table+32)
; CHECK-NEXT: L_extfoo$non_lazy_ptr-(_table+32)
%struct.data { i32 4, %struct.anon { i32 5,
i32 sub (i32 ptrtoint (i32** @extgotequiv to i32),
i32 ptrtoint (i32* getelementptr inbounds ([4 x %struct.data], [4 x %struct.data]* @table, i32 0, i32 2, i32 1, i32 1) to i32))}
},
; Test support for arbitrary constants into the GOTPCREL offset
; CHECK: .long 5
; CHECK-NOT: (l_extgotequiv-(_table+44))+24
; CHECK-NEXT: L_extfoo$non_lazy_ptr-(_table+20)
%struct.data { i32 4, %struct.anon { i32 5,
i32 add (i32 sub (i32 ptrtoint (i32** @extgotequiv to i32),
i32 ptrtoint (i32* getelementptr inbounds ([4 x %struct.data], [4 x %struct.data]* @table, i32 0, i32 3, i32 1, i32 1) to i32)),
i32 24)}
}
], align 16
; Test multiple uses of GOT equivalents.
; CHECK-LABEL: _delta
; CHECK: .long L_extfoo$non_lazy_ptr-_delta
@delta = global i32 sub (i32 ptrtoint (i32** @extgotequiv to i32),
i32 ptrtoint (i32* @delta to i32))
; CHECK-LABEL: _deltaplus:
; CHECK: .long L_localfoo$non_lazy_ptr-(_deltaplus-55)
@deltaplus = global i32 add (i32 sub (i32 ptrtoint (i32** @localgotequiv to i32),
i32 ptrtoint (i32* @deltaplus to i32)),
i32 55)
define i32 @t0(i32 %a) {
%x = add i32 sub (i32 ptrtoint (i32** @bargotequiv to i32),
i32 ptrtoint (i32 (i32)* @t0 to i32)), %a
ret i32 %x
}

View File

@@ -0,0 +1,186 @@
@ RUN: llvm-mc -n -triple armv7-apple-darwin10 %s -filetype=obj -o %t.obj
@ RUN: llvm-readobj -file-headers -s -sd -r -t -macho-segment -macho-dysymtab -macho-indirect-symbols < %t.obj > %t.dump
@ RUN: FileCheck < %t.dump %s
.syntax unified
.text
_f0:
bl _printf
_f1:
bl _f0
.data
_d0:
Ld0_0:
.long Lsc0_0 - Ld0_0
.section __TEXT,__cstring,cstring_literals
Lsc0_0:
.long 0
.subsections_via_symbols
@ CHECK: File: <stdin>
@ CHECK: Format: Mach-O arm
@ CHECK: Arch: arm
@ CHECK: AddressSize: 32bit
@ CHECK: MachHeader {
@ CHECK: Magic: Magic (0xFEEDFACE)
@ CHECK: CpuType: Arm (0xC)
@ CHECK: CpuSubType: CPU_SUBTYPE_ARM_V7 (0x9)
@ CHECK: FileType: Relocatable (0x1)
@ CHECK: NumOfLoadCommands: 4
@ CHECK: SizeOfLoadCommands: 380
@ CHECK: Flags [ (0x2000)
@ CHECK: MH_SUBSECTIONS_VIA_SYMBOLS (0x2000)
@ CHECK: ]
@ CHECK: }
@ CHECK: Sections [
@ CHECK: Section {
@ CHECK: Index: 0
@ CHECK: Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00)
@ CHECK: Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
@ CHECK: Address: 0x0
@ CHECK: Size: 0x8
@ CHECK: Offset: 408
@ CHECK: Alignment: 0
@ CHECK: RelocationOffset: 0x1A8
@ CHECK: RelocationCount: 2
@ CHECK: Type: 0x0
@ CHECK: Attributes [ (0x800004)
@ CHECK: PureInstructions (0x800000)
@ CHECK: SomeInstructions (0x4)
@ CHECK: ]
@ CHECK: Reserved1: 0x0
@ CHECK: Reserved2: 0x0
@ CHECK: SectionData (
@ CHECK: 0000: FEFFFFEB FDFFFFEB |........|
@ CHECK: )
@ CHECK: }
@ CHECK: Section {
@ CHECK: Index: 1
@ CHECK: Name: __data (5F 5F 64 61 74 61 00 00 00 00 00 00 00 00 00 00)
@ CHECK: Segment: __DATA (5F 5F 44 41 54 41 00 00 00 00 00 00 00 00 00 00)
@ CHECK: Address: 0x8
@ CHECK: Size: 0x4
@ CHECK: Offset: 416
@ CHECK: Alignment: 0
@ CHECK: RelocationOffset: 0x1B8
@ CHECK: RelocationCount: 2
@ CHECK: Type: 0x0
@ CHECK: Attributes [ (0x0)
@ CHECK: ]
@ CHECK: Reserved1: 0x0
@ CHECK: Reserved2: 0x0
@ CHECK: SectionData (
@ CHECK: 0000: 04000000 |....|
@ CHECK: )
@ CHECK: }
@ CHECK: Section {
@ CHECK: Index: 2
@ CHECK: Name: __cstring (5F 5F 63 73 74 72 69 6E 67 00 00 00 00 00 00 00)
@ CHECK: Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
@ CHECK: Address: 0xC
@ CHECK: Size: 0x4
@ CHECK: Offset: 420
@ CHECK: Alignment: 0
@ CHECK: RelocationOffset: 0x0
@ CHECK: RelocationCount: 0
@ CHECK: Type: ExtReloc (0x2)
@ CHECK: Attributes [ (0x0)
@ CHECK: ]
@ CHECK: Reserved1: 0x0
@ CHECK: Reserved2: 0x0
@ CHECK: SectionData (
@ CHECK: 0000: 00000000 |....|
@ CHECK: )
@ CHECK: }
@ CHECK: ]
@ CHECK: Relocations [
@ CHECK: Section __text {
@ CHECK: 0x4 1 2 1 ARM_RELOC_BR24 0 _f0
@ CHECK: 0x0 1 2 1 ARM_RELOC_BR24 0 _printf
@ CHECK: }
@ CHECK: Section __data {
@ CHECK: 0x0 0 2 n/a ARM_RELOC_SECTDIFF 1 0xC
@ CHECK: 0x0 0 2 n/a ARM_RELOC_PAIR 1 0x8
@ CHECK: }
@ CHECK: ]
@ CHECK: Symbols [
@ CHECK: Symbol {
@ CHECK: Name: _f0 (13)
@ CHECK: Type: Section (0xE)
@ CHECK: Section: __text (0x1)
@ CHECK: RefType: UndefinedNonLazy (0x0)
@ CHECK: Flags [ (0x0)
@ CHECK: ]
@ CHECK: Value: 0x0
@ CHECK: }
@ CHECK: Symbol {
@ CHECK: Name: _f1 (9)
@ CHECK: Type: Section (0xE)
@ CHECK: Section: __text (0x1)
@ CHECK: RefType: UndefinedNonLazy (0x0)
@ CHECK: Flags [ (0x0)
@ CHECK: ]
@ CHECK: Value: 0x4
@ CHECK: }
@ CHECK: Symbol {
@ CHECK: Name: _d0 (17)
@ CHECK: Type: Section (0xE)
@ CHECK: Section: __data (0x2)
@ CHECK: RefType: UndefinedNonLazy (0x0)
@ CHECK: Flags [ (0x0)
@ CHECK: ]
@ CHECK: Value: 0x8
@ CHECK: }
@ CHECK: Symbol {
@ CHECK: Name: _printf (1)
@ CHECK: Extern
@ CHECK: Type: Undef (0x0)
@ CHECK: Section: (0x0)
@ CHECK: RefType: UndefinedNonLazy (0x0)
@ CHECK: Flags [ (0x0)
@ CHECK: ]
@ CHECK: Value: 0x0
@ CHECK: }
@ CHECK: ]
@ CHECK: Indirect Symbols {
@ CHECK: Number: 0
@ CHECK: Symbols [
@ CHECK: ]
@ CHECK: }
@ CHECK: Segment {
@ CHECK: Cmd: LC_SEGMENT
@ CHECK: Name:
@ CHECK: Size: 260
@ CHECK: vmaddr: 0x0
@ CHECK: vmsize: 0x10
@ CHECK: fileoff: 408
@ CHECK: filesize: 16
@ CHECK: maxprot: rwx
@ CHECK: initprot: rwx
@ CHECK: nsects: 3
@ CHECK: flags: 0x0
@ CHECK: }
@ CHECK: Dysymtab {
@ CHECK: ilocalsym: 0
@ CHECK: nlocalsym: 3
@ CHECK: iextdefsym: 3
@ CHECK: nextdefsym: 0
@ CHECK: iundefsym: 3
@ CHECK: nundefsym: 1
@ CHECK: tocoff: 0
@ CHECK: ntoc: 0
@ CHECK: modtaboff: 0
@ CHECK: nmodtab: 0
@ CHECK: extrefsymoff: 0
@ CHECK: nextrefsyms: 0
@ CHECK: indirectsymoff: 0
@ CHECK: nindirectsyms: 0
@ CHECK: extreloff: 0
@ CHECK: nextrel: 0
@ CHECK: locreloff: 0
@ CHECK: nlocrel: 0
@ CHECK: }

View File

@@ -0,0 +1,148 @@
@ RUN: llvm-mc -n -triple thumbv7-apple-darwin10 %s -filetype=obj -o %t.obj
@ RUN: llvm-readobj -file-headers -s -sd -r -t -macho-segment -macho-dysymtab -macho-indirect-symbols < %t.obj > %t.dump
@ RUN: FileCheck < %t.dump %s
.syntax unified
.section __TEXT,__text,regular,pure_instructions
.globl _main
.align 2
.code 16
.thumb_func _main
_main:
LPC0_0:
blx _printf
.align 2
LCPI0_0:
.long L_.str-(LPC0_0+4)
.section __TEXT,__cstring,cstring_literals
.align 2
L_.str:
.asciz "s0"
.subsections_via_symbols
@ CHECK: File: <stdin>
@ CHECK: Format: Mach-O arm
@ CHECK: Arch: arm
@ CHECK: AddressSize: 32bit
@ CHECK: MachHeader {
@ CHECK: Magic: Magic (0xFEEDFACE)
@ CHECK: CpuType: Arm (0xC)
@ CHECK: CpuSubType: CPU_SUBTYPE_ARM_V7 (0x9)
@ CHECK: FileType: Relocatable (0x1)
@ CHECK: NumOfLoadCommands: 4
@ CHECK: SizeOfLoadCommands: 312
@ CHECK: Flags [ (0x2000)
@ CHECK: MH_SUBSECTIONS_VIA_SYMBOLS (0x2000)
@ CHECK: ]
@ CHECK: }
@ CHECK: Sections [
@ CHECK: Section {
@ CHECK: Index: 0
@ CHECK: Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00)
@ CHECK: Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
@ CHECK: Address: 0x0
@ CHECK: Size: 0x8
@ CHECK: Offset: 340
@ CHECK: Alignment: 2
@ CHECK: RelocationOffset: 0x160
@ CHECK: RelocationCount: 3
@ CHECK: Type: 0x0
@ CHECK: Attributes [ (0x800004)
@ CHECK: PureInstructions (0x800000)
@ CHECK: SomeInstructions (0x4)
@ CHECK: ]
@ CHECK: Reserved1: 0x0
@ CHECK: Reserved2: 0x0
@ CHECK: SectionData (
@ CHECK: 0000: FFF7FEEF 04000000 |........|
@ CHECK: )
@ CHECK: }
@ CHECK: Section {
@ CHECK: Index: 1
@ CHECK: Name: __cstring (5F 5F 63 73 74 72 69 6E 67 00 00 00 00 00 00 00)
@ CHECK: Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
@ CHECK: Address: 0x8
@ CHECK: Size: 0x3
@ CHECK: Offset: 348
@ CHECK: Alignment: 2
@ CHECK: RelocationOffset: 0x0
@ CHECK: RelocationCount: 0
@ CHECK: Type: ExtReloc (0x2)
@ CHECK: Attributes [ (0x0)
@ CHECK: ]
@ CHECK: Reserved1: 0x0
@ CHECK: Reserved2: 0x0
@ CHECK: SectionData (
@ CHECK: 0000: 733000 |s0.|
@ CHECK: )
@ CHECK: }
@ CHECK: ]
@ CHECK: Relocations [
@ CHECK: Section __text {
@ CHECK: 0x4 0 2 n/a ARM_RELOC_SECTDIFF 1 0x8
@ CHECK: 0x0 0 2 n/a ARM_RELOC_PAIR 1 0x0
@ CHECK: 0x0 1 2 1 ARM_THUMB_RELOC_BR22 0 _printf
@ CHECK: }
@ CHECK: ]
@ CHECK: Symbols [
@ CHECK: Symbol {
@ CHECK: Name: _main (1)
@ CHECK: Extern
@ CHECK: Type: Section (0xE)
@ CHECK: Section: __text (0x1)
@ CHECK: RefType: 0x8
@ CHECK: Flags [ (0x0)
@ CHECK: ]
@ CHECK: Value: 0x0
@ CHECK: }
@ CHECK: Symbol {
@ CHECK: Name: _printf (7)
@ CHECK: Extern
@ CHECK: Type: Undef (0x0)
@ CHECK: Section: (0x0)
@ CHECK: RefType: UndefinedNonLazy (0x0)
@ CHECK: Flags [ (0x0)
@ CHECK: ]
@ CHECK: Value: 0x0
@ CHECK: }
@ CHECK: ]
@ CHECK: Indirect Symbols {
@ CHECK: Number: 0
@ CHECK: Symbols [
@ CHECK: ]
@ CHECK: }
@ CHECK: Segment {
@ CHECK: Cmd: LC_SEGMENT
@ CHECK: Name:
@ CHECK: Size: 192
@ CHECK: vmaddr: 0x0
@ CHECK: vmsize: 0xB
@ CHECK: fileoff: 340
@ CHECK: filesize: 11
@ CHECK: maxprot: rwx
@ CHECK: initprot: rwx
@ CHECK: nsects: 2
@ CHECK: flags: 0x0
@ CHECK: }
@ CHECK: Dysymtab {
@ CHECK: ilocalsym: 0
@ CHECK: nlocalsym: 0
@ CHECK: iextdefsym: 0
@ CHECK: nextdefsym: 1
@ CHECK: iundefsym: 1
@ CHECK: nundefsym: 1
@ CHECK: tocoff: 0
@ CHECK: ntoc: 0
@ CHECK: modtaboff: 0
@ CHECK: nmodtab: 0
@ CHECK: extrefsymoff: 0
@ CHECK: nextrefsyms: 0
@ CHECK: indirectsymoff: 0
@ CHECK: nindirectsyms: 0
@ CHECK: extreloff: 0
@ CHECK: nextrel: 0
@ CHECK: locreloff: 0
@ CHECK: nlocrel: 0
@ CHECK: }

View File

@@ -0,0 +1,50 @@
@ RUN: llvm-mc -triple armv7-apple-darwin10 -filetype=obj -o - < %s | llvm-readobj --macho-data-in-code | FileCheck %s
.text
_foo:
.data_region
.long 10
.end_data_region
.data_region jt32
.long 1
.end_data_region
.data_region jt16
.short 2
.end_data_region
.data_region jt8
.byte 3
.end_data_region
@ CHECK: File: <stdin>
@ CHECK: Format: Mach-O arm
@ CHECK: Arch: arm
@ CHECK: AddressSize: 32bit
@ CHECK: DataInCode {
@ CHECK: Data offset: 300
@ CHECK: Data size: 32
@ CHECK: Data entries [
@ CHECK: Entry {
@ CHECK: Index: 0
@ CHECK: Offset: 0
@ CHECK: Length: 4
@ CHECK: Kind: 1
@ CHECK: }
@ CHECK: Entry {
@ CHECK: Index: 1
@ CHECK: Offset: 4
@ CHECK: Length: 4
@ CHECK: Kind: 4
@ CHECK: }
@ CHECK: Entry {
@ CHECK: Index: 2
@ CHECK: Offset: 8
@ CHECK: Length: 2
@ CHECK: Kind: 3
@ CHECK: }
@ CHECK: Entry {
@ CHECK: Index: 3
@ CHECK: Offset: 10
@ CHECK: Length: 1
@ CHECK: Kind: 2
@ CHECK: }
@ CHECK: ]
@ CHECK: }

View File

@@ -0,0 +1,10 @@
// RUN: not llvm-mc -triple arm-apple -filetype asm -o /dev/null %s 2>&1 | FileCheck %s
// RUN: not llvm-mc -triple armeb-apple -filetype asm -o /dev/null %s 2>&1 | FileCheck %s
// RUN: not llvm-mc -triple thumb-apple -filetype asm -o /dev/null %s 2>&1 | FileCheck %s
// RUN: not llvm-mc -triple thumbeb-apple -filetype asm -o /dev/null %s 2>&1 | FileCheck %s
.type symbol 32
// CHECK: error: expected STT_<TYPE_IN_UPPER_CASE>, '#<type>', '%<type>' or "<type>"
// CHECK: .type symbol 32
// CHECK: ^

View File

@@ -0,0 +1,23 @@
; RUN: llc < %s -filetype=obj -mtriple=thumbv6-apple-darwin -o - | llvm-readobj -s -sd | FileCheck -check-prefix=CHECK-T1 %s
; RUN: llc < %s -filetype=obj -mtriple=thumbv7-apple-darwin -o - | llvm-readobj -s -sd | FileCheck -check-prefix=CHECK-T2 %s
; RUN: llc < %s -filetype=obj -mtriple=armv6-apple-darwin -o - | llvm-readobj -s -sd | FileCheck -check-prefix=CHECK-ARM %s
; RUN: llc < %s -filetype=obj -mtriple=armv7-apple-darwin -o - | llvm-readobj -s -sd | FileCheck -check-prefix=CHECK-ARMV7 %s
; Empty functions need a NOP in them for MachO to prevent DWARF FDEs from
; getting all mucked up. See lib/CodeGen/AsmPrinter/AsmPrinter.cpp for
; details.
define internal fastcc void @empty_function() {
unreachable
}
; CHECK-T1: SectionData (
; CHECK-T1: 0000: C046 |.F|
; CHECK-T1: )
; CHECK-T2: SectionData (
; CHECK-T2: 0000: 00BF |..|
; CHECK-T2: )
; CHECK-ARM: SectionData (
; CHECK-ARM: 0000: 0000A0E1 |....|
; CHECK-ARM: )
; CHECK-ARMV7: SectionData (
; CHECK-ARMV7: 0000: 00F020E3 |.. .|
; CHECK-ARMV7: )

View File

@@ -0,0 +1,16 @@
// RUN: llvm-mc -triple armv7-apple-ios %s -filetype=obj -o - | llvm-readobj --macho-version-min | FileCheck %s
// Test the formation of the version-min load command in the MachO.
// use a nonsense but well formed version.
.ios_version_min 99,8,7
// CHECK: File: <stdin>
// CHECK: Format: Mach-O arm
// CHECK: Arch: arm
// CHECK: AddressSize: 32bit
// CHECK: MinVersion {
// CHECK: Cmd: LC_VERSION_MIN_IPHONEOS
// CHECK: Size: 16
// CHECK: Version: 99.8.7
// CHECK: SDK: n/a
// CHECK: }

View File

@@ -0,0 +1,3 @@
if not 'ARM' in config.root.targets:
config.unsupported = True

View File

@@ -0,0 +1,5 @@
@ RUN: llvm-mc -triple=thumbv7-apple-ios -filetype=obj -o - < %s | llvm-objdump -d -macho -triple=thumbv7-apple-ios - | FileCheck %s
nop
# CHECK: 0: 00 bf nop
# We are checking that disassembly happens when there are no symbols.
# rdar://11460289

View File

@@ -0,0 +1,20 @@
@ RUN: llvm-mc -triple=thumbv7-apple-ios -filetype=obj -o - < %s | llvm-objdump -d -macho -triple=thumbv7-apple-ios - | FileCheck %s
.thumb
.thumb_func _fib
_fib:
push {r7, lr}
pop {r7, pc}
.thumb_func _main
_main:
push {r7, lr}
pop {r7, pc}
nop
# CHECK: _fib:
# CHECK: 0: 80 b5 push {r7, lr}
# CHECK: 2: 80 bd pop {r7, pc}
# CHECK: _main:
# CHECK: 4: 80 b5 push {r7, lr}
# CHECK: 6: 80 bd pop {r7, pc}
# CHECK: 8: 00 bf nop
# We are checking that second function is fully disassembled.
# rdar://11426465

View File

@@ -0,0 +1,53 @@
@ RUN: llvm-mc -n -triple armv7-apple-darwin10 %s -filetype=obj -o %t.o
@ RUN: llvm-readobj -relocations -expand-relocs < %t.o | FileCheck %s
@ rdar://12359919
.syntax unified
.text
.globl _bar
.align 2
.code 16
.thumb_func _bar
_bar:
push {r7, lr}
mov r7, sp
bl _foo
pop {r7, pc}
_junk:
@ Make the _foo symbol sufficiently far away to force the 'bl' relocation
@ above to be out of range. On Darwin, the assembler deals with this by
@ generating an external relocation so the linker can create a branch
@ island.
.space 20000000
.section __TEXT,initcode,regular,pure_instructions
.globl _foo
.align 2
.code 16
_foo:
push {r7, lr}
mov r7, sp
pop {r7, pc}
@ CHECK: File: <stdin>
@ CHECK: Format: Mach-O arm
@ CHECK: Arch: arm
@ CHECK: AddressSize: 32bit
@ CHECK: Relocations [
@ CHECK: Section __text {
@ CHECK: Relocation {
@ CHECK: Offset: 0x4
@ CHECK: PCRel: 1
@ CHECK: Length: 2
@ CHECK: Type: ARM_THUMB_RELOC_BR22 (6)
@ CHECK: Symbol: _foo (2)
@ CHECK: }
@ CHECK: }
@ CHECK: ]

View File

@@ -0,0 +1,20 @@
@ RUN: llvm-mc -n -triple thumbv7-apple-darwin10 %s -filetype=obj -o %t.obj
@ RUN: llvm-readobj -s -sd < %t.obj > %t.dump
@ RUN: FileCheck < %t.dump %s
@ When not using subsections-via-symbols, references to non-local symbols
@ in the same section can be resolved at assembly time w/o relocations.
.syntax unified
.text
.thumb
.thumb_func _foo
_foo:
ldr r3, bar
bar:
.long 0
@ CHECK: RelocationCount: 0
@ CHECK: SectionData (
@ CHECK: 0000: DFF80030 00000000 |...0....|
@ CHECK: )

View File

@@ -0,0 +1,28 @@
; RUN: llc -filetype=obj -o - %s | llvm-objdump -section-headers - | FileCheck %s
; This should not trigger the "Creating regular section after DWARF" assert.
; CHECK: __text
; CHECK: __thread_ptr 00000004
target triple = "thumbv7-apple-ios9.0.0"
@b = external thread_local global i32
define i32* @func(i32 %a) !dbg !9 {
ret i32* @b
}
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3, !4, !5, !6, !7}
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug)
!1 = !DIFile(filename: "r.ii", directory: "/")
!2 = !{}
!3 = !{i32 2, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = !{i32 1, !"wchar_size", i32 4}
!6 = !{i32 1, !"min_enum_size", i32 4}
!7 = !{i32 1, !"PIC Level", i32 2}
!9 = distinct !DISubprogram(name: "func", scope: !1, file: !1, line: 4, type: !10, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
!10 = !DISubroutineType(types: !11)
!11 = !{null, !12}
!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!13 = !DILocalVariable(name: "a", arg: 1, scope: !9, file: !1, line: 4, type: !12)
!14 = !DIExpression()

Some files were not shown because too many files have changed in this diff Show More