This is an archive of the discontinued LLVM Phabricator instance.

[lldb][COFF] Map symbols without base+complex type as 'Data' type
ClosedPublic

Authored by alvinhochun on Sep 24 2022, 5:27 AM.

Details

Summary

Both LLD and GNU ld write global/static variables to the COFF symbol
table with IMAGE_SYM_TYPE_NULL and IMAGE_SYM_DTYPE_NULL type. Map
these symbols as 'Data' type in the symtab to allow these symbols to be
used in expressions and printable.

Depends on D134426

Diff Detail

Event Timeline

alvinhochun created this revision.Sep 24 2022, 5:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 24 2022, 5:27 AM
alvinhochun requested review of this revision.Sep 24 2022, 5:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 24 2022, 5:27 AM

This LGTM, but I'll leave it to some LLDB maintainer to formally approve.

You're the expert on what the linker does and the code looks fine.

Is it possible that msvc uses these IMAGE_SYM_TYPE_NULL in a different way that could cause a problem? Worst that happens is we get a bunch of symbols available in expressions that shouldn't be?

You're the expert on what the linker does and the code looks fine.

Is it possible that msvc uses these IMAGE_SYM_TYPE_NULL in a different way that could cause a problem? Worst that happens is we get a bunch of symbols available in expressions that shouldn't be?

MSVC/link.exe doesn't write symbols into linked PE images at all. But at the object file stage, they do express data symbols in the same way (which is the default marking for symbols that have no other types set).

MSVC/link.exe doesn't write symbols into linked PE images at all.

So by the time we get to a debugger, it's not an issue anyway.

Then this LGTM.

Thanks for all these improvements btw, I expect Linaro's Windows on Arm efforts appreciate them too.

MSVC/link.exe doesn't write symbols into linked PE images at all.

So by the time we get to a debugger, it's not an issue anyway.

Yep, most of these patches about symbol table handling doesn't make any difference for the MSVC ecosystem usage at all (although some of these patches fix other generic windows-specific bugs noticed too).

Then this LGTM.

Thanks! Can you mark it formally approved too? :-)

DavidSpickett accepted this revision.Sep 26 2022, 3:29 AM

Would help if I actually clicked the buttons yes :)

This revision is now accepted and ready to land.Sep 26 2022, 3:29 AM
labath accepted this revision.Sep 27 2022, 8:47 AM
This revision was landed with ongoing or failed builds.Sep 28 2022, 2:58 AM
This revision was automatically updated to reflect the committed changes.