This is an archive of the discontinued LLVM Phabricator instance.

[dsymutil] dsymutil produces broken lines info (probably) with LTO on mac
ClosedPublic

Authored by avl on Jan 30 2023, 2:03 PM.

Details

Summary

This patch fixes #60307 issue. The 8bb4451 introduces the possibility
to unite overlapped or adjacent address ranges to keep address ranges
in an unambiguous state. The AddressRangesMap is used to normalize
address ranges. The AddressRangesMap keeps address ranges and the value
of the relocated address. For intersected range, it creates a united
range that keeps the last inserted mapping value. The same for adjusted ranges.
While it is OK to use the last inserted mapping value for intersected ranges
(as there is no way how to resolve ambiguity) It is not OK to use the
last inserted value for adjacent address ranges. Currently, two following
address ranges are united into a single one:

{0,24,17e685c} {24,d8,55afe20} -> {0,d8,55afe20}

To avoid the problem, the AddressRangesMap should not unite adjacent address ranges
with different relocated addresses. Instead, it should leave adjacent address ranges
as separate ranges. So, the ranges should look like this:

{0,24,17e685c} {24,d8,55afe20}

Diff Detail

Event Timeline

avl created this revision.Jan 30 2023, 2:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 30 2023, 2:03 PM
avl requested review of this revision.Jan 30 2023, 2:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 30 2023, 2:03 PM
avl updated this revision to Diff 494296.Feb 2 2023, 7:01 AM

simplified AddressRangesMap::insert().

JDevlieghere accepted this revision.Feb 2 2023, 12:53 PM

I didn't check the insertion logic in detail but I'm fairly confident it's correct given the test coverage. LGTM.

llvm/include/llvm/ADT/AddressRanges.h
124
This revision is now accepted and ready to land.Feb 2 2023, 12:53 PM
llvm/lib/DWARFLinker/DWARFStreamer.cpp