[PATCH] D11023: COFF: Emit a symbol table if /debug is specified

David Majnemer david.majnemer at gmail.com
Tue Jul 7 21:30:01 PDT 2015


================
Comment at: COFF/Writer.cpp:317-320
@@ +316,6 @@
+          if (Name.size() > COFF::NameSize) {
+            Sym.Name.Offset.Zeroes = 0;
+            Sym.Name.Offset.Offset = Strtab.size() + 4; // +4 for the size field
+            Strtab.insert(Strtab.end(), Name.begin(), Name.end());
+            Strtab.push_back('\0');
+          } else {
----------------
ruiu wrote:
> Make this a separate member function.
I'm not sure what you mean here, the section that you highlighted isn't reusable elsewhere in the linker.

================
Comment at: COFF/Writer.cpp:328-329
@@ +327,4 @@
+          Sym.SectionNumber = SymSec->SectionIndex;
+          Sym.StorageClass = IMAGE_SYM_CLASS_NULL;
+          Sym.NumberOfAuxSymbols = 0;
+          OutputSymtab.push_back(Sym);
----------------
ruiu wrote:
> If these actual values are 0, you don't need to set.
We must initialize it because otherwise the StorageClass and NumberOfAuxSymbols will be garbage and we would latter copy this garbage into the executable in `writeHeader`.


http://reviews.llvm.org/D11023







More information about the llvm-commits mailing list