summaryrefslogtreecommitdiffstats
path: root/llvm/tools/yaml2obj/yaml2wasm.cpp
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2019-02-07 22:03:32 +0000
committerDan Gohman <dan433584@gmail.com>2019-02-07 22:03:32 +0000
commit29874cea31cee5b1fc2c5b54544921f9eff8f366 (patch)
treef7d4a1afb2dffcbc9b5154d2417dcf344d5c6f71 /llvm/tools/yaml2obj/yaml2wasm.cpp
parent9b84eeaa3ee8db9ab2640ec7305843ac800119dc (diff)
downloadbcm5719-llvm-29874cea31cee5b1fc2c5b54544921f9eff8f366.tar.gz
bcm5719-llvm-29874cea31cee5b1fc2c5b54544921f9eff8f366.zip
[WebAssembly] Fix imported function symbol names that differ from their import names in the .o format
Add a flag to allow symbols to have a wasm import name which differs from the linker symbol name, allowing the linker to link code using the import_module attribute. This is the MC/Object portion of the patch. Differential Revision: https://reviews.llvm.org/D57632 llvm-svn: 353474
Diffstat (limited to 'llvm/tools/yaml2obj/yaml2wasm.cpp')
-rw-r--r--llvm/tools/yaml2obj/yaml2wasm.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/tools/yaml2obj/yaml2wasm.cpp b/llvm/tools/yaml2obj/yaml2wasm.cpp
index a0600c68d91..3398ace3e1e 100644
--- a/llvm/tools/yaml2obj/yaml2wasm.cpp
+++ b/llvm/tools/yaml2obj/yaml2wasm.cpp
@@ -172,7 +172,8 @@ int WasmWriter::writeSectionContent(raw_ostream &OS,
case wasm::WASM_SYMBOL_TYPE_GLOBAL:
case wasm::WASM_SYMBOL_TYPE_EVENT:
encodeULEB128(Info.ElementIndex, SubSection.getStream());
- if ((Info.Flags & wasm::WASM_SYMBOL_UNDEFINED) == 0)
+ if ((Info.Flags & wasm::WASM_SYMBOL_UNDEFINED) == 0 ||
+ (Info.Flags & wasm::WASM_SYMBOL_EXPLICIT_NAME) != 0)
writeStringRef(Info.Name, SubSection.getStream());
break;
case wasm::WASM_SYMBOL_TYPE_DATA:
OpenPOWER on IntegriCloud