diff options
author | Kai Luo <lkail@cn.ibm.com> | 2023-07-25 08:21:43 +0000 |
---|---|---|
committer | Kai Luo <lkail@cn.ibm.com> | 2023-07-25 08:27:03 +0000 |
commit | cee4494c14d821104ad839c44c047bacd652b8dd (patch) | |
tree | 1c0d7ceae412e6e2eb10c6613ed24ff621bb702b | |
parent | 9dcd232f4afabdad46e5bc2d71834765acd7738c (diff) | |
download | llvm-cee4494c14d821104ad839c44c047bacd652b8dd.zip llvm-cee4494c14d821104ad839c44c047bacd652b8dd.tar.gz llvm-cee4494c14d821104ad839c44c047bacd652b8dd.tar.bz2 |
[JITLink][PowerPC] Pre-commit test for D155925. NFC.
3 files changed, 67 insertions, 0 deletions
diff --git a/llvm/test/ExecutionEngine/JITLink/ppc64/Inputs/external_weak.s b/llvm/test/ExecutionEngine/JITLink/ppc64/Inputs/external_weak.s new file mode 100644 index 0000000..45d52fd --- /dev/null +++ b/llvm/test/ExecutionEngine/JITLink/ppc64/Inputs/external_weak.s @@ -0,0 +1,13 @@ + .text + .abiversion 2 + .weak foo + .p2align 4 + .type foo,@function +foo: +.Lfunc_begin0: + li 3, 1 + blr + .long 0 + .quad 0 +.Lfunc_end0: + .size foo, .Lfunc_end0-.Lfunc_begin0 diff --git a/llvm/test/ExecutionEngine/JITLink/ppc64/Inputs/external_weak_main.s b/llvm/test/ExecutionEngine/JITLink/ppc64/Inputs/external_weak_main.s new file mode 100644 index 0000000..5c58547 --- /dev/null +++ b/llvm/test/ExecutionEngine/JITLink/ppc64/Inputs/external_weak_main.s @@ -0,0 +1,37 @@ + .text + .abiversion 2 + .weak foo + .p2align 4 + .type foo,@function +foo: +.Lfunc_begin0: + li 3, 0 + blr + .long 0 + .quad 0 +.Lfunc_end0: + .size foo, .Lfunc_end0-.Lfunc_begin0 + + .globl main + .p2align 4 + .type main,@function +main: +.Lfunc_begin1: +.Lfunc_gep1: + addis 2, 12, .TOC.-.Lfunc_gep1@ha + addi 2, 2, .TOC.-.Lfunc_gep1@l +.Lfunc_lep1: + .localentry main, .Lfunc_lep1-.Lfunc_gep1 + mflr 0 + stdu 1, -32(1) + std 0, 48(1) + bl foo + nop + addi 1, 1, 32 + ld 0, 16(1) + mtlr 0 + blr + .long 0 + .quad 0 +.Lfunc_end1: + .size main, .Lfunc_end1-.Lfunc_begin1 diff --git a/llvm/test/ExecutionEngine/JITLink/ppc64/external_weak.s b/llvm/test/ExecutionEngine/JITLink/ppc64/external_weak.s new file mode 100644 index 0000000..3fda4ce --- /dev/null +++ b/llvm/test/ExecutionEngine/JITLink/ppc64/external_weak.s @@ -0,0 +1,17 @@ +# REQUIRES: asserts +# RUN: rm -rf %t && mkdir -p %t +# RUN: llvm-mc -triple=powerpc64le-unknown-linux-gnu -filetype=obj -o \ +# RUN: %t/external_weak.o %S/Inputs/external_weak.s +# RUN: llvm-mc -triple=powerpc64le-unknown-linux-gnu -filetype=obj -o \ +# RUN: %t/external_weak_main.o %S/Inputs/external_weak_main.s +# RUN: llvm-jitlink -noexec -debug-only=jitlink %t/external_weak.o \ +# RUN: %t/external_weak_main.o 2>&1 | FileCheck %s +# CHECK: Created ELFLinkGraphBuilder for "{{.*}}external_weak_main.o" +# CHECK: Creating defined graph symbol for ELF symbol "foo" +# CHECK: External symbols: +# CHECK: {{.*}} linkage: weak, scope: default, dead - foo +# CHECK: section .text: +# CHECK: {{.*}} kind = CallBranchDelta, target = foo +# `foo` is weak in both relocatable files. `foo` is resolved to the one +# defined in `%t/external_weak.o`. So calling `foo` in `%t/external_weak_main.o` +# is expected to be an external function call. |