[lld] r285607 - Emit Section Map stream.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 31 10:40:40 PDT 2016


Author: ruiu
Date: Mon Oct 31 12:40:40 2016
New Revision: 285607

URL: http://llvm.org/viewvc/llvm-project?rev=285607&view=rev
Log:
Emit Section Map stream.

This is how we use DbiStreamBuilder::addSectionMap.

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

Modified:
    lld/trunk/COFF/PDB.cpp
    lld/trunk/test/COFF/pdb.test

Modified: lld/trunk/COFF/PDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/PDB.cpp?rev=285607&r1=285606&r2=285607&view=diff
==============================================================================
--- lld/trunk/COFF/PDB.cpp (original)
+++ lld/trunk/COFF/PDB.cpp Mon Oct 31 12:40:40 2016
@@ -19,6 +19,7 @@
 #include "llvm/DebugInfo/PDB/Raw/PDBFileBuilder.h"
 #include "llvm/DebugInfo/PDB/Raw/TpiStream.h"
 #include "llvm/DebugInfo/PDB/Raw/TpiStreamBuilder.h"
+#include "llvm/Object/COFF.h"
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/FileOutputBuffer.h"
 #include <memory>
@@ -63,6 +64,14 @@ void coff::createPDB(StringRef Path, Arr
   auto &IpiBuilder = Builder.getIpiBuilder();
   IpiBuilder.setVersionHeader(pdb::PdbTpiV80);
 
+  // Add Section Map stream.
+  ArrayRef<object::coff_section> Sections
+      = {(object::coff_section *)SectionTable.data(),
+         SectionTable.size() / sizeof(object::coff_section)};
+  std::vector<pdb::SecMapEntry> SectionMap =
+      pdb::DbiStreamBuilder::createSectionMap(Sections);
+  DbiBuilder.setSectionMap(SectionMap);
+
   // Add COFF section header stream.
   ExitOnErr(
       DbiBuilder.addDbgStream(pdb::DbgHeaderType::SectionHdr, SectionTable));

Modified: lld/trunk/test/COFF/pdb.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/pdb.test?rev=285607&r1=285606&r2=285607&view=diff
==============================================================================
--- lld/trunk/test/COFF/pdb.test (original)
+++ lld/trunk/test/COFF/pdb.test Mon Oct 31 12:40:40 2016
@@ -3,7 +3,8 @@
 # RUN: llvm-pdbdump pdb2yaml -stream-metadata -stream-directory -pdb-stream \
 # RUN:   -dbi-stream -ipi-stream %t.pdb | FileCheck %s
 
-# RUN: llvm-pdbdump raw -section-headers %t.pdb | FileCheck -check-prefix RAW %s
+# RUN: llvm-pdbdump raw -section-map -section-headers %t.pdb | \
+# RUN:   FileCheck -check-prefix RAW %s
 
 # CHECK:      MSF:
 # CHECK-NEXT:   SuperBlock:
@@ -17,7 +18,7 @@
 # CHECK-NEXT:     DirectoryBlocks: [ 9 ]
 # CHECK-NEXT:     NumStreams:      6
 # CHECK-NEXT:     FileSize:        40960
-# CHECK-NEXT:   StreamSizes:     [ 0, 48, 56, 90, 56, 80 ]
+# CHECK-NEXT:   StreamSizes:     [ 0, 48, 56, 154, 56, 80 ]
 # CHECK-NEXT:   StreamMap:
 # CHECK-NEXT:     - Stream:          [  ]
 # CHECK-NEXT:     - Stream:          [ 5 ]
@@ -43,7 +44,51 @@
 # CHECK-NEXT:     Version:         VC80
 # CHECK-NEXT:     Records:
 
-# RAW:      Section Headers [
+# RAW:       Section Map [
+# RAW-NEXT:    Entry {
+# RAW-NEXT:      Flags [ (0x10D)
+# RAW-NEXT:      AddressIs32Bit (0x8)
+# RAW-NEXT:       Execute (0x4)
+# RAW-NEXT:       IsSelector (0x100)
+# RAW-NEXT:       Read (0x1)
+# RAW-NEXT:     ]
+# RAW-NEXT:     Ovl: 0
+# RAW-NEXT:     Group: 0
+# RAW-NEXT:     Frame: 1
+# RAW-NEXT:     SecName: 65535
+# RAW-NEXT:     ClassName: 65535
+# RAW-NEXT:     Offset: 0
+# RAW-NEXT:     SecByteLength: 3
+# RAW-NEXT:   }
+# RAW-NEXT:   Entry {
+# RAW-NEXT:     Flags [ (0x109)
+# RAW-NEXT:       AddressIs32Bit (0x8)
+# RAW-NEXT:       IsSelector (0x100)
+# RAW-NEXT:       Read (0x1)
+# RAW-NEXT:     ]
+# RAW-NEXT:     Ovl: 0
+# RAW-NEXT:     Group: 0
+# RAW-NEXT:     Frame: 2
+# RAW-NEXT:     SecName: 65535
+# RAW-NEXT:     ClassName: 65535
+# RAW-NEXT:     Offset: 0
+# RAW-NEXT:     SecByteLength: 107
+# RAW-NEXT:   }
+# RAW-NEXT:   Entry {
+# RAW-NEXT:     Flags [ (0x208)
+# RAW-NEXT:       AddressIs32Bit (0x8)
+# RAW-NEXT:       IsAbsoluteAddress (0x200)
+# RAW-NEXT:     ]
+# RAW-NEXT:     Ovl: 0
+# RAW-NEXT:     Group: 0
+# RAW-NEXT:     Frame: 3
+# RAW-NEXT:     SecName: 65535
+# RAW-NEXT:     ClassName: 65535
+# RAW-NEXT:     Offset: 0
+# RAW-NEXT:     SecByteLength: 4294967295
+# RAW-NEXT:   }
+# RAW-NEXT: ]
+# RAW-NEXT: Section Headers [
 # RAW-NEXT:   {
 # RAW-NEXT:     Name: .text
 # RAW-NEXT:     Virtual Size:




More information about the llvm-commits mailing list