summaryrefslogtreecommitdiffstats
path: root/lld/test/wasm
diff options
context:
space:
mode:
Diffstat (limited to 'lld/test/wasm')
-rw-r--r--lld/test/wasm/Inputs/locals-duplicate1.ll6
-rw-r--r--lld/test/wasm/Inputs/locals-duplicate2.ll6
-rw-r--r--lld/test/wasm/bss-only.ll14
-rw-r--r--lld/test/wasm/custom-section-name.ll17
-rw-r--r--lld/test/wasm/data-layout.ll6
-rw-r--r--lld/test/wasm/data-segments.ll11
-rw-r--r--lld/test/wasm/locals-duplicate.test26
7 files changed, 43 insertions, 43 deletions
diff --git a/lld/test/wasm/Inputs/locals-duplicate1.ll b/lld/test/wasm/Inputs/locals-duplicate1.ll
index f118dd4bd67..3e62d8c5090 100644
--- a/lld/test/wasm/Inputs/locals-duplicate1.ll
+++ b/lld/test/wasm/Inputs/locals-duplicate1.ll
@@ -1,11 +1,11 @@
target triple = "wasm32-unknown-unknown"
; Will collide: local (internal linkage) with global (external) linkage
-@colliding_global1 = internal default global i32 0, align 4
+@colliding_global1 = internal default global i32 1, align 4
; Will collide: global with local
-@colliding_global2 = default global i32 0, align 4
+@colliding_global2 = default global i32 1, align 4
; Will collide: local with local
-@colliding_global3 = internal default global i32 0, align 4
+@colliding_global3 = internal default global i32 1, align 4
; Will collide: local with global
define internal i32 @colliding_func1() {
diff --git a/lld/test/wasm/Inputs/locals-duplicate2.ll b/lld/test/wasm/Inputs/locals-duplicate2.ll
index 617abfea0cd..c6b38f3107a 100644
--- a/lld/test/wasm/Inputs/locals-duplicate2.ll
+++ b/lld/test/wasm/Inputs/locals-duplicate2.ll
@@ -1,11 +1,11 @@
target triple = "wasm32-unknown-unknown"
; Will collide: local (internal linkage) with global (external) linkage
-@colliding_global1 = default global i32 0, align 4
+@colliding_global1 = default global i32 1, align 4
; Will collide: global with local
-@colliding_global2 = internal default global i32 0, align 4
+@colliding_global2 = internal default global i32 1, align 4
; Will collide: local with local
-@colliding_global3 = internal default global i32 0, align 4
+@colliding_global3 = internal default global i32 1, align 4
; Will collide: local with global
define i32 @colliding_func1() {
diff --git a/lld/test/wasm/bss-only.ll b/lld/test/wasm/bss-only.ll
new file mode 100644
index 00000000000..23f94a1a3eb
--- /dev/null
+++ b/lld/test/wasm/bss-only.ll
@@ -0,0 +1,14 @@
+; RUN: llc -filetype=obj %s -o %t.o
+; RUN: wasm-ld -no-gc-sections --no-entry %t.o -o %t.wasm
+; RUN: obj2yaml %t.wasm | FileCheck %s
+
+; Test that the data section is skipped entirely when there are only
+; bss segments
+
+target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
+target triple = "wasm32-unknown-unknown"
+
+@a = global [1000 x i8] zeroinitializer, align 1
+@b = global i32 0
+
+; CHECK-NOT: - Type: DATA
diff --git a/lld/test/wasm/custom-section-name.ll b/lld/test/wasm/custom-section-name.ll
index 2d46810b137..b860ef5a83e 100644
--- a/lld/test/wasm/custom-section-name.ll
+++ b/lld/test/wasm/custom-section-name.ll
@@ -1,6 +1,8 @@
; RUN: llc -filetype=obj %s -o %t.o
; RUN: wasm-ld -no-gc-sections --no-entry -o %t.wasm %t.o
-; RUN: obj2yaml %t.wasm | FileCheck %s
+; RUN: obj2yaml %t.wasm | FileCheck %s --check-prefixes=CHECK,NO-BSS
+; RUN: wasm-ld -no-gc-sections --no-entry --import-memory -o %t.bss.wasm %t.o
+; RUN: obj2yaml %t.bss.wasm | FileCheck %s --check-prefixes=CHECK,BSS
; RUN: wasm-ld -no-gc-sections --no-entry -o %t_reloc.o %t.o --relocatable
; RUN: obj2yaml %t_reloc.o | FileCheck -check-prefix RELOC %s
@@ -32,12 +34,13 @@ target triple = "wasm32-unknown-unknown"
; CHECK-NEXT: Opcode: I32_CONST
; CHECK-NEXT: Value: 1032
; CHECK-NEXT: Content: '07000000'
-; CHECK-NEXT: - SectionOffset: 37
-; CHECK-NEXT: InitFlags: 0
-; CHECK-NEXT: Offset:
-; CHECK-NEXT: Opcode: I32_CONST
-; CHECK-NEXT: Value: 1036
-; CHECK-NEXT: Content: '00000000'
+; BSS-NEXT: - SectionOffset: 37
+; BSS-NEXT: InitFlags: 0
+; BSS-NEXT: Offset:
+; BSS-NEXT: Opcode: I32_CONST
+; BSS-NEXT: Value: 1036
+; BSS-NEXT: Content: '00000000'
+; NO-BSS-NOT: - SectionOffset:
; RELOC-LABEL: SegmentInfo:
; RELOC-NEXT: - Index: 0
diff --git a/lld/test/wasm/data-layout.ll b/lld/test/wasm/data-layout.ll
index 2db83e99355..02ff0ecd8b9 100644
--- a/lld/test/wasm/data-layout.ll
+++ b/lld/test/wasm/data-layout.ll
@@ -54,12 +54,6 @@ target triple = "wasm32-unknown-unknown"
; CHECK-NEXT: Opcode: I32_CONST
; CHECK-NEXT: Value: 1040
; CHECK-NEXT: Content: '0100000000000000000000000000000003000000000000000004000034040000'
-; CHECK-NEXT: - SectionOffset: 58
-; CHECK-NEXT: InitFlags: 0
-; CHECK-NEXT: Offset:
-; CHECK-NEXT: Opcode: I32_CONST
-; CHECK-NEXT: Value: 1072
-; CHECK-NEXT: Content: '0000000000000000'
; CHECK-NEXT: - Type: CUSTOM
diff --git a/lld/test/wasm/data-segments.ll b/lld/test/wasm/data-segments.ll
index 0a15b241cb3..7c5af8f7430 100644
--- a/lld/test/wasm/data-segments.ll
+++ b/lld/test/wasm/data-segments.ll
@@ -44,13 +44,6 @@ target triple = "wasm32-unknown-unknown"
; ACTIVE-NEXT: Opcode: I32_CONST
; ACTIVE-NEXT: Value: 1040
; ACTIVE-NEXT: Content: 68656C6C6F00676F6F646279650000002A000000
-; ACTIVE-NEXT: - SectionOffset: 53
-; ACTIVE-NEXT: InitFlags: 0
-; ACTIVE-NEXT: Offset:
-; ACTIVE-NEXT: Opcode: I32_CONST
-; ACTIVE-NEXT: Value: 1060
-; ACTIVE-NEXT: Content: '0000000000
-; ACTIVE-SAME: 0000000000'
; ACTIVE-NEXT: - Type: CUSTOM
; ACTIVE-NEXT: Name: name
; ACTIVE-NEXT: FunctionNames:
@@ -78,10 +71,6 @@ target triple = "wasm32-unknown-unknown"
; PASSIVE-NEXT: - SectionOffset: 18
; PASSIVE-NEXT: InitFlags: 1
; PASSIVE-NEXT: Content: 68656C6C6F00676F6F646279650000002A000000
-; PASSIVE-NEXT: - SectionOffset: 41
-; PASSIVE-NEXT: InitFlags: 1
-; PASSIVE-NEXT: Content: '0000000000
-; PASSIVE-SAME: 0000000000'
; PASSIVE-NEXT: - Type: CUSTOM
; PASSIVE-NEXT: Name: name
; PASSIVE-NEXT: FunctionNames:
diff --git a/lld/test/wasm/locals-duplicate.test b/lld/test/wasm/locals-duplicate.test
index ce02c7fc3bf..067d96f6197 100644
--- a/lld/test/wasm/locals-duplicate.test
+++ b/lld/test/wasm/locals-duplicate.test
@@ -167,7 +167,7 @@
; CHECK-NEXT: Offset:
; CHECK-NEXT: Opcode: I32_CONST
; CHECK-NEXT: Value: 1024
-; CHECK-NEXT: Content: '000000000000000000000000000000000000000000000000'
+; CHECK-NEXT: Content: '010000000100000001000000010000000100000001000000'
; CHECK-NEXT: - Type: CUSTOM
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
@@ -299,13 +299,13 @@
; RELOC-NEXT: Locals:
; RELOC-NEXT: Body: 4190808080000B
; RELOC-NEXT: - Index: 6
-; RELOC-NEXT: Locals:
+; RELOC-NEXT: Locals:
; RELOC-NEXT: Body: 4181808080000B
; RELOC-NEXT: - Index: 7
-; RELOC-NEXT: Locals:
+; RELOC-NEXT: Locals:
; RELOC-NEXT: Body: 4182808080000B
; RELOC-NEXT: - Index: 8
-; RELOC-NEXT: Locals:
+; RELOC-NEXT: Locals:
; RELOC-NEXT: Body: 4183808080000B
; RELOC-NEXT: - Index: 9
; RELOC-NEXT: Locals:
@@ -326,13 +326,13 @@
; RELOC-NEXT: Locals:
; RELOC-NEXT: Body: 4194808080000B
; RELOC-NEXT: - Index: 15
-; RELOC-NEXT: Locals:
+; RELOC-NEXT: Locals:
; RELOC-NEXT: Body: 4184808080000B
; RELOC-NEXT: - Index: 16
-; RELOC-NEXT: Locals:
+; RELOC-NEXT: Locals:
; RELOC-NEXT: Body: 4185808080000B
; RELOC-NEXT: - Index: 17
-; RELOC-NEXT: Locals:
+; RELOC-NEXT: Locals:
; RELOC-NEXT: Body: 4186808080000B
; RELOC-NEXT: - Type: DATA
; RELOC-NEXT: Segments:
@@ -341,19 +341,19 @@
; RELOC-NEXT: Offset:
; RELOC-NEXT: Opcode: I32_CONST
; RELOC-NEXT: Value: 0
-; RELOC-NEXT: Content: '0000000000000000'
+; RELOC-NEXT: Content: '0100000001000000'
; RELOC-NEXT: - SectionOffset: 19
; RELOC-NEXT: InitFlags: 0
; RELOC-NEXT: Offset:
; RELOC-NEXT: Opcode: I32_CONST
; RELOC-NEXT: Value: 8
-; RELOC-NEXT: Content: '0000000000000000'
+; RELOC-NEXT: Content: '0100000001000000'
; RELOC-NEXT: - SectionOffset: 32
; RELOC-NEXT: InitFlags: 0
; RELOC-NEXT: Offset:
; RELOC-NEXT: Opcode: I32_CONST
; RELOC-NEXT: Value: 16
-; RELOC-NEXT: Content: '0000000000000000'
+; RELOC-NEXT: Content: '0100000001000000'
; RELOC-NEXT: - Type: CUSTOM
; RELOC-NEXT: Name: linking
; RELOC-NEXT: Version: 2
@@ -489,15 +489,15 @@
; RELOC-NEXT: Size: 4
; RELOC-NEXT: SegmentInfo:
; RELOC-NEXT: - Index: 0
-; RELOC-NEXT: Name: .bss.colliding_global1
+; RELOC-NEXT: Name: .data.colliding_global1
; RELOC-NEXT: Alignment: 2
; RELOC-NEXT: Flags: [ ]
; RELOC-NEXT: - Index: 1
-; RELOC-NEXT: Name: .bss.colliding_global2
+; RELOC-NEXT: Name: .data.colliding_global2
; RELOC-NEXT: Alignment: 2
; RELOC-NEXT: Flags: [ ]
; RELOC-NEXT: - Index: 2
-; RELOC-NEXT: Name: .bss.colliding_global3
+; RELOC-NEXT: Name: .data.colliding_global3
; RELOC-NEXT: Alignment: 2
; RELOC-NEXT: Flags: [ ]
; RELOC-NEXT: - Type: CUSTOM
OpenPOWER on IntegriCloud