Rename CODE_OWNERS -> Maintainers (#114544)
[llvm-project.git] / lld / test / COFF / associative-comdat-mingw-weak.s
blob80c738b436be44a0b92d7c60e719fba3c169b7a4
1 # REQUIRES: x86
3 # RUN: llvm-mc -triple=x86_64-windows-gnu %s -filetype=obj -o %t.obj
4 # RUN: llvm-readobj --symbols %t.obj | FileCheck %s --check-prefix=SYMBOL
6 # RUN: lld-link -lldmingw -entry:main %t.obj -out:%t.exe -lldmap:%t.map -verbose
7 # RUN: llvm-readobj --sections %t.exe | FileCheck %s
9 # CHECK: Sections [
10 # CHECK: Section {
11 # CHECK: Number: 2
12 # CHECK-LABEL: Name: .rdata (2E 72 64 61 74 61 00 00)
13 # This is the critical check to show that .xdata$foo was
14 # retained, while .xdata$bar wasn't. This *must* be 0x24
15 # (0x4 for the .xdata section and 0x20 for the
16 # .ctors/.dtors headers/ends).
17 # CHECK-NEXT: VirtualSize: 0x24
19 # Check that the weak symbols still are emitted as it was when the test was
20 # written, to make sure the test still actually tests what was intended.
22 # SYMBOL: Symbol {
23 # SYMBOL: Name: foo
24 # SYMBOL-NEXT: Value: 0
25 # SYMBOL-NEXT: Section: IMAGE_SYM_UNDEFINED (0)
26 # SYMBOL-NEXT: BaseType: Null (0x0)
27 # SYMBOL-NEXT: ComplexType: Null (0x0)
28 # SYMBOL-NEXT: StorageClass: WeakExternal (0x69)
29 # SYMBOL-NEXT: AuxSymbolCount: 1
30 # SYMBOL-NEXT: AuxWeakExternal {
31 # SYMBOL-NEXT: Linked: .weak.foo.default.main (19)
32 # SYMBOL-NEXT: Search: Alias (0x3)
33 # SYMBOL-NEXT: }
34 # SYMBOL-NEXT: }
36 .text
37 .globl main
38 main:
39 call foo
40 retq
42 # See associative-comdat-mingw.s for the general setup. Here, the leader
43 # symbols are weak, which causes the functions foo and bar to be undefined
44 # weak externals, while the actual leader symbols are named like
45 # .weak.foo.default.main.
47 .section .xdata$foo,"dr"
48 .linkonce discard
49 .long 42
51 .section .xdata$bar,"dr"
52 .linkonce discard
53 .long 43
55 .section .text$foo,"xr",discard,foo
56 .weak foo
57 foo:
58 ret
60 .section .text$bar,"xr",discard,bar
61 .weak bar
62 bar:
63 ret