https://gcc.gnu.org/bugzilla/show_bug.cgi?id=192
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This doesn't really look like a good idea to me. Instead, perhaps ld's
--gc-sections or new special option should just remove unused string literals
from mergeable sections.
With your patch, I bet you lose e.g. all tail merging. Consider:
const char *used1 () { return "foo bar baz blah blah"; }
in one TU and
const char *used2 () { return "bar baz blah blah"; }
in another. The linker necessarily knows which strings (or other data) in
mergeable sections are used and which are unused.