[llvm] cee4494 - [JITLink][PowerPC] Pre-commit test for D155925. NFC.
Kai Luo via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 25 01:27:34 PDT 2023
Author: Kai Luo
Date: 2023-07-25T08:27:03Z
New Revision: cee4494c14d821104ad839c44c047bacd652b8dd
URL: https://github.com/llvm/llvm-project/commit/cee4494c14d821104ad839c44c047bacd652b8dd
DIFF: https://github.com/llvm/llvm-project/commit/cee4494c14d821104ad839c44c047bacd652b8dd.diff
LOG: [JITLink][PowerPC] Pre-commit test for D155925. NFC.
Added:
llvm/test/ExecutionEngine/JITLink/ppc64/Inputs/external_weak.s
llvm/test/ExecutionEngine/JITLink/ppc64/Inputs/external_weak_main.s
llvm/test/ExecutionEngine/JITLink/ppc64/external_weak.s
Modified:
Removed:
################################################################################
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 00000000000000..45d52fdf19360b
--- /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, at 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 00000000000000..5c5854793421d7
--- /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, at 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, at function
+main:
+.Lfunc_begin1:
+.Lfunc_gep1:
+ addis 2, 12, .TOC.-.Lfunc_gep1 at ha
+ addi 2, 2, .TOC.-.Lfunc_gep1 at 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 00000000000000..3fda4cec4394c0
--- /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.
More information about the llvm-commits
mailing list