summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ObjectYAML
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2018-01-09 23:43:14 +0000
committerSam Clegg <sbc@chromium.org>2018-01-09 23:43:14 +0000
commitea7caceedcc8d872bc31c141515ef2e3749ef659 (patch)
tree7499d1e4ee969bda41210ab8d2e5d7c339c07b44 /llvm/lib/ObjectYAML
parent29f5f987f1b76b5c43310b2062c9f447667a4f80 (diff)
downloadbcm5719-llvm-ea7caceedcc8d872bc31c141515ef2e3749ef659.tar.gz
bcm5719-llvm-ea7caceedcc8d872bc31c141515ef2e3749ef659.zip
[WebAssembly] Add COMDAT support
This adds COMDAT support to the Wasm object-file format. Spec: https://github.com/WebAssembly/tool-conventions/pull/31 Corresponding LLD change: https://bugs.llvm.org/show_bug.cgi?id=35533, and D40845 Patch by Nicholas Wilson Differential Revision: https://reviews.llvm.org/D40844 llvm-svn: 322135
Diffstat (limited to 'llvm/lib/ObjectYAML')
-rw-r--r--llvm/lib/ObjectYAML/WasmYAML.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/lib/ObjectYAML/WasmYAML.cpp b/llvm/lib/ObjectYAML/WasmYAML.cpp
index 70721e006da..4ae6dccccb1 100644
--- a/llvm/lib/ObjectYAML/WasmYAML.cpp
+++ b/llvm/lib/ObjectYAML/WasmYAML.cpp
@@ -61,6 +61,7 @@ static void sectionMapping(IO &IO, WasmYAML::LinkingSection &Section) {
IO.mapOptional("SymbolInfo", Section.SymbolInfos);
IO.mapOptional("SegmentInfo", Section.SegmentInfos);
IO.mapOptional("InitFunctions", Section.InitFunctions);
+ IO.mapOptional("Comdats", Section.Comdats);
}
static void sectionMapping(IO &IO, WasmYAML::CustomSection &Section) {
@@ -368,6 +369,26 @@ void MappingTraits<WasmYAML::InitFunction>::mapping(
IO.mapRequired("FunctionIndex", Init.FunctionIndex);
}
+void ScalarEnumerationTraits<WasmYAML::ComdatKind>::enumeration(
+ IO &IO, WasmYAML::ComdatKind &Kind) {
+#define ECase(X) IO.enumCase(Kind, #X, wasm::WASM_COMDAT_##X);
+ ECase(FUNCTION);
+ ECase(DATA);
+#undef ECase
+}
+
+void MappingTraits<WasmYAML::ComdatEntry>::mapping(
+ IO &IO, WasmYAML::ComdatEntry &ComdatEntry) {
+ IO.mapRequired("Kind", ComdatEntry.Kind);
+ IO.mapRequired("Index", ComdatEntry.Index);
+}
+
+void MappingTraits<WasmYAML::Comdat>::mapping(
+ IO &IO, WasmYAML::Comdat &Comdat) {
+ IO.mapRequired("Name", Comdat.Name);
+ IO.mapRequired("Entries", Comdat.Entries);
+}
+
void MappingTraits<WasmYAML::SymbolInfo>::mapping(IO &IO,
WasmYAML::SymbolInfo &Info) {
IO.mapRequired("Name", Info.Name);
OpenPOWER on IntegriCloud