[lld] [lld-macho] Fix crash with DWARF section-relative relocations (PR #168075)
Jez Ng via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 21 17:12:43 PST 2025
================
@@ -411,10 +411,14 @@ void ObjFile::parseSections(ArrayRef<SectionHeader> sectionHeaders) {
auto *isec = make<ConcatInputSection>(section, data, align);
if (isDebugSection(isec->getFlags()) &&
isec->getSegName() == segment_names::dwarf) {
- // Instead of emitting DWARF sections, we emit STABS symbols to the
- // object files that contain them. We filter them out early to avoid
- // parsing their relocations unnecessarily.
+ // Keep debug sections in debugSections for diagnostic purposes
debugSections.push_back(isec);
+ // Add DWARF sections to subsections so their relocations are processed,
+ // but mark them dead so they aren't emitted (MachO uses STABS, not DWARF).
+ // This fixes crashes with section-relative relocations (e.g., DW_FORM_strp)
+ // while maintaining MachO's traditional STABS-only debug output.
----------------
int3 wrote:
(if that's not right, please explain a bit more what the crash is. what's the stack trace?)
https://github.com/llvm/llvm-project/pull/168075
More information about the llvm-commits
mailing list