brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.2 KiB · 1e6fa60 Raw
162 lines · plain
1REQUIRES: aarch64, x862RUN: split-file %s %t.dir && cd %t.dir3 4RUN: llvm-mc -filetype=obj -triple=arm64ec-windows symref.s -o symref-arm64ec.obj5RUN: llvm-mc -filetype=obj -triple=arm64ec-windows nsymref.s -o nsymref-arm64ec.obj6RUN: llvm-mc -filetype=obj -triple=aarch64-windows nsymref.s -o nsymref-aarch64.obj7RUN: llvm-mc -filetype=obj -triple=arm64ec-windows sym.s -o sym-arm64ec.obj8RUN: llvm-mc -filetype=obj -triple=x86_64-windows sym.s -o sym-x86_64.obj9RUN: llvm-mc -filetype=obj -triple=aarch64-windows nsym.s -o nsym-aarch64.obj10RUN: llvm-mc -filetype=obj -triple=arm64ec-windows ref-alias.s -o ref-alias.obj11RUN: llvm-mc -filetype=obj -triple=arm64ec-windows ref-thunk.s -o ref-thunk.obj12RUN: llvm-mc -filetype=obj -triple=arm64ec-windows func.s -o func.obj13RUN: llvm-mc -filetype=obj -triple=x86_64-windows func-x86_64.s -o func-x86_64.obj14RUN: llvm-mc -filetype=obj -triple=aarch64-windows %S/Inputs/loadconfig-arm64.s -o loadconfig-arm64.obj15RUN: llvm-mc -filetype=obj -triple=arm64ec-windows %S/Inputs/loadconfig-arm64ec.s -o loadconfig-arm64ec.obj16 17RUN: llvm-lib -machine:arm64ec -out:sym-arm64ec.lib sym-arm64ec.obj nsym-aarch64.obj18RUN: llvm-lib -machine:amd64 -out:sym-x86_64.lib sym-x86_64.obj19RUN: llvm-lib -machine:arm64ec -out:func.lib func.obj20RUN: llvm-lib -machine:arm64ec -out:func-x86_64.lib func-x86_64.obj21RUN: llvm-lib -machine:arm64ec -out:func-imp.lib -def:func.def22 23Verify that a symbol can be referenced from ECSYMBOLS.24RUN: lld-link -machine:arm64ec -dll -noentry -out:test.dll symref-arm64ec.obj sym-arm64ec.lib loadconfig-arm64ec.obj25 26Verify that a symbol can be referenced from a regular archive map when ECSYMBOLS is absent (using an x86_64 archive).27RUN: lld-link -machine:arm64ec -dll -noentry -out:test2.dll symref-arm64ec.obj sym-x86_64.lib loadconfig-arm64ec.obj28 29Verify that both native and EC symbols can be referenced in a hybrid target.30RUN: lld-link -machine:arm64x -dll -noentry -out:test3.dll symref-arm64ec.obj nsymref-aarch64.obj sym-arm64ec.lib \31RUN:          loadconfig-arm64.obj loadconfig-arm64ec.obj32RUN: lld-link -machine:arm64ec -dll -noentry -out:test3ec.dll symref-arm64ec.obj nsymref-aarch64.obj sym-arm64ec.lib \33RUN:          loadconfig-arm64.obj loadconfig-arm64ec.obj34 35Ensure that an EC symbol is not resolved using a regular symbol map.36RUN: not lld-link -machine:arm64ec -dll -noentry -out:test-err.dll nsymref-arm64ec.obj sym-arm64ec.lib loadconfig-arm64ec.obj 2>&1 |\37RUN:              FileCheck --check-prefix=ERR %s38ERR: error: undefined symbol: nsym (EC symbol)39 40Verify that a library symbol can be referenced, even if its name conflicts with an anti-dependency alias.41RUN: lld-link -machine:arm64ec -dll -noentry -out:ref-alias-1.dll ref-alias.obj func.lib loadconfig-arm64ec.obj42RUN: llvm-objdump -d ref-alias-1.dll | FileCheck -check-prefix=DISASM %s43DISASM:      0000000180001000 <.text>:44DISASM-NEXT: 180001000: d65f03c0     ret45DISASM-EMPTY:46 47RUN: llvm-readobj --hex-dump=.test ref-alias-1.dll | FileCheck -check-prefix=TESTSEC %s48TESTSEC: 0x180005000 0010000049 50The same test, but with a different input order.51RUN: lld-link -machine:arm64ec -dll -noentry -out:ref-alias-2.dll func.lib ref-alias.obj loadconfig-arm64ec.obj52RUN: llvm-objdump -d ref-alias-2.dll | FileCheck -check-prefix=DISASM %s53RUN: llvm-readobj --hex-dump=.test ref-alias-2.dll | FileCheck -check-prefix=TESTSEC %s54 55Verify that when an anti-dependency to a guess exit thunk is present, it is overridden by an archive symbol.56RUN: lld-link -machine:arm64ec -dll -noentry -out:ref-thunk-1.dll ref-thunk.obj func.lib loadconfig-arm64ec.obj57RUN: llvm-objdump -d ref-thunk-1.dll | FileCheck -check-prefix=DISASM %s58RUN: llvm-readobj --hex-dump=.test ref-thunk-1.dll | FileCheck -check-prefix=TESTSEC %s59 60The same test, but with a different input order.61RUN: lld-link -machine:arm64ec -dll -noentry -out:ref-thunk-2.dll func.lib ref-thunk.obj loadconfig-arm64ec.obj62RUN: llvm-objdump -d ref-thunk-2.dll | FileCheck -check-prefix=DISASM %s63RUN: llvm-readobj --hex-dump=.test ref-thunk-2.dll | FileCheck -check-prefix=TESTSEC %s64 65Pass multiple libraries containing `func` with different manglings and ensure they don't conflict with each other.66RUN: lld-link -machine:arm64ec -dll -noentry -out:ref-thunk-3.dll func.lib loadconfig-arm64ec.obj func-x86_64.lib func-imp.lib ref-thunk.obj67RUN: llvm-objdump -d ref-thunk-3.dll | FileCheck -check-prefix=DISASM %s68RUN: llvm-readobj --hex-dump=.test ref-thunk-3.dll | FileCheck -check-prefix=TESTSEC %s69 70RUN: lld-link -machine:arm64ec -dll -noentry -out:ref-thunk-4.dll ref-thunk.obj func.lib loadconfig-arm64ec.obj func-x86_64.lib func-imp.lib71RUN: llvm-objdump -d ref-thunk-4.dll | FileCheck -check-prefix=DISASM %s72RUN: llvm-readobj --hex-dump=.test ref-thunk-4.dll | FileCheck -check-prefix=TESTSEC %s73 74Test linking against an x86_64 library (which uses a demangled function name).75RUN: lld-link -machine:arm64ec -dll -noentry -out:ref-x86-1.dll ref-thunk.obj func-x86_64.lib loadconfig-arm64ec.obj76RUN: llvm-objdump -d ref-x86-1.dll | FileCheck -check-prefix=DISASM-X86 %s77RUN: llvm-readobj --hex-dump=.test ref-x86-1.dll | FileCheck -check-prefix=TESTSEC %s78 79DISASM-X86:      0000000180001000 <.text>:80DISASM-X86-NEXT: 180001000: c3                           retq81 82The same test, but with a different input order.83RUN: lld-link -machine:arm64ec -dll -noentry -out:ref-x86-2.dll func-x86_64.lib ref-thunk.obj loadconfig-arm64ec.obj84RUN: llvm-objdump -d ref-x86-2.dll | FileCheck -check-prefix=DISASM-X86 %s85RUN: llvm-readobj --hex-dump=.test ref-x86-2.dll | FileCheck -check-prefix=TESTSEC %s86 87Check that an alias to the implementation takes precedence over an archive symbol.88RUN: lld-link -machine:arm64ec -dll -noentry -out:ref-x86-2.dll func-x86_64.lib func.obj ref-thunk.obj loadconfig-arm64ec.obj89RUN: llvm-objdump -d ref-x86-2.dll | FileCheck -check-prefix=DISASM %s90RUN: llvm-readobj --hex-dump=.test ref-x86-2.dll | FileCheck -check-prefix=TESTSEC %s91 92A similar test using -start-lib for linking.93RUN: lld-link -machine:arm64ec -dll -noentry -out:start-lib-1.dll ref-thunk.obj -start-lib func.obj -end-lib loadconfig-arm64ec.obj94RUN: llvm-objdump -d start-lib-1.dll | FileCheck -check-prefix=DISASM %s95RUN: llvm-readobj --hex-dump=.test start-lib-1.dll | FileCheck -check-prefix=TESTSEC %s96 97RUN: lld-link -machine:arm64ec -dll -noentry -out:start-lib-2.dll ref-thunk.obj -start-lib func.obj -end-lib loadconfig-arm64ec.obj \98RUN:          -start-lib func-x86_64.obj -end-lib func-imp.lib99RUN: llvm-objdump -d ref-thunk-3.dll | FileCheck -check-prefix=DISASM %s100RUN: llvm-readobj --hex-dump=.test ref-thunk-3.dll | FileCheck -check-prefix=TESTSEC %s101 102#--- symref.s103    .data104    .rva sym105 106#--- nsymref.s107    .data108    .rva nsym109 110#--- sym.s111     .data112     .globl sym113sym:114     .word 0115 116#--- nsym.s117     .data118     .globl nsym119nsym:120     .word 0121 122#--- ref-alias.s123    .weak_anti_dep func124.set func,"#func"125 126    .section .test, "r"127    .rva func128 129#--- ref-thunk.s130    .weak_anti_dep func131.set func, "#func"132    .weak_anti_dep "#func"133.set "#func", thunksym134 135    .section .test, "r"136    .rva func137 138    .section .thnk,"xr",discard,thunksym139thunksym:140    mov w0, #2141    ret142 143#--- func.s144    .text145    .globl "#func"146"#func":147    ret148 149    .weak_anti_dep func150.set func,"#func"151 152#--- func-x86_64.s153    .text154    .globl func155func:156    ret157 158#--- func.def159LIBRARY func.dll160EXPORTS161        func162