public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ramana at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/54303] -fdata-sections -ffunction-sections and -fmerge-constants do not work well together
Date: Tue, 04 Sep 2012 23:06:00 -0000	[thread overview]
Message-ID: <bug-54303-4-YkrQLGJS4P@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-54303-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54303

--- Comment #6 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> 2012-09-04 23:06:29 UTC ---
Oh I see, my bad to have missed your command line. Sorry.  

I see what's going on here. It's just luck that this works on x86_64 with your
invocation. 


>$ objdump -h non-collected-strings.o  | grep str
>non-collected-strings.o:     file format elf64-x86-64
>  3 .rodata.str1.8 0000001f  0000000000000000  0000000000000000  00000040  2**3
>  5 .rodata.str1.1 0000001b  0000000000000000  0000000000000000  0000006f  2**0

Try with -Os on x86_64 and it should fail there as well on trunk / earlier
versions of GCC. 

Notice one string has an alignment of 8 and the other 1 and that's what drew my
attention to the funniness in this testcase.

The reason for this is the play with CONSTANT_ALIGNMENT in the backends. If the
strings gets the same alignment you end up with the strings in the same
sections which means the whole thing doesn't work and if they have a different
alignment as with your invocation, it all works fine. :(


regards,
ramana


  parent reply	other threads:[~2012-09-04 23:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-17 17:15 [Bug c/54303] New: " tom.rini at gmail dot com
2012-08-20 19:32 ` [Bug c/54303] " vapier at gentoo dot org
2012-08-21  0:35 ` marek.vasut at gmail dot com
2012-09-04 19:51 ` ramana at gcc dot gnu.org
2012-09-04 20:34 ` tom.rini at gmail dot com
2012-09-04 20:36 ` tom.rini at gmail dot com
2012-09-04 23:06 ` ramana at gcc dot gnu.org [this message]
2012-10-01 17:55 ` pbrook at gcc dot gnu.org
2012-10-01 18:02 ` tom.rini at gmail dot com
2012-10-01 21:14 ` jakub at gcc dot gnu.org
2014-01-24 23:55 ` pinskia at gcc dot gnu.org
2014-01-25 19:34 ` tom.rini at gmail dot com
2014-10-01 13:34 ` [Bug middle-end/54303] " aph at gcc dot gnu.org
2015-02-03 15:15 ` rafael.espindola at gmail dot com
2015-02-04 11:41 ` jwrdegoede at fedoraproject dot org
2015-05-07 15:51 ` segher at gcc dot gnu.org

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-54303-4-YkrQLGJS4P@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).