This is an archive of the discontinued LLVM Phabricator instance.

[dsymutil] Fix handling of common symbols in multiple object files.
ClosedPublic

Authored by JDevlieghere on Oct 8 2019, 6:36 PM.

Details

Summary

For common symbols the linker emits only a single symbol entry in the debug map. This caused dsymutil to not relocate common symbols when linking DWARF coming form object files that did not have this entry. This patch fixes that by keeping track of common symbols in the object files and synthesizing a debug map entry for them using the address from the main binary.

Diff Detail

Repository
rL LLVM

Event Timeline

JDevlieghere created this revision.Oct 8 2019, 6:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 8 2019, 6:36 PM
Herald added a subscriber: aprantl. · View Herald Transcript
friss accepted this revision.Oct 8 2019, 8:02 PM

LGTM

This revision is now accepted and ready to land.Oct 8 2019, 8:02 PM
This revision was automatically updated to reflect the committed changes.

Hi! Could you choose some other names for com1.o and com2.o, please? :) They are reserved names on Windows, so there are problems with checking out this change.

aprantl added inline comments.Oct 9 2019, 9:04 AM
llvm/tools/dsymutil/MachODebugMapParser.cpp
144

This looks like no-op. I guess we could just ignore the return value?

498–501

is it expected that a symbol with SymbolRef::SF_Absolute | SymbolRef::SF_Common goes into the first if only?