xref: /llvm-project/lld/test/COFF/arm64ec-hybmp.s (revision fed8e38c195af5b4806b1088c3ef4d772c0ff450)
1REQUIRES: aarch64
2RUN: split-file %s %t.dir && cd %t.dir
3
4#--- text-func.s
5    .text
6    .globl func
7    .p2align 2, 0x0
8func:
9    mov w0, #1
10    ret
11
12    .section .wowthk$aa,"xr",discard,thunk
13    .globl thunk
14    .p2align 2
15thunk:
16    ret
17
18    .section .hybmp$x,"yi"
19    .symidx func
20    .symidx thunk
21    .word 1  // entry thunk
22
23// RUN: llvm-mc -filetype=obj -triple=arm64ec-windows text-func.s -o text-func.obj
24// RUN: not lld-link -machine:arm64ec -dll -noentry -out:test.dll text-func.obj 2>&1 | FileCheck -check-prefix=FUNC-NON-COMDAT %s
25// FUNC-NON-COMDAT: error: non COMDAT symbol 'func' in hybrid map
26
27#--- offset-func.s
28    .section .text,"xr",discard,func
29    // Add an instruction before func label to make adding entry thunk offset in the padding impossible.
30    mov w0, #2
31    .globl func
32    .p2align 2, 0x0
33func:
34    mov w0, #1
35    ret
36
37    .section .wowthk$aa,"xr",discard,thunk
38    .globl thunk
39    .p2align 2
40thunk:
41    ret
42
43    .section .hybmp$x,"yi"
44    .symidx func
45    .symidx thunk
46    .word 1  // entry thunk
47
48// RUN: llvm-mc -filetype=obj -triple=arm64ec-windows offset-func.s -o offset-func.obj
49// RUN: not lld-link -machine:arm64ec -dll -noentry -out:test.dll offset-func.obj 2>&1 | FileCheck -check-prefix=FUNC-NON-COMDAT %s
50
51#--- undef-func.s
52    .section .wowthk$aa,"xr",discard,thunk
53    .globl thunk
54    .p2align 2
55thunk:
56    ret
57
58    .section .hybmp$x,"yi"
59    .symidx func
60    .symidx thunk
61    .word 1  // entry thunk
62
63// RUN: llvm-mc -filetype=obj -triple=arm64ec-windows undef-func.s -o undef-func.obj
64// RUN: not lld-link -machine:arm64ec -dll -noentry -out:test.dll undef-func.obj 2>&1 | FileCheck -check-prefix=UNDEF-FUNC %s
65// UNDEF-FUNC: error: undefined symbol: func
66
67#--- undef-thunk.s
68    .section .text,"xr",discard,func
69    .globl func
70    .p2align 2, 0x0
71func:
72    mov w0, #1
73    ret
74
75    .section .hybmp$x,"yi"
76    .symidx func
77    .symidx thunk
78    .word 1  // entry thunk
79
80// RUN: llvm-mc -filetype=obj -triple=arm64ec-windows undef-thunk.s -o undef-thunk.obj
81// RUN: not lld-link -machine:arm64ec -dll -noentry -out:test.dll undef-thunk.obj 2>&1 | FileCheck -check-prefix=UNDEF-THUNK %s
82// UNDEF-THUNK: error: undefined symbol: thunk
83
84#--- invalid-type.s
85    .section .text,"xr",discard,func
86    .globl func
87    .p2align 2, 0x0
88func:
89    mov w0, #1
90    ret
91
92    .section .wowthk$aa,"xr",discard,thunk
93    .globl thunk
94    .p2align 2
95thunk:
96    ret
97
98    .section .hybmp$x,"yi"
99    .symidx func
100    .symidx thunk
101    .word 3
102
103// RUN: llvm-mc -filetype=obj -triple=arm64ec-windows invalid-type.s -o invalid-type.obj
104// RUN: lld-link -machine:arm64ec -dll -noentry -out:test.dll invalid-type.obj 2>&1 | FileCheck -check-prefix=INVALID-TYPE %s
105// INVALID-TYPE: warning: Ignoring unknown EC thunk type 3
106
107#--- invalid-size.s
108    .section .hybmp$x,"yi"
109    .symidx func
110    .symidx thunk
111
112// RUN: llvm-mc -filetype=obj -triple=arm64ec-windows invalid-size.s -o invalid-size.obj
113// RUN: not lld-link -machine:arm64ec -dll -noentry -out:test.dll invalid-size.obj 2>&1 | FileCheck -check-prefix=INVALID-SIZE %s
114// INVALID-SIZE: error: Invalid .hybmp chunk size 8
115