public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/52489] New: LTO drops init_array/fini_array sections
@ 2012-03-05 11:36 krisztian.kocsis at optimaster dot eu
  2012-03-05 11:44 ` [Bug lto/52489] " rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: krisztian.kocsis at optimaster dot eu @ 2012-03-05 11:36 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52489
           Summary: LTO drops init_array/fini_array sections
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: lto
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: krisztian.kocsis@optimaster.eu


Hi!

When both optimization (-O > 0) and LTO are enabled then init_array and
fini_array sections are missing from the final binary. Without -flto or with
-O0 these sections are not removed.

This prevents building e.g. glibc with LTO (check for init/fini array fails
because the compiled binary does not contain them - I'v checked it by hand
also).

Here is the conftest code:

int _start (void) { return 0; }
int __start (void) { return 0; }
int foo (void) { return 1; }
int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;

CFLAGS: -O2 -flto -static -nostartfiles -nostdlib

This bug may be the same with #51255!


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

* [Bug lto/52489] LTO drops init_array/fini_array sections
  2012-03-05 11:36 [Bug lto/52489] New: LTO drops init_array/fini_array sections krisztian.kocsis at optimaster dot eu
@ 2012-03-05 11:44 ` rguenth at gcc dot gnu.org
  2012-03-05 12:47 ` krisztian.kocsis at optimaster dot eu
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-03-05 11:44 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu.org
         Depends on|                            |51255

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-03-05 11:43:47 UTC ---
Does the error persist if you enable -fuse-linker-plugin?  Btw, it works for me
even without.  I suspect it's a binutils bug instead?

Honza?


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

* [Bug lto/52489] LTO drops init_array/fini_array sections
  2012-03-05 11:36 [Bug lto/52489] New: LTO drops init_array/fini_array sections krisztian.kocsis at optimaster dot eu
  2012-03-05 11:44 ` [Bug lto/52489] " rguenth at gcc dot gnu.org
@ 2012-03-05 12:47 ` krisztian.kocsis at optimaster dot eu
  2012-03-05 13:36 ` krisztian.kocsis at optimaster dot eu
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: krisztian.kocsis at optimaster dot eu @ 2012-03-05 12:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Krisztian Kocsis <krisztian.kocsis at optimaster dot eu> 2012-03-05 12:46:47 UTC ---
It seems that it works with -fno-use-linker-plugin - strane :S
Now I will try to check some other things.

I think it is not a linker bug because if a save temp files the .s file does
not contain the .init_array section while when -flto is not included it does
contain this section.

I will attach them after I made the checks.


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

* [Bug lto/52489] LTO drops init_array/fini_array sections
  2012-03-05 11:36 [Bug lto/52489] New: LTO drops init_array/fini_array sections krisztian.kocsis at optimaster dot eu
  2012-03-05 11:44 ` [Bug lto/52489] " rguenth at gcc dot gnu.org
  2012-03-05 12:47 ` krisztian.kocsis at optimaster dot eu
@ 2012-03-05 13:36 ` krisztian.kocsis at optimaster dot eu
  2012-03-05 13:39 ` krisztian.kocsis at optimaster dot eu
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: krisztian.kocsis at optimaster dot eu @ 2012-03-05 13:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Krisztian Kocsis <krisztian.kocsis at optimaster dot eu> 2012-03-05 13:35:38 UTC ---
Created attachment 26832
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26832
Generated files with -fuse-linker-plugin


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

* [Bug lto/52489] LTO drops init_array/fini_array sections
  2012-03-05 11:36 [Bug lto/52489] New: LTO drops init_array/fini_array sections krisztian.kocsis at optimaster dot eu
                   ` (2 preceding siblings ...)
  2012-03-05 13:36 ` krisztian.kocsis at optimaster dot eu
@ 2012-03-05 13:39 ` krisztian.kocsis at optimaster dot eu
  2012-03-05 13:40 ` krisztian.kocsis at optimaster dot eu
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: krisztian.kocsis at optimaster dot eu @ 2012-03-05 13:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Krisztian Kocsis <krisztian.kocsis at optimaster dot eu> 2012-03-05 13:39:08 UTC ---
Created attachment 26833
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26833
Generated files with -fno-use-linker-plugin


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

* [Bug lto/52489] LTO drops init_array/fini_array sections
  2012-03-05 11:36 [Bug lto/52489] New: LTO drops init_array/fini_array sections krisztian.kocsis at optimaster dot eu
                   ` (3 preceding siblings ...)
  2012-03-05 13:39 ` krisztian.kocsis at optimaster dot eu
