]> granicus.if.org Git - llvm/commitdiff
[WebAssembly] Add more test coverage for reloctions against section symbols
authorSam Clegg <sbc@chromium.org>
Tue, 7 May 2019 03:53:16 +0000 (03:53 +0000)
committerSam Clegg <sbc@chromium.org>
Tue, 7 May 2019 03:53:16 +0000 (03:53 +0000)
The only known user of this relocation type and symbol type is
the debug info sections, but we were not testing the `--relocatable`
output path.

This change adds a minimal test case to cover relocations against
section symbols includes `--relocatable` output.

Differential Revision: https://reviews.llvm.org/D61623

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360110 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ObjectYAML/WasmYAML.cpp
tools/yaml2obj/yaml2wasm.cpp

index 214aa1c780828473f456c6bd68f272204da813ef..88491d955c497ca5888fcde1dd1d350992bf5053 100644 (file)
@@ -484,7 +484,8 @@ void MappingTraits<WasmYAML::SymbolInfo>::mapping(IO &IO,
                                                   WasmYAML::SymbolInfo &Info) {
   IO.mapRequired("Index", Info.Index);
   IO.mapRequired("Kind", Info.Kind);
-  IO.mapRequired("Name", Info.Name);
+  if (Info.Kind != wasm::WASM_SYMBOL_TYPE_SECTION)
+    IO.mapRequired("Name", Info.Name);
   IO.mapRequired("Flags", Info.Flags);
   if (Info.Kind == wasm::WASM_SYMBOL_TYPE_FUNCTION) {
     IO.mapRequired("Function", Info.ElementIndex);
index cd07a30b74873692c80cf6d4217770bafc9cd6db..758c498bd35e9c7e9441cf65f5ad2d0387e86805 100644 (file)
@@ -532,11 +532,6 @@ int WasmWriter::writeRelocSection(raw_ostream &OS, WasmYAML::Section &Sec,
     break;
   case wasm::WASM_SEC_CUSTOM: {
     auto CustomSection = dyn_cast<WasmYAML::CustomSection>(&Sec);
-    if (!CustomSection->Name.startswith(".debug_")) {
-      llvm_unreachable("not yet implemented (only for debug sections)");
-      return 1;
-    }
-
     writeStringRef(("reloc." + CustomSection->Name).str(), OS);
     break;
   }