This is an archive of the discontinued LLVM Phabricator instance.

[LangRef] Clarify !associated
ClosedPublic

Authored by MaskRay on Jun 25 2021, 11:00 AM.

Details

Summary

Notably, a global variable with the metadata should generally not be referenced
by a function function. E.g. -fstack-size-section usage is fine, but
-fsanitize-coverage= used to have a linker GC problem (fixed by D97430).

Diff Detail

Event Timeline

MaskRay created this revision.Jun 25 2021, 11:00 AM
MaskRay requested review of this revision.Jun 25 2021, 11:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 25 2021, 11:00 AM
eugenis added inline comments.Jul 2 2021, 2:45 PM
llvm/docs/LangRef.rst
6855

It sounds like the linker error is only a symptom, and the real reason is that !associated as well as SHF_LINK_ORDER can not express many-to-one relationship, right? Because ideally we would want to keep metadata alive as long as any inline location is alive, too.

MaskRay added inline comments.Jul 2 2021, 3:20 PM
llvm/docs/LangRef.rst
6855

the real reason is that !associated as well as SHF_LINK_ORDER can not express many-to-one relationship, right?

Exactly. Shall I rephrase this to make it clearer? (Do you a particular suggestion?)

eugenis added inline comments.Jul 7 2021, 1:57 PM
llvm/docs/LangRef.rst
6855

Yeah, it would be good to expand this with the underlying reason for the limitation.
Something about how !associated metadata can not be used to describe multiple users of the variable because ELF only allows one linked section per section.

MaskRay updated this revision to Diff 357073.Jul 7 2021, 2:15 PM

improve wording

eugenis accepted this revision.Jul 7 2021, 2:23 PM

LGTM, thanks!

This revision is now accepted and ready to land.Jul 7 2021, 2:23 PM
MaskRay updated this revision to Diff 357265.Jul 8 2021, 10:06 AM
MaskRay edited the summary of this revision. (Show Details)

fix typo

This revision was landed with ongoing or failed builds.Jul 8 2021, 10:07 AM
This revision was automatically updated to reflect the committed changes.
morehouse added inline comments.Jul 8 2021, 10:28 AM
llvm/docs/LangRef.rst
6852

I thought it was SHF_LINK_ORDER.

MaskRay marked an inline comment as done.Jul 8 2021, 10:30 AM
MaskRay added inline comments.
llvm/docs/LangRef.rst
6852

Thanks for spotting this! Fixed in d833543dd52cfb126f4c6d765166e42da217b72a