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,23 @@
; RUN: llvm-mc -triple arm64-apple-darwin10 %s -filetype=obj -o - | llvm-readobj -r --expand-relocs | FileCheck %s
; Test that we produce an external relocation with Lbar. We could also produce
; an internal relocation. We just have to be careful to not use another symbol.
// CHECK: Relocations [
// CHECK-NEXT: Section __data {
// CHECK-NEXT: Relocation {
// CHECK-NEXT: Offset: 0x0
// CHECK-NEXT: PCRel: 0
// CHECK-NEXT: Length: 3
// CHECK-NEXT: Type: ARM64_RELOC_UNSIGNED (0)
// CHECK-NEXT: Symbol: Lbar
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: ]
.section __DATA,__objc_classrefs,regular,no_dead_strip
Lbar:
.section __DATA,__data
.quad Lbar

View File

@@ -0,0 +1,92 @@
; RUN: llc -mtriple=arm64-apple-darwin %s -o - | FileCheck %s
; 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 }
@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: .quad _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: .long _localgotequiv-(_table+20)
; CHECK-NEXT: Ltmp0:
; CHECK-NEXT: .long _localfoo@GOT-Ltmp0
%struct.data { i32 4, %struct.anon { i32 5,
i32 trunc (i64 sub (i64 ptrtoint (i32** @localgotequiv to i64),
i64 ptrtoint (i32* getelementptr inbounds ([4 x %struct.data], [4 x %struct.data]* @table, i32 0, i64 1, i32 1, i32 1) to i64))
to i32)}
},
; CHECK: .long 5
; CHECK-NOT: _extgotequiv-(_table+32)
; CHECK-NEXT: Ltmp1:
; CHECK-NEXT: _extfoo@GOT-Ltmp1
%struct.data { i32 4, %struct.anon { i32 5,
i32 trunc (i64 sub (i64 ptrtoint (i32** @extgotequiv to i64),
i64 ptrtoint (i32* getelementptr inbounds ([4 x %struct.data], [4 x %struct.data]* @table, i32 0, i64 2, i32 1, i32 1) to i64))
to i32)}
},
; Test support for arbitrary constants into the GOTPCREL offset, which is
; supported on x86-64 but not on ARM64
; CHECK: .long 5
; CHECK-NEXT: .long ((l_extgotequiv-_table)-44)+24
%struct.data { i32 4, %struct.anon { i32 5,
i32 add (i32 trunc (i64 sub (i64 ptrtoint (i32** @extgotequiv to i64),
i64 ptrtoint (i32* getelementptr inbounds ([4 x %struct.data], [4 x %struct.data]* @table, i32 0, i64 3, i32 1, i32 1) to i64))
to i32), i32 24)}
}
], align 16
; Test multiple uses of GOT equivalents.
; CHECK-LABEL: _delta
; CHECK: Ltmp2:
; CHECK-NEXT: .long _extfoo@GOT-Ltmp2
@delta = global i32 trunc (i64 sub (i64 ptrtoint (i32** @extgotequiv to i64),
i64 ptrtoint (i32* @delta to i64))
to i32)
; CHECK-LABEL: _deltaplus:
; CHECK: .long (l_localgotequiv-_deltaplus)+55
@deltaplus = global i32 add (i32 trunc (i64 sub (i64 ptrtoint (i32** @localgotequiv to i64),
i64 ptrtoint (i32* @deltaplus to i64))
to i32), i32 55)
define i32 @t0(i32 %a) {
%x = add i32 trunc (i64 sub (i64 ptrtoint (i32** @bargotequiv to i64),
i64 ptrtoint (i32 (i32)* @t0 to i64))
to i32), %a
ret i32 %x
}
; Check that these got equivalent symbols are emitted on ARM64. Since ARM64
; does not support encoding an extra offset with @GOT, we still need to emit the
; equivalents for use by such IR constructs. Check them at the end of the test
; since they will start out as GOT equivalent candidates, but they are actually
; needed and are therefore emitted at the end.
; CHECK-LABEL: l_localgotequiv:
; CHECK-NEXT: .quad _localfoo
; CHECK-LABEL: l_extgotequiv:
; CHECK-NEXT: .quad _extfoo

