[lld] Fix lld crash wrt generated thunks growing away from the patched code (PR #170495)

TarcĂ­sio Fischer via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 10 09:16:55 PST 2025


================
@@ -584,7 +585,10 @@ AArch64Err843419Patcher::patchInputSectionDescription(
     // mapping symbols of the same type. Our range of executable instructions to
     // scan is therefore [codeSym->value, dataSym->value) or [codeSym->value,
     // section size).
-    std::vector<const Defined *> &mapSyms = sectionMap[isec];
+    auto &[sectionSym, mapSyms] = sectionMap[isec];
----------------
tarcisiofischer wrote:

Sure, but please note that I still need to check against `nullptr`, since it is possible that we have an entry that maps a section to an unknown (nullptr) sectionSym, but that still has mapSyms. So I changed the code to meet your suggestion, but the test still needs to be `if (inserted || sectionSym == nullptr)`.

Btw, just out of curiosity, why would it be a problem to use the default `nullptr` provided by the possibly-inserted value?

https://github.com/llvm/llvm-project/pull/170495


More information about the llvm-commits mailing list