llvm-6502/test/MC/MachO/aliased-symbols.s
Tim Northover 98f8bc9323 MachO: support N_INDR aliases in assembly files.
This makes LLVM create N_INDR aliases (to be resolved by the linker) when
appropriate.

rdar://problem/15125513

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209894 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-30 13:22:59 +00:00

116 lines
3.4 KiB
ArmAsm

// 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: }
// 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:[0-9A-F]+]]
// 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]]
// 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 (37)
// CHECK-NEXT: Type: Section (0xE)
// CHECK-NEXT: Section: (0x0)
// 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 (1)
// 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: }