View File

@@ -0,0 +1,28 @@
; RUN: llvm-mc -triple arm64-apple-darwin -filetype=obj -o - < %s | llvm-readobj -s -sd | FileCheck %s
; rdar://13028719
.globl context_save0
.align 6
Lcontext_save0:
context_save0:
.fill 2, 8, 5
Lcontext_save0_end:
Lcontext_save0_size: .quad (Lcontext_save0_end - Lcontext_save0)
.align 6
Lcontext_save1:
.fill 2, 8, 0
Lcontext_save1_end:
Lcontext_save1_size: .quad (Lcontext_save1_end - Lcontext_save1)
Llockup_release:
.quad 0
; CHECK: SectionData (
; CHECK: 0000: 05000000 00000000 05000000 00000000 |................|
; CHECK: 0010: 10000000 00000000 1F2003D5 1F2003D5 |......... ... ..|
; CHECK: 0020: 1F2003D5 1F2003D5 1F2003D5 1F2003D5 |. ... ... ... ..|
; CHECK: 0030: 1F2003D5 1F2003D5 1F2003D5 1F2003D5 |. ... ... ... ..|
; CHECK: 0040: 00000000 00000000 00000000 00000000 |................|
; CHECK: 0050: 10000000 00000000 00000000 00000000 |................|
; CHECK: )

View File

