brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.8 KiB · cca778a Raw
149 lines · plain
1REQUIRES: aarch642RUN: split-file %s %t.dir && cd %t.dir3 4RUN: llvm-mc -filetype=obj -triple=arm64ec-windows ext.s -o ext.obj5RUN: llvm-mc -filetype=obj -triple=arm64ec-windows ext-mangled.s -o ext-mangled.obj6RUN: llvm-mc -filetype=obj -triple=arm64ec-windows impl.s -o impl.obj7RUN: llvm-mc -filetype=obj -triple=arm64ec-windows impl-cpp.s -o impl-cpp.obj8RUN: llvm-mc -filetype=obj -triple=arm64ec-windows %S/Inputs/loadconfig-arm64ec.s -o loadconfig.obj9 10# Ensure -alternatename can change a mangled function symbol aliasing a defined symbol (typically a guest exit thunk).11 12RUN: lld-link -machine:arm64ec -dll -noentry -out:out1.dll ext.obj loadconfig.obj "-alternatename:#func=altsym"13 14RUN: llvm-objdump -d out1.dll | FileCheck --check-prefix=DISASM %s15DISASM:      0000000180001000 <.text>:16DISASM-NEXT: 180001000: 52800020     mov     w0, #0x1                // =117DISASM-NEXT: 180001004: d65f03c0     ret18DISASM-NOT: .thnk19 20RUN: llvm-readobj --hex-dump=.test out1.dll | FileCheck --check-prefix=TESTSEC %s21TESTSEC: 0x180005000 00100000 0010000022 23# Ensure -alternatename can change a demangled function symbol aliasing an anti-dependency symbol.24 25RUN: lld-link -machine:arm64ec -dll -noentry -out:out2.dll ext.obj loadconfig.obj -alternatename:func=altsym26 27RUN: llvm-objdump -d out2.dll | FileCheck --check-prefix=DISASM2 %s28DISASM2:      Disassembly of section .text:29DISASM2-EMPTY:30DISASM2-NEXT: 0000000180001000 <.text>:31DISASM2-NEXT: 180001000: 52800020     mov     w0, #0x1                // =132DISASM2-NEXT: 180001004: d65f03c0     ret33DISASM2-EMPTY:34DISASM2-NEXT: Disassembly of section .thnk:35DISASM2-EMPTY:36DISASM2-NEXT: 0000000180006000 <.thnk>:37DISASM2-NEXT: 180006000: 52800040     mov     w0, #0x2                // =238DISASM2-NEXT: 180006004: d65f03c0     ret39 40RUN: llvm-readobj --hex-dump=.test out2.dll | FileCheck --check-prefix=TESTSEC2 %s41TESTSEC2: 0x180005000 00100000 0060000042 43# Ensure -alternatename cannot modify a demangled function symbol aliasing a defined symbol.44 45RUN: lld-link -machine:arm64ec -dll -noentry -out:out3.dll impl.obj loadconfig.obj -alternatename:func=altsym46RUN: llvm-objdump -d out3.dll | FileCheck --check-prefix=DISASM %s47RUN: llvm-readobj --hex-dump=.test out3.dll | FileCheck --check-prefix=TESTSEC %s48 49RUN: lld-link -machine:arm64ec -dll -noentry -out:out4.dll impl-cpp.obj loadconfig.obj -alternatename:func=altsym50RUN: llvm-objdump -d out4.dll | FileCheck --check-prefix=DISASM %s51RUN: llvm-readobj --hex-dump=.test out4.dll | FileCheck --check-prefix=TESTSEC %s52 53# Check that when both mangled and demangled alternate names are used,54# only the one whose target is defined is used (the mangled one in this case).55 56RUN: lld-link -machine:arm64ec -dll -noentry -out:out5.dll ext-mangled.obj loadconfig.obj "-alternatename:#func=#altsym" -alternatename:func=altsym57RUN: llvm-objdump -d out5.dll | FileCheck --check-prefix=DISASM %s58RUN: llvm-readobj --hex-dump=.test out5.dll | FileCheck --check-prefix=TESTSEC %s59 60# Check that when both mangled and demangled alternate names are used,61# only the one whose target is defined is used (the demangled one in this case).62 63RUN: lld-link -machine:arm64ec -dll -noentry -out:out6.dll ext.obj loadconfig.obj "-alternatename:#func=#altsym" -alternatename:func=altsym64RUN: llvm-objdump -d out6.dll | FileCheck --check-prefix=DISASM2 %s65RUN: llvm-readobj --hex-dump=.test out6.dll | FileCheck --check-prefix=TESTSEC2 %s66 67#--- ext.s68        .weak_anti_dep func69.set func, "#func"70        .weak_anti_dep "#func"71.set "#func", thunksym72 73        .section .test, "r"74        .rva func75        .rva "#func"76 77        .section .thnk,"xr",discard,thunksym78thunksym:79        mov w0, #280        ret81 82        .section .text,"xr",discard,altsym83        .globl altsym84altsym:85        mov w0, #186        ret87 88#--- ext-mangled.s89        .weak_anti_dep func90.set func, "#func"91        .weak_anti_dep "#func"92.set "#func", thunksym93 94        .section .test, "r"95        .rva func96        .rva "#func"97 98        .section .thnk,"xr",discard,thunksym99thunksym:100        mov w0, #2101        ret102 103        .section .text,"xr",discard,"#altsym"104        .globl "#altsym"105"#altsym":106        mov w0, #1107        ret108 109        .weak_anti_dep altsym110        .set altsym,"#altsym"111 112#--- impl.s113        .weak_anti_dep func114.set func, "#func"115 116        .section .test, "r"117        .rva func118        .rva "#func"119 120        .section .text,"xr",discard,"#func"121"#func":122        mov w0, #1123        ret124 125        .section .text,"xr",discard,altsym126        .globl altsym127altsym:128        mov w0, #2129        ret130 131#--- impl-cpp.s132        .weak_anti_dep func133.set func, "?func@@$$hYAXXZ"134 135        .section .test, "r"136        .rva func137        .rva "?func@@$$hYAXXZ"138 139        .section .text,"xr",discard,"?func@@$$hYAXXZ"140"?func@@$$hYAXXZ":141        mov w0, #1142        ret143 144        .section .text,"xr",discard,altsym145        .globl altsym146altsym:147        mov w0, #2148        ret149