summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2016-05-26 20:31:00 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2016-05-26 20:31:00 +0000
commit732eeaf2a930ad2755cb4eb5d99a3deae0de4a72 (patch)
treee3c17fbda3987873d62eabe95a436a4008be21c9 /llvm/test
parent4b92326b17498df278addf968818c145034019ed (diff)
downloadbcm5719-llvm-732eeaf2a930ad2755cb4eb5d99a3deae0de4a72.tar.gz
bcm5719-llvm-732eeaf2a930ad2755cb4eb5d99a3deae0de4a72.zip
coff: fix weak alias to local.
We were creating a weak external that tried to reference a static symbol. That would always fail to link with link.exe. We now create an external symbol in the same position as the local and refer to that. This works with link.exe and matches what gas does. llvm-svn: 270906
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/MC/COFF/weak-alias-local.s43
-rw-r--r--llvm/test/MC/COFF/weak.s22
2 files changed, 64 insertions, 1 deletions
diff --git a/llvm/test/MC/COFF/weak-alias-local.s b/llvm/test/MC/COFF/weak-alias-local.s
new file mode 100644
index 00000000000..01f2ac390a5
--- /dev/null
+++ b/llvm/test/MC/COFF/weak-alias-local.s
@@ -0,0 +1,43 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s -o %t.o
+// RUN: llvm-readobj -t %t.o | FileCheck %s
+
+// test that we create an external symbol for a to point to.
+
+ .data
+ .long 123
+b:
+ .long 42
+ .weak a
+a=b
+
+// CHECK: Symbol {
+// CHECK: Name: b
+// CHECK-NEXT: Value: 4
+// CHECK-NEXT: Section: .data (2)
+// CHECK-NEXT: BaseType: Null (0x0)
+// CHECK-NEXT: ComplexType: Null (0x0)
+// CHECK-NEXT: StorageClass: Static (0x3)
+// CHECK-NEXT: AuxSymbolCount: 0
+// CHECK-NEXT: }
+// CHECK-NEXT: Symbol {
+// CHECK-NEXT: Name: a
+// CHECK-NEXT: Value: 0
+// CHECK-NEXT: Section: IMAGE_SYM_UNDEFINED (0)
+// CHECK-NEXT: BaseType: Null (0x0)
+// CHECK-NEXT: ComplexType: Null (0x0)
+// CHECK-NEXT: StorageClass: WeakExternal (0x69)
+// CHECK-NEXT: AuxSymbolCount: 1
+// CHECK-NEXT: AuxWeakExternal {
+// CHECK-NEXT: Linked: .weak.a.default (9)
+// CHECK-NEXT: Search: Library (0x2)
+// CHECK-NEXT: }
+// CHECK-NEXT: }
+// CHECK-NEXT: Symbol {
+// CHECK-NEXT: Name: .weak.a.default
+// CHECK-NEXT: Value: 4
+// CHECK-NEXT: Section: .data (2)
+// CHECK-NEXT: BaseType: Null (0x0)
+// CHECK-NEXT: ComplexType: Null (0x0)
+// CHECK-NEXT: StorageClass: External (0x2)
+// CHECK-NEXT: AuxSymbolCount: 0
+// CHECK-NEXT: }
diff --git a/llvm/test/MC/COFF/weak.s b/llvm/test/MC/COFF/weak.s
index 6086749d80d..e0d077840f1 100644
--- a/llvm/test/MC/COFF/weak.s
+++ b/llvm/test/MC/COFF/weak.s
@@ -35,6 +35,16 @@ LBB0_2: # %return
// CHECK: Symbols [
// CHECK: Symbol {
+// CHECK: Name: _main
+// CHECK-NEXT: Value: 0
+// CHECK-NEXT: Section: .text
+// CHECK-NEXT: BaseType: Null
+// CHECK-NEXT: ComplexType: Function
+// CHECK-NEXT: StorageClass: External
+// CHECK-NEXT: AuxSymbolCount: 0
+// CHECK-NEXT: }
+
+// CHECK: Symbol {
// CHECK: Name: _test_weak
// CHECK-NEXT: Value: 0
// CHECK-NEXT: Section: IMAGE_SYM_UNDEFINED (0)
@@ -67,7 +77,17 @@ LBB0_2: # %return
// CHECK-NEXT: StorageClass: WeakExternal
// CHECK-NEXT: AuxSymbolCount: 1
// CHECK-NEXT: AuxWeakExternal {
-// CHECK-NEXT: Linked: _main
+// CHECK-NEXT: Linked: .weak._test_weak_alias.default
// CHECK-NEXT: Search: Library
// CHECK-NEXT: }
// CHECK-NEXT: }
+
+// CHECK: Symbol {
+// CHECK: Name: .weak._test_weak_alias.default
+// CHECK-NEXT: Value: 0
+// CHECK-NEXT: Section: .text
+// CHECK-NEXT: BaseType: Null
+// CHECK-NEXT: ComplexType: Null
+// CHECK-NEXT: StorageClass: External
+// CHECK-NEXT: AuxSymbolCount: 0
+// CHECK-NEXT: }
OpenPOWER on IntegriCloud