@@ -0,0 +1,210 @@
; RUN: llvm-mc -n -triple arm64-apple-darwin10 %s -filetype=obj -o - | llvm-readobj -r --expand-relocs | FileCheck %s
.text
_fred:
bl _func
bl _func + 20
adrp x3, _data@page
ldr w2, [x3, _data@pageoff]
add x3, x3, _data@pageoff + 4
adrp x3, _data@page+1
ldr w2, [x3, _data@pageoff + 4]
adrp x3, _data_ext@gotpage
ldr w2, [x3, _data_ext@gotpageoff]
adrp x0, L_.str@PAGE
.data
_data:
.quad _foo
.quad _foo + 4
.quad _foo - _bar
.quad _foo - _bar + 4
.long _foo - _bar
.quad _foo@got
.long _foo@got - .
.section __TEXT,__cstring,cstring_literals
L_.str:
.asciz "foo"
; CHECK: Relocations [
; CHECK-NEXT: Section __text {
; CHECK-NEXT: Relocation {
; CHECK-NEXT: Offset: 0x24
; CHECK-NEXT: PCRel: 1
; CHECK-NEXT: Length: 2
; CHECK-NEXT: Type: ARM64_RELOC_PAGE21 (3)
; CHECK-NEXT: Symbol: L_.str
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
; CHECK-NEXT: Offset: 0x20
; CHECK-NEXT: PCRel: 0
; CHECK-NEXT: Length: 2
; CHECK-NEXT: Type: ARM64_RELOC_GOT_LOAD_PAGEOFF12 (6)
; CHECK-NEXT: Symbol: _data_ext
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
; CHECK-NEXT: Offset: 0x1C
; CHECK-NEXT: PCRel: 1
; CHECK-NEXT: Length: 2
; CHECK-NEXT: Type: ARM64_RELOC_GOT_LOAD_PAGE21 (5)
; CHECK-NEXT: Symbol: _data_ext
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
; CHECK-NEXT: Offset: 0x18
; CHECK-NEXT: PCRel: 0
; CHECK-NEXT: Length: 2
; CHECK-NEXT: Type: ARM64_RELOC_ADDEND (10)
; CHECK-NEXT: Section: - (4)
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
; CHECK-NEXT: Offset: 0x18
; CHECK-NEXT: PCRel: 0
; CHECK-NEXT: Length: 2
; CHECK-NEXT: Type: ARM64_RELOC_PAGEOFF12 (4)
; CHECK-NEXT: Symbol: _data
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
; CHECK-NEXT: Offset: 0x14
; CHECK-NEXT: PCRel: 0
; CHECK-NEXT: Length: 2
; CHECK-NEXT: Type: ARM64_RELOC_ADDEND (10)
; CHECK-NEXT: Section: __text
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
; CHECK-NEXT: Offset: 0x14
; CHECK-NEXT: PCRel: 1
; CHECK-NEXT: Length: 2
; CHECK-NEXT: Type: ARM64_RELOC_PAGE21 (3)
; CHECK-NEXT: Symbol: _data
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
; CHECK-NEXT: Offset: 0x10
; CHECK-NEXT: PCRel: 0
; CHECK-NEXT: Length: 2
; CHECK-NEXT: Type: ARM64_RELOC_ADDEND (10)
; CHECK-NEXT: Section: - (4)
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
; CHECK-NEXT: Offset: 0x10
; CHECK-NEXT: PCRel: 0
; CHECK-NEXT: Length: 2
; CHECK-NEXT: Type: ARM64_RELOC_PAGEOFF12 (4)
; CHECK-NEXT: Symbol: _data
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
; CHECK-NEXT: Offset: 0xC
; CHECK-NEXT: PCRel: 0
; CHECK-NEXT: Length: 2
; CHECK-NEXT: Type: ARM64_RELOC_PAGEOFF12 (4)
; CHECK-NEXT: Symbol: _data
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
; CHECK-NEXT: Offset: 0x8
; CHECK-NEXT: PCRel: 1
; CHECK-NEXT: Length: 2
; CHECK-NEXT: Type: ARM64_RELOC_PAGE21 (3)
; CHECK-NEXT: Symbol: _data
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
; CHECK-NEXT: Offset: 0x4
; CHECK-NEXT: PCRel: 0
; CHECK-NEXT: Length: 2
; CHECK-NEXT: Type: ARM64_RELOC_ADDEND (10)
; CHECK-NEXT: Section: - (20)
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
; CHECK-NEXT: Offset: 0x4
; CHECK-NEXT: PCRel: 1
; CHECK-NEXT: Length: 2
; CHECK-NEXT: Type: ARM64_RELOC_BRANCH26 (2)
; CHECK-NEXT: Symbol: _func
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
; CHECK-NEXT: Offset: 0x0
; CHECK-NEXT: PCRel: 1
; CHECK-NEXT: Length: 2
; CHECK-NEXT: Type: ARM64_RELOC_BRANCH26 (2)
; CHECK-NEXT: Symbol: _func
; CHECK-NEXT: }
; CHECK-NEXT: }
; CHECK-NEXT: Section __data {
; CHECK-NEXT: Relocation {
; CHECK-NEXT: Offset: 0x2C
; CHECK-NEXT: PCRel: 1
; CHECK-NEXT: Length: 2
; CHECK-NEXT: Type: ARM64_RELOC_POINTER_TO_GOT (7)
; CHECK-NEXT: Symbol: _foo
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
; CHECK-NEXT: Offset: 0x24
; CHECK-NEXT: PCRel: 0
; CHECK-NEXT: Length: 3
; CHECK-NEXT: Type: ARM64_RELOC_POINTER_TO_GOT (7)
; CHECK-NEXT: Symbol: _foo
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
; CHECK-NEXT: Offset: 0x20
; CHECK-NEXT: PCRel: 0
; CHECK-NEXT: Length: 2
; CHECK-NEXT: Type: ARM64_RELOC_SUBTRACTOR (1)
; CHECK-NEXT: Symbol: _bar
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
; CHECK-NEXT: Offset: 0x20
; CHECK-NEXT: PCRel: 0
; CHECK-NEXT: Length: 2
; CHECK-NEXT: Type: ARM64_RELOC_UNSIGNED (0)
; CHECK-NEXT: Symbol: _foo
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
; CHECK-NEXT: Offset: 0x18
; CHECK-NEXT: PCRel: 0
; CHECK-NEXT: Length: 3
; CHECK-NEXT: Type: ARM64_RELOC_SUBTRACTOR (1)
; CHECK-NEXT: Symbol: _bar
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
; CHECK-NEXT: Offset: 0x18
; CHECK-NEXT: PCRel: 0
; CHECK-NEXT: Length: 3
; CHECK-NEXT: Type: ARM64_RELOC_UNSIGNED (0)
; CHECK-NEXT: Symbol: _foo
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
; CHECK-NEXT: Offset: 0x10
; CHECK-NEXT: PCRel: 0
; CHECK-NEXT: Length: 3
; CHECK-NEXT: Type: ARM64_RELOC_SUBTRACTOR (1)
; CHECK-NEXT: Symbol: _bar
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
; CHECK-NEXT: Offset: 0x10
; CHECK-NEXT: PCRel: 0
; CHECK-NEXT: Length: 3
; CHECK-NEXT: Type: ARM64_RELOC_UNSIGNED (0)
; CHECK-NEXT: Symbol: _foo
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
; CHECK-NEXT: Offset: 0x8
; CHECK-NEXT: PCRel: 0
; CHECK-NEXT: Length: 3
; CHECK-NEXT: Type: ARM64_RELOC_UNSIGNED (0)
; CHECK-NEXT: Symbol: _foo
; CHECK-NEXT: }
; CHECK-NEXT: Relocation {
; CHECK-NEXT: Offset: 0x0
; CHECK-NEXT: PCRel: 0
; CHECK-NEXT: Length: 3
; CHECK-NEXT: Type: ARM64_RELOC_UNSIGNED (0)
; CHECK-NEXT: Symbol: _foo
; CHECK-NEXT: }
; CHECK-NEXT: }
; CHECK-NEXT: ]

