154 lines · plain
1REQUIRES: aarch642RUN: split-file %s %t.dir && cd %t.dir3 4RUN: llvm-mc -filetype=obj -triple=arm64ec-windows func-arm64ec.s -o func-arm64ec.obj5RUN: llvm-mc -filetype=obj -triple=aarch64-windows func-arm64.s -o func-arm64.obj6RUN: llvm-mc -filetype=obj -triple=arm64ec-windows ref-arm64ec.s -o ref-arm64ec.obj7RUN: llvm-mc -filetype=obj -triple=aarch64-windows ref-arm64.s -o ref-arm64.obj8RUN: llvm-mc -filetype=obj -triple=arm64ec-windows drectve.s -o drectve.obj9RUN: llvm-mc -filetype=obj -triple=aarch64-windows drectve.s -o drectve-arm64.obj10RUN: llvm-mc -filetype=obj -triple=arm64ec-windows %S/Inputs/loadconfig-arm64ec.s -o loadconfig-arm64ec.obj11RUN: llvm-mc -filetype=obj -triple=aarch64-windows %S/Inputs/loadconfig-arm64.s -o loadconfig-arm64.obj12 13RUN: lld-link -machine:arm64x -dll -noentry -out:out.dll loadconfig-arm64.obj loadconfig-arm64ec.obj \14RUN: func-arm64.obj func-arm64ec.obj ref-arm64.obj ref-arm64ec.obj drectve.obj15 16RUN: llvm-objdump -d out.dll | FileCheck --check-prefix=DISASM %s17DISASM: 000000180001000 <.text>:18DISASM-NEXT: 180001000: d2800020 mov x0, #0x1 // =119DISASM-NEXT: 180001004: d65f03c0 ret20DISASM-NEXT: ...21DISASM-NEXT: 180002000: 00000019 udf #0x1922DISASM-NEXT: 180002004: d2800040 mov x0, #0x2 // =223DISASM-NEXT: 180002008: d65f03c0 ret24DISASM-NEXT: 18000200c: 0000000d udf #0xd25DISASM-NEXT: 180002010: f0fffff0 adrp x16, 0x180001000 <.text>26DISASM-NEXT: 180002014: 91000210 add x16, x16, #0x027DISASM-NEXT: 180002018: d61f0200 br x1628DISASM-NEXT: 18000201c: d2800060 mov x0, #0x3 // =329DISASM-NEXT: 180002020: d65f03c0 ret30 31RUN: llvm-readobj --hex-dump=.test out.dll | FileCheck --check-prefix=TESTSEC %s32TESTSEC: 10200000 10200000 1020000033 34RUN: llvm-readobj --coff-load-config out.dll | FileCheck --check-prefix=DYNRELOCS %s35DYNRELOCS: DynamicRelocations [36DYNRELOCS-NEXT: Version: 0x137DYNRELOCS-NEXT: Arm64X [38DYNRELOCS-NEXT: Entry [39DYNRELOCS-NEXT: RVA: 0x7C40DYNRELOCS-NEXT: Type: VALUE41DYNRELOCS-NEXT: Size: 0x242DYNRELOCS-NEXT: Value: 0x866443DYNRELOCS-NEXT: ]44DYNRELOCS-NEXT: Entry [45DYNRELOCS-NEXT: RVA: 0x15046DYNRELOCS-NEXT: Type: VALUE47DYNRELOCS-NEXT: Size: 0x448DYNRELOCS-NEXT: Value: 0x315049DYNRELOCS-NEXT: ]50DYNRELOCS-NEXT: Entry [51DYNRELOCS-NEXT: RVA: 0x15452DYNRELOCS-NEXT: Type: VALUE53DYNRELOCS-NEXT: Size: 0x454DYNRELOCS-NEXT: Value: 0x14055DYNRELOCS-NEXT: ]56DYNRELOCS-NEXT: Entry [57DYNRELOCS-NEXT: RVA: 0x201058DYNRELOCS-NEXT: Type: VALUE59DYNRELOCS-NEXT: Size: 0x460DYNRELOCS-NEXT: Value: 0x9000001061DYNRELOCS-NEXT: ]62DYNRELOCS-NEXT: Entry [63DYNRELOCS-NEXT: RVA: 0x201464DYNRELOCS-NEXT: Type: VALUE65DYNRELOCS-NEXT: Size: 0x466DYNRELOCS-NEXT: Value: 0x9100121067DYNRELOCS-NEXT: ]68DYNRELOCS-NEXT: ]69DYNRELOCS-NEXT: ]70 71RUN: lld-link -machine:arm64x -dll -noentry -out:out-cmd.dll loadconfig-arm64.obj loadconfig-arm64ec.obj \72RUN: func-arm64.obj func-arm64ec.obj ref-arm64.obj ref-arm64ec.obj -arm64xsameaddress:func73RUN: llvm-objdump -d out-cmd.dll | FileCheck --check-prefix=DISASM %s74RUN: llvm-readobj --hex-dump=.test out-cmd.dll | FileCheck --check-prefix=TESTSEC %s75RUN: llvm-readobj --coff-load-config out-cmd.dll | FileCheck --check-prefix=DYNRELOCS %s76 77RUN: lld-link -machine:arm64x -dll -noentry -out:out-both.dll loadconfig-arm64.obj loadconfig-arm64ec.obj \78RUN: func-arm64.obj func-arm64ec.obj ref-arm64.obj ref-arm64ec.obj drectve.obj -arm64xsameaddress:func79RUN: llvm-objdump -d out-both.dll | FileCheck --check-prefix=DISASM %s80RUN: llvm-readobj --hex-dump=.test out-both.dll | FileCheck --check-prefix=TESTSEC %s81RUN: llvm-readobj --coff-load-config out-both.dll | FileCheck --check-prefix=DYNRELOCS %s82 83Check that if any of the sameaddress symbols is not alive, the thunk is not generated.84 85RUN: lld-link -machine:arm64x -dll -noentry -out:out-live1.dll loadconfig-arm64.obj loadconfig-arm64ec.obj \86RUN: func-arm64.obj func-arm64ec.obj ref-arm64ec.obj drectve.obj87RUN: llvm-objdump -d out-live1.dll | FileCheck --check-prefix=DISASM-LIVE1 %s88DISASM-LIVE1: 0000000180001000 <.text>:89DISASM-LIVE1-NEXT: 180001000: 00000009 udf #0x990DISASM-LIVE1-NEXT: 180001004: d2800040 mov x0, #0x2 // =291DISASM-LIVE1-NEXT: 180001008: d65f03c0 ret92DISASM-LIVE1-NEXT: 18000100c: d2800060 mov x0, #0x3 // =393DISASM-LIVE1-NEXT: 180001010: d65f03c0 ret94DISASM-LIVE1-NOT: br95 96RUN: lld-link -machine:arm64x -dll -noentry -out:out-live2.dll loadconfig-arm64.obj loadconfig-arm64ec.obj \97RUN: func-arm64.obj func-arm64ec.obj ref-arm64.obj drectve.obj98RUN: llvm-objdump -d out-live2.dll | FileCheck --check-prefix=DISASM-LIVE2 %s99DISASM-LIVE2: 0000000180001000 <.text>:100DISASM-LIVE2-NEXT: 180001000: d2800020 mov x0, #0x1 // =1101DISASM-LIVE2-NEXT: 180001004: d65f03c0 ret102DISASM-LIVE2-NOT: br103 104RUN: lld-link -machine:arm64ec -dll -noentry -out:out-ec.dll loadconfig-arm64ec.obj func-arm64ec.obj drectve.obj105 106RUN: lld-link -machine:arm64x -dll -noentry -out:out-warn.dll loadconfig-arm64.obj loadconfig-arm64ec.obj \107RUN: func-arm64.obj func-arm64ec.obj drectve-arm64.obj 2>&1 | FileCheck --check-prefix=WARN %s108WARN: lld-link: warning: -arm64xsameaddress: is not allowed in non-ARM64EC files (drectve-arm64.obj)109 110RUN: lld-link -machine:arm64 -dll -noentry -out:out-warn2.dll loadconfig-arm64.obj \111RUN: func-arm64.obj -arm64xsameaddress:func 2>&1 | FileCheck --check-prefix=WARN2 %s112WARN2: lld-link: warning: -arm64xsameaddress: is allowed only on EC targets113 114#--- func-arm64.s115 .section .text,"xr",discard,func116 .globl func117func:118 mov x0, #1119 ret120 121#--- ref-arm64.s122 .section .test,"dr"123 .rva func124 125#--- func-arm64ec.s126 .section .text,"xr",discard,"#func"127 .globl "#func"128"#func":129 mov x0, #2130 ret131 132 .weak_anti_dep func133 .set func,"#func"134 135 .section .wowthk,"xr",discard,entry_thunk136 .globl entry_thunk137entry_thunk:138 mov x0, #3139 ret140 141 .section .hybmp$x,"yi"142 .symidx "#func"143 .symidx entry_thunk144 .word 1145 146#--- ref-arm64ec.s147 .section .test,"dr"148 .rva func149 .rva "#func"150 151#--- drectve.s152 .section .drectve, "yn"153 .ascii " -arm64xsameaddress:func"154