[lld] 84a2098 - [lld][LoongArch] Add a another corner testcase for elf::getLoongArchPageDelta
Weining Lu via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 25 04:39:10 PST 2023
Author: Weining Lu
Date: 2023-11-25T20:38:45+08:00
New Revision: 84a20989c6f72d0f7d04c9981d51c7838e95855c
URL: https://github.com/llvm/llvm-project/commit/84a20989c6f72d0f7d04c9981d51c7838e95855c
DIFF: https://github.com/llvm/llvm-project/commit/84a20989c6f72d0f7d04c9981d51c7838e95855c.diff
LOG: [lld][LoongArch] Add a another corner testcase for elf::getLoongArchPageDelta
Similar to e752b58e0d26.
Added:
Modified:
lld/ELF/Arch/LoongArch.cpp
lld/test/ELF/loongarch-pc-aligned.s
Removed:
################################################################################
diff --git a/lld/ELF/Arch/LoongArch.cpp b/lld/ELF/Arch/LoongArch.cpp
index d3a538577a59a5d..1c3e015efc1649a 100644
--- a/lld/ELF/Arch/LoongArch.cpp
+++ b/lld/ELF/Arch/LoongArch.cpp
@@ -165,7 +165,6 @@ uint64_t elf::getLoongArchPageDelta(uint64_t dest, uint64_t pc) {
result -= 0x10000'0000;
else if (!negativeA && negativeB)
result += 0x10000'0000;
-
return result;
}
diff --git a/lld/test/ELF/loongarch-pc-aligned.s b/lld/test/ELF/loongarch-pc-aligned.s
index f6ac56e5261ddb7..e7950400a5c8c45 100644
--- a/lld/test/ELF/loongarch-pc-aligned.s
+++ b/lld/test/ELF/loongarch-pc-aligned.s
@@ -273,6 +273,19 @@
# EXTREME16-NEXT: lu32i.d $t0, 0
# EXTREME16-NEXT: lu52i.d $t0, $t0, 0
+## FIXME: Correct %pc64_lo20 should be 0x00000 (0) and %pc64_hi12 should be 0x000 (0), but current values are:
+## page delta = 0xffffffff80000000, page offset = 0x888
+## %pc_lo12 = 0x888 = -1912
+## %pc_hi20 = 0x80000 = -524288
+## %pc64_lo20 = 0xfffff = -1
+## %pc64_hi12 = 0xfff = -1
+# RUN: ld.lld %t/extreme.o --section-start=.rodata=0x000071238ffff888 --section-start=.text=0x0000712310000678 -o %t/extreme17
+# RUN: llvm-objdump -d --no-show-raw-insn %t/extreme17 | FileCheck %s --check-prefix=EXTREME17
+# EXTREME17: addi.d $t0, $zero, -1912
+# EXTREME17-NEXT: pcalau12i $t1, -524288
+# EXTREME17-NEXT: lu32i.d $t0, -1
+# EXTREME17-NEXT: lu52i.d $t0, $t0, -1
+
#--- a.s
.rodata
x:
More information about the llvm-commits
mailing list