View File

@@ -0,0 +1,49 @@
// RUN: llvm-mc -triple arm64-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 arm64
// CHECK: Arch: aarch64
// CHECK: AddressSize: 64bit
// CHECK: DataInCode {
// 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,60 @@
; RUN: llvm-mc -triple arm64-apple-darwin10 %s -filetype=obj -o - | llvm-readobj -r --expand-relocs | FileCheck %s
; Test that we produce an external relocation. This is a known and temporary bug
; in ld64, where it mishandles pointer-sized internal relocations. We should be
; able to remove this entirely soon.
// CHECK: Relocations [
// CHECK-NEXT: Section __data {
// CHECK-NEXT: Relocation {
// CHECK-NEXT: Offset: 0x18
// CHECK-NEXT: PCRel: 0
// CHECK-NEXT: Length: 3
// CHECK-NEXT: Type: ARM64_RELOC_UNSIGNED (0)
// CHECK-NEXT: Symbol: Llit16
// CHECK-NEXT: }
// CHECK-NEXT: Relocation {
// CHECK-NEXT: Offset: 0x10
// CHECK-NEXT: PCRel: 0
// CHECK-NEXT: Length: 3
// CHECK-NEXT: Type: ARM64_RELOC_UNSIGNED (0)
// CHECK-NEXT: Symbol: Llit8
// CHECK-NEXT: }
// CHECK-NEXT: Relocation {
// CHECK-NEXT: Offset: 0x8
// CHECK-NEXT: PCRel: 0
// CHECK-NEXT: Length: 3
// CHECK-NEXT: Type: ARM64_RELOC_UNSIGNED (0)
// CHECK-NEXT: Symbol: Llit4
// CHECK-NEXT: }
// CHECK-NEXT: Relocation {
// CHECK-NEXT: Offset: 0x0
// CHECK-NEXT: PCRel: 0
// CHECK-NEXT: Length: 3
// CHECK-NEXT: Type: ARM64_RELOC_UNSIGNED (0)
// CHECK-NEXT: Symbol: Lcfstring
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: ]
.section __DATA,__cfstring
Lcfstring:
.section __DATA,__literal4,4byte_literals
Llit4:
.word 42
.section __DATA,__literal8,8byte_literals
Llit8:
.quad 42
.section __DATA,__literal16,16byte_literals
Llit16:
.quad 42
.quad 42
.section __DATA,__data
.quad Lcfstring
.quad Llit4
.quad Llit8
.quad Llit16

View File

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

View File

