[WebAssembly] Add more details to llvm-readobj for wasm files
authorSam Clegg <sbc@chromium.org>
Mon, 10 Jul 2017 20:47:12 +0000 (20:47 +0000)
committerSam Clegg <sbc@chromium.org>
Mon, 10 Jul 2017 20:47:12 +0000 (20:47 +0000)
Differential Revision: https://reviews.llvm.org/D35208

llvm-svn: 307588

llvm/test/tools/llvm-readobj/sections.test
llvm/tools/llvm-readobj/WasmDumper.cpp

index 05dd613..4eda5da 100644 (file)
@@ -561,5 +561,7 @@ WASM-NEXT:     Type: CUSTOM (0x0)
 WASM-NEXT:     Size: 22
 WASM-NEXT:     Offset: 257
 WASM-NEXT:     Name: linking
+WASM-NEXT:     DataSize: 13
+WASM-NEXT:     DataAlignment: 1
 WASM-NEXT:   }
 WASM-NEXT: ]
index 14603f8..266226d 100644 (file)
@@ -153,6 +153,12 @@ void WasmDumper::printSections() {
     switch (WasmSec.Type) {
     case wasm::WASM_SEC_CUSTOM:
       W.printString("Name", WasmSec.Name);
+      if (WasmSec.Name == "linking") {
+        const wasm::WasmLinkingData &LinkingData = Obj->linkingData();
+        W.printNumber("DataSize", LinkingData.DataSize);
+        if (LinkingData.DataAlignment)
+          W.printNumber("DataAlignment", LinkingData.DataAlignment);
+      }
       break;
     case wasm::WASM_SEC_MEMORY:
       ListScope Group(W, "Memories");