diff options
Diffstat (limited to 'lld/COFF/Writer.cpp')
| -rw-r--r-- | lld/COFF/Writer.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lld/COFF/Writer.cpp b/lld/COFF/Writer.cpp index 7b1ff8071e2e..2982165530c0 100644 --- a/lld/COFF/Writer.cpp +++ b/lld/COFF/Writer.cpp @@ -560,7 +560,7 @@ void Writer::createECCodeMap() { codeMap.clear(); std::optional<chpe_range_type> lastType; - Chunk *first, *last; + Chunk *first = nullptr, *last = nullptr; auto closeRange = [&]() { if (lastType) { @@ -1121,6 +1121,9 @@ void Writer::createMiscChunks() { // if we're ultimately not going to write CodeView data to the PDB. buildId = make<CVDebugRecordChunk>(ctx); debugRecords.emplace_back(COFF::IMAGE_DEBUG_TYPE_CODEVIEW, buildId); + if (Symbol *buildidSym = ctx.symtab.findUnderscore("__buildid")) + replaceSymbol<DefinedSynthetic>(buildidSym, buildidSym->getName(), + buildId, 4); } if (config->cetCompat) { @@ -1376,7 +1379,7 @@ void Writer::createSymbolAndStringTable() { sec->setStringTableOff(addEntryToStringTable(sec->name)); } - if (ctx.config.debugDwarf || ctx.config.debugSymtab) { + if (ctx.config.writeSymtab) { for (ObjFile *file : ctx.objFileInstances) { for (Symbol *b : file->getSymbols()) { auto *d = dyn_cast_or_null<Defined>(b); @@ -1480,7 +1483,7 @@ void Writer::sortECChunks() { llvm::stable_sort(sec->chunks, [=](const Chunk *a, const Chunk *b) { std::optional<chpe_range_type> aType = a->getArm64ECRangeType(), bType = b->getArm64ECRangeType(); - return !aType || (bType && *aType < *bType); + return bType && (!aType || *aType < *bType); }); } } |