@ 2012-03-05 13:40 ` krisztian.kocsis at optimaster dot eu
  2012-03-05 13:47 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: krisztian.kocsis at optimaster dot eu @ 2012-03-05 13:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Krisztian Kocsis <krisztian.kocsis at optimaster dot eu> 2012-03-05 13:40:18 UTC ---
Ok, I can confirm that it work if plugins are disabled or
-fno-use-linker-plugin is used. When linker plugin is used gcc drops these
sections.


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

* [Bug lto/52489] LTO drops init_array/fini_array sections
  2012-03-05 11:36 [Bug lto/52489] New: LTO drops init_array/fini_array sections krisztian.kocsis at optimaster dot eu
                   ` (4 preceding siblings ...)
  2012-03-05 13:40 ` krisztian.kocsis at optimaster dot eu
@ 2012-03-05 13:47 ` rguenth at gcc dot gnu.org
  2012-03-05 13:50 ` krisztian.kocsis at optimaster dot eu
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-03-05 13:47 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2012-03-05
     Ever Confirmed|0                           |1

--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-03-05 13:46:57 UTC ---
(In reply to comment #5)
> Ok, I can confirm that it work if plugins are disabled or
> -fno-use-linker-plugin is used. When linker plugin is used gcc drops these
> sections.

What binutils version are you using?  It seems to me that this is a binutils
bug, not a GCC bug.


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

* [Bug lto/52489] LTO drops init_array/fini_array sections
  2012-03-05 11:36 [Bug lto/52489] New: LTO drops init_array/fini_array sections krisztian.kocsis at optimaster dot eu
                   ` (5 preceding siblings ...)
  2012-03-05 13:47 ` rguenth at gcc dot gnu.org
@ 2012-03-05 13:50 ` krisztian.kocsis at optimaster dot eu
  2012-03-05 18:41 ` pinskia at gcc dot gnu.org
  2021-12-11 18:59 ` pinskia at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: krisztian.kocsis at optimaster dot eu @ 2012-03-05 13:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Krisztian Kocsis <krisztian.kocsis at optimaster dot eu> 2012-03-05 13:50:25 UTC ---
Binutils 2.22

Pls check the attached files.


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

* [Bug lto/52489] LTO drops init_array/fini_array sections
  2012-03-05 11:36 [Bug lto/52489] New: LTO drops init_array/fini_array sections krisztian.kocsis at optimaster dot eu
                   ` (6 preceding siblings ...)
  2012-03-05 13:50 ` krisztian.kocsis at optimaster dot eu
@ 2012-03-05 18:41 ` pinskia at gcc dot gnu.org
  2021-12-11 18:59 ` pinskia at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-03-05 18:41 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-03-05 18:39:30 UTC ---
It is the same as PR 51255.

*** This bug has been marked as a duplicate of bug 51255 ***


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

* [Bug lto/52489] LTO drops init_array/fini_array sections
  2012-03-05 11:36 [Bug lto/52489] New: LTO drops init_array/fini_array sections krisztian.kocsis at optimaster dot eu
                   ` (7 preceding siblings ...)
  2012-03-05 18:41 ` pinskia at gcc dot gnu.org
@ 2021-12-11 18:59 ` pinskia at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-11 18:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52489
Bug 52489 depends on bug 51255, which changed state.

Bug 51255 Summary: Using -fwhole-program breaks code which puts values in .ctors or .init_array
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51255

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

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

end of thread, other threads:[~2021-12-11 18:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-05 11:36 [Bug lto/52489] New: LTO drops init_array/fini_array sections krisztian.kocsis at optimaster dot eu
2012-03-05 11:44 ` [Bug lto/52489] " rguenth at gcc dot gnu.org
2012-03-05 12:47 ` krisztian.kocsis at optimaster dot eu
2012-03-05 13:36 ` krisztian.kocsis at optimaster dot eu
2012-03-05 13:39 ` krisztian.kocsis at optimaster dot eu
2012-03-05 13:40 ` krisztian.kocsis at optimaster dot eu
2012-03-05 13:47 ` rguenth at gcc dot gnu.org
2012-03-05 13:50 ` krisztian.kocsis at optimaster dot eu
2012-03-05 18:41 ` pinskia at gcc dot gnu.org
2021-12-11 18:59 ` pinskia 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).