[MC] Set the unique id of .stack_sizes to the associated .text section's
authorFangrui Song <i@maskray.me>
Thu, 26 Nov 2020 17:13:08 +0000 (09:13 -0800)
committerFangrui Song <i@maskray.me>
Thu, 26 Nov 2020 17:13:09 +0000 (09:13 -0800)
commit668da8c361fef5ada092534d4d20ea450831f6f6
treefdf7c4522c0eac8ada701ff9aecdf8ca88085548
parent6d648e69c0949e8942cab88e7ec13f5037364338
[MC] Set the unique id of .stack_sizes to the associated .text section's

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.

Reviewed By: grimar, jhenderson

Differential Revision: https://reviews.llvm.org/D92151
llvm/lib/MC/MCObjectFileInfo.cpp
llvm/test/CodeGen/X86/stack-size-section-function-sections.ll