@@ -0,0 +1,53 @@
// RUN: llvm-mc -triple aarch64-apple-darwin14 %s -filetype=obj -o - | llvm-readobj -r --expand-relocs | FileCheck %s
// FIXME: the final relocation should be internal, but the linker doesn't
// currently handle the it correctly.
// Test that we "S + K" produce a relocation with a symbol, but just S produces
// a relocation with the section.
.section __TEXT,__literal4,4byte_literals
L0:
.long 42
.section __TEXT,__cstring,cstring_literals
L1:
.asciz "42"
.section __DATA,__data
.quad L0
.quad L0 + 1
.quad L1
.quad L1 + 1
// CHECK: Relocations [
// CHECK-NEXT: Section __data {
// CHECK-NEXT: Relocation {
// CHECK-NEXT: Offset: 0x18
// CHECK-NEXT: PCRel: 0
// CHECK-NEXT: Length: 3
// CHECK-NEXT: Type: ARM64_RELOC_UNSIGNED (0)
// CHECK-NEXT: Symbol: L1
// CHECK-NEXT: }
// CHECK-NEXT: Relocation {
// CHECK-NEXT: Offset: 0x10
// CHECK-NEXT: PCRel: 0
// CHECK-NEXT: Length: 3
// CHECK-NEXT: Type: ARM64_RELOC_UNSIGNED (0)
// CHECK-NEXT: Symbol: L1
// CHECK-NEXT: }
// CHECK-NEXT: Relocation {
// CHECK-NEXT: Offset: 0x8
// CHECK-NEXT: PCRel: 0
// CHECK-NEXT: Length: 3
// CHECK-NEXT: Type: ARM64_RELOC_UNSIGNED (0)
// CHECK-NEXT: Symbol: L0
// CHECK-NEXT: }
// CHECK-NEXT: Relocation {
// CHECK-NEXT: Offset: 0x0
// CHECK-NEXT: PCRel: 0
// CHECK-NEXT: Length: 3
// CHECK-NEXT: Type: ARM64_RELOC_UNSIGNED (0)
// CHECK-NEXT: Symbol: L0
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: ]

View File

@@ -0,0 +1,25 @@
; RUN: llvm-mc -triple arm64-apple-darwin10 %s -filetype=obj -o - | llvm-readobj -r --expand-relocs | FileCheck %s
; Test tha we produce an external relocation. There is no apparent need for it, but
; ld64 (241.9) crashes if we don't.
; CHECK: Relocations [
; CHECK-NEXT: Section __bar {
; CHECK-NEXT: Relocation {
; CHECK-NEXT: Offset: 0x0
; CHECK-NEXT: PCRel: 0
; CHECK-NEXT: Length: 3
; CHECK-NEXT: Type: ARM64_RELOC_UNSIGNED (0)
; CHECK-NEXT: Symbol: Lbar
; CHECK-NEXT: }
; CHECK-NEXT: }
; CHECK-NEXT: ]
.section __TEXT,__cstring
Lfoo:
.asciz "Hello World!"
Lbar:
.asciz "cString"
.section __foo,__bar,literal_pointers
.quad Lbar

View File

@@ -0,0 +1,22 @@
; RUN: llvm-mc -triple arm64-apple-darwin10 %s -filetype=obj -o - | llvm-readobj -r --expand-relocs | FileCheck %s
; This is a regression test making sure we don't crash.
; CHECK: Relocations [
; CHECK-NEXT: Section __text {
; CHECK-NEXT: Relocation {
; CHECK-NEXT: Offset: 0x0
; CHECK-NEXT: PCRel: 0
; CHECK-NEXT: Length: 2
; CHECK-NEXT: Type: ARM64_RELOC_PAGEOFF12 (4)
; CHECK-NEXT: Symbol: ltmp1
; CHECK-NEXT: }
; CHECK-NEXT: }
; CHECK-NEXT: ]
ldr x0, [x8, L_bar@PAGEOFF]
.section __foo,__bar,regular,no_dead_strip
L_bar:
.quad 0

View File

@@ -0,0 +1,10 @@
; RUN: not llvm-mc -triple aarch64-none-macho %s -filetype=obj -o - 2>&1 | FileCheck %s
; CHECK: error: conditional branch requires assembler-local label. 'external' is external.
b.eq external
; CHECK: error: Invalid relocation on conditional branch
tbz w0, #4, external
; CHECK: error: unknown AArch64 fixup kind!
adr x0, external

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: }

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