public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "i at maskray dot me" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/192] String literals don't obey -fdata-sections
Date: Tue, 15 Sep 2020 22:15:18 +0000 [thread overview]
Message-ID: <bug-192-4-X4gj51WgtR@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-192-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=192
Fangrui Song <i at maskray dot me> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |i at maskray dot me
--- Comment #19 from Fangrui Song <i at maskray dot me> ---
(In reply to Jakub Jelinek from comment #14)
> 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.
I second Jakub's idea that the linker should perform the constant merge (which
is implemented in LLD): the cost of a section header (sizeof(Elf64_Shdr)=64) +
a section name (".rodata.xxx.str1.1") is quite large.
Created a GNU ld (and gold) feature request:
https://sourceware.org/bugzilla/show_bug.cgi?id=26622
next prev parent reply other threads:[~2020-09-15 22:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-192-4@http.gcc.gnu.org/bugzilla/>
2015-05-06 7:09 ` rahul.gundecha at gmail dot com
2015-05-06 10:59 ` gcc at mattwhitlock dot name
2015-05-06 16:07 ` gcc at mattwhitlock dot name
2015-05-06 16:41 ` hjl.tools at gmail dot com
2015-05-06 23:26 ` gcc at mattwhitlock dot name
2015-05-07 7:19 ` jakub at gcc dot gnu.org
2015-05-07 15:51 ` segher at gcc dot gnu.org
2015-05-08 2:05 ` gcc at mattwhitlock dot name
2020-09-15 22:15 ` i at maskray dot me [this message]
[not found] <bug-192-865@http.gcc.gnu.org/bugzilla/>
2007-04-02 20:27 ` maskva at searxhmash dot com
[not found] <20000502194601.192.greyham@research.canon.com.au>
2004-05-24 2:38 ` pinskia at gcc dot gnu dot org
2004-10-13 13:40 ` pinskia at gcc dot gnu dot org
2004-11-30 6:36 ` amodra at bigpond dot net dot au
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-192-4-X4gj51WgtR@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).