diff options
author | Nicholas Wilson <nicholas@nicholaswilson.me.uk> | 2018-03-09 16:30:44 +0000 |
---|---|---|
committer | Nicholas Wilson <nicholas@nicholaswilson.me.uk> | 2018-03-09 16:30:44 +0000 |
commit | 15f349f76f076202a8569ffdf15db153168bf4a2 (patch) | |
tree | b7861b14e64ee98d74c8a5d50d7438f48a8ae39b /llvm/test | |
parent | 69df838b5298eb33b7f94c826e714f91abeafa53 (diff) | |
download | bcm5719-llvm-15f349f76f076202a8569ffdf15db153168bf4a2.tar.gz bcm5719-llvm-15f349f76f076202a8569ffdf15db153168bf4a2.zip |
[WebAssembly] Disallow weak undefined globals in the object format
This implements https://github.com/WebAssembly/tool-conventions/pull/47
Differential Revision: https://reviews.llvm.org/D44201
llvm-svn: 327146
Diffstat (limited to 'llvm/test')
-rw-r--r-- | llvm/test/ObjectYAML/wasm/invalid_global_weak.yaml | 24 | ||||
-rw-r--r-- | llvm/test/tools/llvm-nm/wasm/weak-symbols.yaml | 17 |
2 files changed, 27 insertions, 14 deletions
diff --git a/llvm/test/ObjectYAML/wasm/invalid_global_weak.yaml b/llvm/test/ObjectYAML/wasm/invalid_global_weak.yaml new file mode 100644 index 00000000000..557882dcaab --- /dev/null +++ b/llvm/test/ObjectYAML/wasm/invalid_global_weak.yaml @@ -0,0 +1,24 @@ +# RUN: yaml2obj < %s | not obj2yaml 2>&1 | FileCheck %s + +--- !WASM +FileHeader: + Version: 0x00000001 +Sections: + - Type: IMPORT + Imports: + - Module: fiz + Field: imported_global + Kind: GLOBAL + GlobalType: I32 + GlobalMutable: false + - Type: CUSTOM + Name: linking + SymbolTable: + - Index: 0 + Kind: GLOBAL + Name: imported_global + Flags: [ BINDING_WEAK, UNDEFINED ] + Global: 0 +... + +# CHECK: Error reading file: <stdin>: undefined weak global symbol diff --git a/llvm/test/tools/llvm-nm/wasm/weak-symbols.yaml b/llvm/test/tools/llvm-nm/wasm/weak-symbols.yaml index 1d0b0d1f6b5..e758194e2ff 100644 --- a/llvm/test/tools/llvm-nm/wasm/weak-symbols.yaml +++ b/llvm/test/tools/llvm-nm/wasm/weak-symbols.yaml @@ -18,16 +18,11 @@ Sections: Field: weak_import_func Kind: FUNCTION SigIndex: 0 - - Module: env - Field: weak_import_global - Kind: GLOBAL - GlobalType: I32 - GlobalMutable: false - Type: FUNCTION FunctionTypes: [ 0 ] - Type: GLOBAL Globals: - - Index: 1 + - Index: 0 Type: I32 Mutable: false InitExpr: @@ -64,7 +59,7 @@ Sections: Kind: GLOBAL Name: weak_defined_global Flags: [ BINDING_WEAK ] - Global: 1 + Global: 0 - Index: 3 Kind: DATA Name: weak_import_data @@ -74,11 +69,6 @@ Sections: Name: weak_import_func Flags: [ BINDING_WEAK, UNDEFINED ] Function: 0 - - Index: 5 - Kind: GLOBAL - Name: weak_import_global - Flags: [ BINDING_WEAK, UNDEFINED ] - Global: 0 SegmentInfo: - Index: 0 Name: .rodata.constantData @@ -88,7 +78,6 @@ Sections: # CHECK: 00000000 W weak_defined_data # CHECK-NEXT: 00000001 W weak_defined_func -# CHECK-NEXT: 00000001 W weak_defined_global +# CHECK-NEXT: 00000000 W weak_defined_global # CHECK-NEXT: w weak_import_data # CHECK-NEXT: w weak_import_func -# CHECK-NEXT: w weak_import_global |