[Bug lto/126841] [LTO] -ffunction-sections can emit multiple distinct functions into one native section

luolongjuna at gmail dot com via Gcc-bugs <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126841

--- Comment #8 from Longjun Luo <luolongjuna at gmail dot com> ---
Patch posted:

https://inbox.sourceware.org/gcc-patches/[email protected]/

The fix clears implicit section names on the renamed symbol and its aliases
in privatize_symbol_name_1, so that LTRANS regenerates them from the final
assembler name.  Explicit user-specified section names are left unchanged.
It also documents in invoke.texi that, under LTO, an implicitly generated
section name is derived from the final assembler name.

The regression test covers both cases reported here: three identically named
internal-linkage functions each get their own section, and the exported
function keeps the unsuffixed section.

Tested on x86_64-pc-linux-gnu.  The test fails without the change and passes
with it, and the complete gcc.dg/lto and g++.dg/lto suites show no unexpected
results.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.