Rename CODE_OWNERS -> Maintainers (#114544)
[llvm-project.git] / lld / test / COFF / ordinals-override.test
blob026e3c7195ab526a3e7eb3852855ab6ceb196157
1 # RUN: yaml2obj %s -o %t.obj
3 # RUN: lld-link /out:%t.dll /dll %t.obj
4 # RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK1 %s
6 # CHECK1:      Export Table:
7 # CHECK1:      DLL name: ordinals-override.test.tmp.dll
8 # CHECK1:      Ordinal base: 1
9 # CHECK1:      Ordinal      RVA  Name
10 # CHECK1-NEXT:       1   0x1010  ?bar@@YAXXZ
11 # CHECK1-NEXT:       2   0x1000  ?foo@@YAXXZ
12 # CHECK1-NEXT:       3   0x1020  baz
14 # RUN: lld-link /out:%t.dll /dll %t.obj /EXPORT:?foo@@YAXXZ,@55
15 # RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK2 %s
17 # CHECK2:      Export Table:
18 # CHECK2:      DLL name: ordinals-override.test.tmp.dll
19 # CHECK2:      Ordinal base: 55
20 # CHECK2:      Ordinal      RVA  Name
21 # CHECK2-NEXT:      55   0x1000  ?foo@@YAXXZ
22 # CHECK2-NEXT:      56   0x1010  ?bar@@YAXXZ
23 # CHECK2-NEXT:      57   0x1020  baz
25 # RUN: lld-link /out:%t.dll /dll %t.obj /EXPORT:?foo@@YAXXZ,@55 /EXPORT:?bar@@YAXXZ,@122
26 # RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK3 %s
28 # CHECK3:      Export Table:
29 # CHECK3:      DLL name: ordinals-override.test.tmp.dll
30 # CHECK3:      Ordinal base: 55
31 # CHECK3:      Ordinal      RVA  Name
32 # CHECK3-NEXT:      55   0x1000  ?foo@@YAXXZ
33 # CHECK3-NEXT:     122   0x1010  ?bar@@YAXXZ
34 # CHECK3-NEXT:     123   0x1020  baz
36 # RUN: echo "EXPORTS" > %t.def
37 # RUN: echo "?foo@@YAXXZ @55" >> %t.def
38 # RUN: echo "?bar@@YAXXZ @122" >> %t.def
39 # RUN: lld-link /out:%t.dll /dll %t.obj /DEF:%t.def 2>&1 | FileCheck --check-prefix=WARN --allow-empty %s
40 # WARN-NOT: lld-link: warning
42 # RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK3 %s
44 # RUN: lld-link /out:%t.dll /dll %t.obj /DEF:%t.def /EXPORT:?foo@@YAXXZ,@10000 2>&1 | FileCheck --check-prefix=DUPLICATED %s
45 # DUPLICATED: lld-link: warning: duplicate export: ?foo@@YAXXZ first seen in /export, now in /def
47 # RUN: llvm-objdump -p %t.dll | FileCheck --check-prefix=CHECK4 %s
49 # CHECK4:      Export Table:
50 # CHECK4:      DLL name: ordinals-override.test.tmp.dll
51 # CHECK4:      Ordinal base: 122
52 # CHECK4:      Ordinal      RVA  Name
53 # CHECK4-NEXT:     122   0x1010  ?bar@@YAXXZ
54 # CHECK4-NEXT:   10000   0x1000  ?foo@@YAXXZ
55 # CHECK4-NEXT:   10001   0x1020  baz
57 # The .drectve section below contains the following:
59 #   Linker Directives
60 #   -----------------
61 #   /export:baz=?baz@@YAXXZ
62 #   /EXPORT:?foo@@YAXXZ
63 #   /EXPORT:?bar@@YAXXZ
65 --- !COFF
66 header:
67   Machine:         IMAGE_FILE_MACHINE_AMD64
68   Characteristics: [  ]
69 sections:
70   - Name:            .drectve
71     Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ]
72     Alignment:       1
73     SectionData:     2f6578706f72743a62617a3d3f62617a4040594158585a202f4558504f52543a3f666f6f4040594158585a202f4558504f52543a3f6261724040594158585a
74   - Name:            '.text$mn'
75     Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
76     Alignment:       16
77     SectionData:     C20000CCCCCCCCCCCCCCCCCCCCCCCCCCC20000CCCCCCCCCCCCCCCCCCCCCCCCCCC20000
78 symbols:
79   - Name:            '.text$mn'
80     Value:           0
81     SectionNumber:   2
82     SimpleType:      IMAGE_SYM_TYPE_NULL
83     ComplexType:     IMAGE_SYM_DTYPE_NULL
84     StorageClass:    IMAGE_SYM_CLASS_STATIC
85     SectionDefinition:
86       Length:          35
87       NumberOfRelocations: 0
88       NumberOfLinenumbers: 0
89       CheckSum:        0
90       Number:          0
91   - Name:            _DllMainCRTStartup
92     Value:           0
93     SectionNumber:   2
94     SimpleType:      IMAGE_SYM_TYPE_NULL
95     ComplexType:     IMAGE_SYM_DTYPE_NULL
96     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
97   - Name:            '?foo@@YAXXZ'
98     Value:           0
99     SectionNumber:   2
100     SimpleType:      IMAGE_SYM_TYPE_NULL
101     ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
102     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
103   - Name:            '?bar@@YAXXZ'
104     Value:           16
105     SectionNumber:   2
106     SimpleType:      IMAGE_SYM_TYPE_NULL
107     ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
108     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
109   - Name:            '?baz@@YAXXZ'
110     Value:           32
111     SectionNumber:   2
112     SimpleType:      IMAGE_SYM_TYPE_NULL
113     ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
114     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL