Providing a symbol table in the executable is quite useful when
debugging a fully-linked executable without having to reconstruct one
from DWARF.
Details
Diff Detail
Event Timeline
Can you add a test for the symbol table? I don't think long-section-name test covers the new feature.
COFF/InputFiles.cpp | ||
---|---|---|
149 | Add a comment saying that we want to preserve DWARF debug sections only when /debug is on. | |
COFF/Writer.cpp | ||
288 | Return early by inverting the condition. | |
301 | I prefer auto *D = dyn_cast<... if (!D || !D->isLive()) continue; to reduce indentation level. | |
317–320 | Make this a separate member function. | |
328–329 | If these actual values are 0, you don't need to set. | |
492 | Return early. | |
504 | Update comment ("then" no longer makes sense.) | |
COFF/Writer.h | ||
64 | Add a comment saying that this is 1-based section index. | |
65 | Add a blank line before this line. |
COFF/Writer.cpp | ||
---|---|---|
317–320 | I'm not sure what you mean here, the section that you highlighted isn't reusable elsewhere in the linker. | |
328–329 | 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. |
LGTM
COFF/Writer.cpp | ||
---|---|---|
317–320 | I meant this piece of code is repeated twice in this function. This is more like a personal perference, so if you don't want to make this change, I'm fine with that. I'll try to do this myself. ... = Strtab.size() + 4; // +4 for the size field Strtab.insert(Strtab.end(), Name.begin(), Name.end()); Strtab.push_back('\0'); |
Add a comment saying that we want to preserve DWARF debug sections only when /debug is on.