[lld] b2f227c - [lld][WebAssembly] Convert test to assembly. NFC.
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Tue May 11 11:38:02 PDT 2021
Author: Sam Clegg
Date: 2021-05-11T11:37:53-07:00
New Revision: b2f227c6c87c16fa593e643a487efd9326249066
URL: https://github.com/llvm/llvm-project/commit/b2f227c6c87c16fa593e643a487efd9326249066
DIFF: https://github.com/llvm/llvm-project/commit/b2f227c6c87c16fa593e643a487efd9326249066.diff
LOG: [lld][WebAssembly] Convert test to assembly. NFC.
Differential Revision: https://reviews.llvm.org/D102264
Added:
lld/test/wasm/reloc-addend.s
Modified:
Removed:
lld/test/wasm/reloc-addend.ll
################################################################################
diff --git a/lld/test/wasm/reloc-addend.ll b/lld/test/wasm/reloc-addend.ll
deleted file mode 100644
index 9441f80c30581..0000000000000
--- a/lld/test/wasm/reloc-addend.ll
+++ /dev/null
@@ -1,19 +0,0 @@
-; RUN: llc -filetype=obj %s -o %t.o
-; RUN: wasm-ld -r -o %t.wasm %t.o
-; RUN: obj2yaml %t.wasm | FileCheck %s
-
-target triple = "wasm32-unknown-unknown"
-
- at foo = hidden global [76 x i32] zeroinitializer, align 16
-
-; bar points to the 16th element, which happens to be 64 bytes
-; This generates an addend of 64 which, is the value at which
-; signed and unsigned LEB encodes will
diff er.
- at bar = hidden local_unnamed_addr global i32* getelementptr inbounds ([76 x i32], [76 x i32]* @foo, i32 0, i32 16), align 4
-
-; CHECK: - Type: DATA
-; CHECK-NEXT: Relocations:
-; CHECK-NEXT: - Type: R_WASM_MEMORY_ADDR_I32
-; CHECK-NEXT: Index: 0
-; CHECK-NEXT: Offset: 0x6
-; CHECK-NEXT: Addend: 64
diff --git a/lld/test/wasm/reloc-addend.s b/lld/test/wasm/reloc-addend.s
new file mode 100644
index 0000000000000..56c329614da35
--- /dev/null
+++ b/lld/test/wasm/reloc-addend.s
@@ -0,0 +1,31 @@
+# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
+# RUN: wasm-ld -r -o %t.wasm %t.o
+# RUN: obj2yaml %t.wasm | FileCheck %s
+
+.hidden foo
+.hidden bar
+.globl foo
+.globl bar
+
+# Similar to what would be generated from: `int foo[76]`
+ .section .bss.foo,"",@
+ .p2align 4
+foo:
+ .skip 304
+ .size foo, 304
+
+# bar contains a pointer to the 16th element of foo, which happens to be 64
+# bytes in. This generates an addend of 64 which is the value at which signed
+# and unsigned LEB encodes will
diff er.
+ .section .data.bar,"",@
+ .p2align 2
+bar:
+ .int32 foo+64
+ .size bar, 4
+
+# CHECK: - Type: DATA
+# CHECK-NEXT: Relocations:
+# CHECK-NEXT: - Type: R_WASM_MEMORY_ADDR_I32
+# CHECK-NEXT: Index: 0
+# CHECK-NEXT: Offset: 0x6
+# CHECK-NEXT: Addend: 64
More information about the llvm-commits
mailing list