2011-04-25 07:11:23 +00:00
|
|
|
// This tests that default-null weak symbols (a GNU extension) are created
|
|
|
|
// properly via the .weak directive.
|
|
|
|
|
2013-04-12 04:06:46 +00:00
|
|
|
// RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s | llvm-readobj -t | FileCheck %s
|
|
|
|
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s | llvm-readobj -t | FileCheck %s
|
2011-04-25 07:11:23 +00:00
|
|
|
|
|
|
|
.def _main;
|
|
|
|
.scl 2;
|
|
|
|
.type 32;
|
|
|
|
.endef
|
|
|
|
.text
|
|
|
|
.globl _main
|
|
|
|
.align 16, 0x90
|
|
|
|
_main: # @main
|
|
|
|
# BB#0: # %entry
|
|
|
|
subl $4, %esp
|
|
|
|
movl $_test_weak, %eax
|
|
|
|
testl %eax, %eax
|
|
|
|
je LBB0_2
|
|
|
|
# BB#1: # %if.then
|
2013-04-12 04:06:46 +00:00
|
|
|
call _test_weak
|
2011-04-25 07:11:23 +00:00
|
|
|
movl $1, %eax
|
|
|
|
addl $4, %esp
|
|
|
|
ret
|
|
|
|
LBB0_2: # %return
|
|
|
|
xorl %eax, %eax
|
|
|
|
addl $4, %esp
|
|
|
|
ret
|
|
|
|
|
|
|
|
.weak _test_weak
|
|
|
|
|
2013-04-22 18:48:56 +00:00
|
|
|
.weak _test_weak_alias
|
|
|
|
_test_weak_alias=_main
|
|
|
|
|
2013-04-12 04:06:46 +00:00
|
|
|
// CHECK: Symbols [
|
2011-04-25 07:11:23 +00:00
|
|
|
|
2013-04-12 04:06:46 +00:00
|
|
|
// CHECK: Symbol {
|
|
|
|
// CHECK: Name: _test_weak
|
|
|
|
// CHECK-NEXT: Value: 0
|
|
|
|
// CHECK-NEXT: Section: (0)
|
|
|
|
// CHECK-NEXT: BaseType: Null
|
|
|
|
// CHECK-NEXT: ComplexType: Null
|
|
|
|
// CHECK-NEXT: StorageClass: WeakExternal
|
|
|
|
// CHECK-NEXT: AuxSymbolCount: 1
|
|
|
|
// CHECK-NEXT: AuxWeakExternal {
|
|
|
|
// CHECK-NEXT: Linked: .weak._test_weak.default
|
|
|
|
// CHECK-NEXT: Search: Library
|
|
|
|
// CHECK-NEXT: Unused: (00 00 00 00 00 00 00 00 00 00)
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: }
|
2011-04-25 07:11:23 +00:00
|
|
|
|
2013-04-12 04:06:46 +00:00
|
|
|
// CHECK: Symbol {
|
|
|
|
// CHECK: Name: .weak._test_weak.default
|
|
|
|
// CHECK-NEXT: Value: 0
|
|
|
|
// CHECK-NEXT: Section: (-1)
|
|
|
|
// CHECK-NEXT: BaseType: Null
|
|
|
|
// CHECK-NEXT: ComplexType: Null
|
|
|
|
// CHECK-NEXT: StorageClass: External
|
|
|
|
// CHECK-NEXT: AuxSymbolCount: 0
|
|
|
|
// CHECK-NEXT: }
|
2013-04-22 18:48:56 +00:00
|
|
|
|
|
|
|
// CHECK: Symbol {
|
|
|
|
// CHECK: Name: _test_weak_alias
|
|
|
|
// CHECK-NEXT: Value: 0
|
|
|
|
// CHECK-NEXT: Section: (0)
|
|
|
|
// CHECK-NEXT: BaseType: Null
|
|
|
|
// CHECK-NEXT: ComplexType: Null
|
|
|
|
// CHECK-NEXT: StorageClass: WeakExternal
|
|
|
|
// CHECK-NEXT: AuxSymbolCount: 1
|
|
|
|
// CHECK-NEXT: AuxWeakExternal {
|
|
|
|
// CHECK-NEXT: Linked: _main
|
|
|
|
// CHECK-NEXT: Search: Library
|
|
|
|
// CHECK-NEXT: Unused: (00 00 00 00 00 00 00 00 00 00)
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: }
|