From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 78804 invoked by alias); 7 May 2015 07:19:28 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 78752 invoked by uid 48); 7 May 2015 07:19:22 -0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/192] String literals don't obey -fdata-sections Date: Thu, 07 May 2015 07:19:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 2.95.2 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-05/txt/msg00540.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=192 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #14 from Jakub Jelinek --- 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.