[llvm] r360110 - [WebAssembly] Add more test coverage for reloctions against section symbols

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Mon May 6 20:53:17 PDT 2019


Author: sbc
Date: Mon May  6 20:53:16 2019
New Revision: 360110

URL: http://llvm.org/viewvc/llvm-project?rev=360110&view=rev
Log:
[WebAssembly] Add more test coverage for reloctions against section symbols

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

Modified:
    llvm/trunk/lib/ObjectYAML/WasmYAML.cpp
    llvm/trunk/tools/yaml2obj/yaml2wasm.cpp

Modified: llvm/trunk/lib/ObjectYAML/WasmYAML.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/WasmYAML.cpp?rev=360110&r1=360109&r2=360110&view=diff
==============================================================================
--- llvm/trunk/lib/ObjectYAML/WasmYAML.cpp (original)
+++ llvm/trunk/lib/ObjectYAML/WasmYAML.cpp Mon May  6 20:53:16 2019
@@ -484,7 +484,8 @@ void MappingTraits<WasmYAML::SymbolInfo>
                                                   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);

Modified: llvm/trunk/tools/yaml2obj/yaml2wasm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/yaml2obj/yaml2wasm.cpp?rev=360110&r1=360109&r2=360110&view=diff
==============================================================================
--- llvm/trunk/tools/yaml2obj/yaml2wasm.cpp (original)
+++ llvm/trunk/tools/yaml2obj/yaml2wasm.cpp Mon May  6 20:53:16 2019
@@ -532,11 +532,6 @@ int WasmWriter::writeRelocSection(raw_os
     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;
   }




More information about the llvm-commits mailing list