public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/54303] New: -fdata-sections -ffunction-sections and -fmerge-constants do not work well together
@ 2012-08-17 17:15 tom.rini at gmail dot com
  2012-08-20 19:32 ` [Bug c/54303] " vapier at gentoo dot org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: tom.rini at gmail dot com @ 2012-08-17 17:15 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 54303
           Summary: -fdata-sections -ffunction-sections and
                    -fmerge-constants do not work well together
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tom.rini@gmail.com


Created attachment 28045
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28045
Testcase for the issue

The attached test-case demonstrates the problem I see:
$ arm-linux-gnueabi-gcc -Wall -fdata-sections -ffunction-sections -o
non-collected-strings.o -c non-collected-strings.c
$ arm-linux-gnueabi-gcc -Wl,--gc-sections -o non-collected-strings
non-collected-strings.o
$ strings non-collected-strings | grep here
This string should not be here
This string should be here
$ arm-linux-gnueabi-nm non-collected-strings| grep me
00000000004004d0 t frame_dummy
00000000004004f2 T keep_me
$ arm-linux-gnueabi-nm non-collected-strings.o | grep me
0000000000000000 T garbage_collect_me
0000000000000000 T keep_me
$ arm-linux-gnueabi-objdump -h non-collected-strings.o | grep str
non-collected-strings.o:     file format elf32-littlearm
  3 .rodata.str1.4 0000003c  00000000  00000000  00000034  2**2

And all strings in the object file are coalesced into a single section.

Note that on x86-64 this works as expected as the last step shows instead:
$ 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

I've verified this with a few different arm-linux-gnueabi toolchains (ELDK 4.2,
ELDK 5.2.1, Linaro (4:4.6.2-7 in Ubuntu) and this seems like a long-standing
thing, not Linaro-patch specific.


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-05-07 15:51 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-17 17:15 [Bug c/54303] New: -fdata-sections -ffunction-sections and -fmerge-constants do not work well together 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
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

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).