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
- Repository
- rL LLVM
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 ↗ | (On Diff #29230) | Add a comment saying that we want to preserve DWARF debug sections only when /debug is on. |
COFF/Writer.cpp | ||
288 ↗ | (On Diff #29230) | Return early by inverting the condition. |
301 ↗ | (On Diff #29230) | I prefer auto *D = dyn_cast<... if (!D || !D->isLive()) continue; to reduce indentation level. |
317–320 ↗ | (On Diff #29230) | Make this a separate member function. |
328–329 ↗ | (On Diff #29230) | If these actual values are 0, you don't need to set. |
492 ↗ | (On Diff #29230) | Return early. |
504 ↗ | (On Diff #29230) | Update comment ("then" no longer makes sense.) |
COFF/Writer.h | ||
64 ↗ | (On Diff #29230) | Add a comment saying that this is 1-based section index. |
65 ↗ | (On Diff #29230) | Add a blank line before this line. |
COFF/Writer.cpp | ||
---|---|---|
317–320 ↗ | (On Diff #29230) | I'm not sure what you mean here, the section that you highlighted isn't reusable elsewhere in the linker. |
328–329 ↗ | (On Diff #29230) | 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 | ||
---|---|---|
324–327 ↗ | (On Diff #29236) | 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'); |