aboutsummaryrefslogtreecommitdiff
path: root/test/tools/llvm-nm/wasm
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2017-09-06 22:05:41 +0000
committerSam Clegg <sbc@chromium.org>2017-09-06 22:05:41 +0000
commit9f8cb471ac874bccc98d878db9317f31e1072052 (patch)
treea15871964dab49efd45f98f9c2136b72d3d97976 /test/tools/llvm-nm/wasm
parent518513de7ecc409dae973f4101d515c90bb903e7 (diff)
[WebAssembly] Only treat imports/exports as symbols when reading relocatable object files
This change only treats imported and exports functions and globals as symbol table entries the object has a "linking" section (i.e. it is relocatable object file). In this case all globals must be of type I32 and initialized with i32.const. This was previously being assumed but not checked for and was causing a failure on big endian machines due to using the wrong value of then union. See: https://bugs.llvm.org/show_bug.cgi?id=34487 Differential Revision: https://reviews.llvm.org/D37497 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312674 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/tools/llvm-nm/wasm')
-rw-r--r--test/tools/llvm-nm/wasm/exports.yaml8
-rw-r--r--test/tools/llvm-nm/wasm/imports.yaml4
-rw-r--r--test/tools/llvm-nm/wasm/weak-symbols.yaml4
3 files changed, 12 insertions, 4 deletions
diff --git a/test/tools/llvm-nm/wasm/exports.yaml b/test/tools/llvm-nm/wasm/exports.yaml
index 953d17f6ad7..dffe4e3aa8d 100644
--- a/test/tools/llvm-nm/wasm/exports.yaml
+++ b/test/tools/llvm-nm/wasm/exports.yaml
@@ -24,12 +24,12 @@ Sections:
- Type: I32
Mutable: false
InitExpr:
- Opcode: I64_CONST
+ Opcode: I32_CONST
Value: 64
- Type: I32
Mutable: false
InitExpr:
- Opcode: I64_CONST
+ Opcode: I32_CONST
Value: 1024
- Type: IMPORT
Imports:
@@ -50,6 +50,10 @@ Sections:
- Name: bar
Kind: GLOBAL
Index: 0x00000003
+ - Type: CUSTOM
+ Name: "linking"
+ DataSize: 0
+ DataAlignment: 0
# CHECK: 00000400 D bar
# CHECK-NEXT: U fimport
diff --git a/test/tools/llvm-nm/wasm/imports.yaml b/test/tools/llvm-nm/wasm/imports.yaml
index 5122c2cae77..bf2005be9e3 100644
--- a/test/tools/llvm-nm/wasm/imports.yaml
+++ b/test/tools/llvm-nm/wasm/imports.yaml
@@ -20,6 +20,10 @@ Sections:
Kind: GLOBAL
GlobalType: I32
GlobalMutable: false
+ - Type: CUSTOM
+ Name: "linking"
+ DataSize: 0
+ DataAlignment: 0
# CHECK: U bar
# CHECK: U foo
diff --git a/test/tools/llvm-nm/wasm/weak-symbols.yaml b/test/tools/llvm-nm/wasm/weak-symbols.yaml
index 8f0b47f6239..109b15888de 100644
--- a/test/tools/llvm-nm/wasm/weak-symbols.yaml
+++ b/test/tools/llvm-nm/wasm/weak-symbols.yaml
@@ -35,12 +35,12 @@ Sections:
- Type: I32
Mutable: false
InitExpr:
- Opcode: I64_CONST
+ Opcode: I32_CONST
Value: 64
- Type: I32
Mutable: false
InitExpr:
- Opcode: I64_CONST
+ Opcode: I32_CONST
Value: 1024
- Type: EXPORT
Exports: