[lld][WebAssemby] Allow import module names to be empty strings.
The component-model [canonical ABI] is currently using import names with empty strings. Remove the special cases for empty strings from WasmObjectFile.cpp so that they can pass through as-is. [canonical ABI]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md Differential Revision: https://reviews.llvm.org/D133037
This commit is contained in:
parent
7e52e0fc72
commit
9f049e9993
|
@ -6,12 +6,15 @@ target triple = "wasm32-unknown-unknown-wasm"
|
|||
|
||||
define void @_start() {
|
||||
call void @foo();
|
||||
call void @qux();
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @foo() #0
|
||||
declare void @qux() #1
|
||||
|
||||
attributes #0 = { "wasm-import-module"="bar" }
|
||||
attributes #1 = { "wasm-import-module"="" }
|
||||
|
||||
; CHECK: - Type: IMPORT
|
||||
; CHECK-NEXT: Imports:
|
||||
|
@ -19,3 +22,7 @@ attributes #0 = { "wasm-import-module"="bar" }
|
|||
; CHECK-NEXT: Field: foo
|
||||
; CHECK-NEXT: Kind: FUNCTION
|
||||
; CHECK-NEXT: SigIndex: 0
|
||||
; CHECK-NEXT: - Module: ''
|
||||
; CHECK-NEXT: Field: qux
|
||||
; CHECK-NEXT: Kind: FUNCTION
|
||||
; CHECK-NEXT: SigIndex: 0
|
||||
|
|
|
@ -5,13 +5,16 @@
|
|||
target triple = "wasm32-unknown-unknown"
|
||||
|
||||
declare void @f0() #0
|
||||
declare void @f1() #1
|
||||
|
||||
define void @_start() {
|
||||
call void @f0()
|
||||
call void @f1()
|
||||
ret void
|
||||
}
|
||||
|
||||
attributes #0 = { "wasm-import-module"="somewhere" "wasm-import-name"="something" }
|
||||
attributes #1 = { "wasm-import-module"="otherwhere" "wasm-import-name"="" }
|
||||
|
||||
; CHECK: - Type: IMPORT
|
||||
; CHECK-NEXT: Imports:
|
||||
|
@ -19,9 +22,15 @@ attributes #0 = { "wasm-import-module"="somewhere" "wasm-import-name"="something
|
|||
; CHECK-NEXT: Field: something
|
||||
; CHECK-NEXT: Kind: FUNCTION
|
||||
; CHECK-NEXT: SigIndex: 0
|
||||
; CHECK-NEXT: - Module: otherwhere
|
||||
; CHECK-NEXT: Field: ''
|
||||
; CHECK-NEXT: Kind: FUNCTION
|
||||
; CHECK-NEXT: SigIndex: 0
|
||||
|
||||
; CHECK: - Type: CUSTOM
|
||||
; CHECK-NEXT: Name: name
|
||||
; CHECK-NEXT: FunctionNames:
|
||||
; CHECK-NEXT: - Index: 0
|
||||
; CHECK-NEXT: Name: f0
|
||||
; CHECK-NEXT: - Index: 1
|
||||
; CHECK-NEXT: Name: f1
|
||||
|
|
|
@ -640,9 +640,7 @@ Error WasmObjectFile::parseLinkingSectionSymtab(ReadContext &Ctx) {
|
|||
Info.Name = Import.Field;
|
||||
}
|
||||
Signature = &Signatures[Import.SigIndex];
|
||||
if (!Import.Module.empty()) {
|
||||
Info.ImportModule = Import.Module;
|
||||
}
|
||||
Info.ImportModule = Import.Module;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -672,9 +670,7 @@ Error WasmObjectFile::parseLinkingSectionSymtab(ReadContext &Ctx) {
|
|||
Info.Name = Import.Field;
|
||||
}
|
||||
GlobalType = &Import.Global;
|
||||
if (!Import.Module.empty()) {
|
||||
Info.ImportModule = Import.Module;
|
||||
}
|
||||
Info.ImportModule = Import.Module;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -704,9 +700,7 @@ Error WasmObjectFile::parseLinkingSectionSymtab(ReadContext &Ctx) {
|
|||
Info.Name = Import.Field;
|
||||
}
|
||||
TableType = &Import.Table;
|
||||
if (!Import.Module.empty()) {
|
||||
Info.ImportModule = Import.Module;
|
||||
}
|
||||
Info.ImportModule = Import.Module;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -769,9 +763,7 @@ Error WasmObjectFile::parseLinkingSectionSymtab(ReadContext &Ctx) {
|
|||
Info.Name = Import.Field;
|
||||
}
|
||||
Signature = &Signatures[Import.SigIndex];
|
||||
if (!Import.Module.empty()) {
|
||||
Info.ImportModule = Import.Module;
|
||||
}
|
||||
Info.ImportModule = Import.Module;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue