This is an archive of the discontinued LLVM Phabricator instance.

[MC] Set the unique id of .stack_sizes to the associated .text section's
ClosedPublic

Authored by MaskRay on Nov 25 2020, 9:13 PM.

Details

Summary

Similar to D92113. Currently clang -fstack-size-section -fno-unique-section-names
sets the linked-to symbol to the first .text, which is:

  • incorrect for COMDAT sections
  • inferior for non-COMDAT sections in -ffunction-sections mode (poor --gc-sections: .stack_sizes cannot be separately discarded)

Note, if the section symbol can be referenced in more places (if the
function begin symbol does not apply), we probably should consider
defining a different BeginSymbol for sections with ",unique" linkage.

Diff Detail

Event Timeline

MaskRay created this revision.Nov 25 2020, 9:13 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 25 2020, 9:13 PM
MaskRay requested review of this revision.Nov 25 2020, 9:13 PM
MaskRay edited the summary of this revision. (Show Details)Nov 25 2020, 9:14 PM

I've added @jhenderson. who might be interested in .stack_sizes related changes too I guess.

jhenderson accepted this revision.Nov 26 2020, 12:51 AM

Thanks, LGTM too. Honestly, I'm slightly surprised this wasn't already the case. I guess no-unique-section-names hasn't been widely used in practice.

This revision is now accepted and ready to land.Nov 26 2020, 12:51 AM
grimar accepted this revision.Nov 26 2020, 2:01 AM

LGTM

Thanks, LGTM too. Honestly, I'm slightly surprised this wasn't already the case. I guess no-unique-section-names hasn't been widely used in practice.

It hasn't been widely used in practice. GCC does not support -fno-unique-section-names (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95095)