https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110334
Bug ID: 110334
Summary: [13/14 Regresssion] unused functions not eliminated
before LTO streaming
Product: gcc
Version: 13.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ipa
Assignee: unassigned at gcc dot gnu.org
Reporter: rguenth at gcc dot gnu.org
CC: marxin at gcc dot gnu.org
Target Milestone: ---
https://bugzilla.suse.com/show_bug.cgi?id=1212101
reports crashes of Firefox because with LTO we end up with comdats built
with different ISA flags and the linker choosing the "wrong" one. While
that's general a user error the TUs in question have no uses of the
offending symbols and they are indeed eliminated when optimizing. But
this elimination happens only after LTO streaming which is unfortunate.
We also seem to lack any diagnostic at WPA time that we have COMDAT
(group members) from several TUs that are not built with the same options.
Apart from diagnosing this (with -Wodr?) a possible DWIM solution could
be to clone the COMDAT (groups), overriding the linker decision and
preserving the edges to the original refered copy. That's also superior
to using symbol visibility in the TUs as it would allow to share the
comdats across TUs if they are built with the same set of flags.
But first and foremost I wonder why we do not eliminate these symbols
before LTO streaming.