public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug driver/37409]  New: -fwhole-program option breaks collect2-generated global constructors
@ 2008-09-07 17:50 danglin at gcc dot gnu dot org
  2008-09-07 19:09 ` [Bug driver/37409] " danglin at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: danglin at gcc dot gnu dot org @ 2008-09-07 17:50 UTC (permalink / raw)
  To: gcc-bugs

Executing on host: /test/gnu/gcc/objdir/gcc/xgcc -B/test/gnu/gcc/objdir/gcc/
/te
st/gnu/gcc/gcc/gcc/testsuite/gcc.dg/struct/w_prof_global_array.c    -O3
-fwhole-
program -combine -fipa-type-escape -fprofile-generate  -lm   -o
/test/gnu/gcc/ob
jdir/gcc/testsuite/gcc/w_prof_global_array.x01    (timeout = 300)
/usr/ccs/bin/ld: Unsatisfied symbols:
   _GLOBAL__FI_w_prof_global_array_x01 (first referenced in +init option)
(code)
   _GLOBAL__FD_w_prof_global_array_x01 (first referenced in +fini option)
(code)
collect2: ld returned 1 exit status
compiler exited with status 1

With -Wl,-debug, I see

========== output_file =
/test/gnu/gcc/objdir/gcc/testsuite/gcc/w_prof_global_ar
ray.exe, c_file = /var/tmp//ccVomji2.c

write_c_file - output name is
/test/gnu/gcc/objdir/gcc/testsuite/gcc/w_prof_glob
al_array.exe, prefix is w_prof_global_array_exe
static int count;
typedef void entry_pt();
extern entry_pt x2 __asm__ ("_GLOBAL__I_65535_0_main");
void _GLOBAL__FI_w_prof_global_array_exe() {
        static entry_pt *ctors[] = {
                x2,
        };
        entry_pt **p;
        if (count++ != 0) return;
        p = ctors + 1;
        while (p > ctors) (*--p)();
}
void _GLOBAL__FD_w_prof_global_array_exe() {
}
========== end of c_file

/test/gnu/gcc/objdir/gcc/xgcc -x c -c -o /var/tmp//ccgqCYtU.o
-B/test/gnu/gcc/ob
jdir/gcc/ -fwhole-program -fipa-type-escape -fprofile-generate
-fno-profile-arcs
 -fno-test-coverage -fno-branch-probabilities -fno-exceptions -w
/var/tmp//ccVom
ji2.c
/test/gnu/gcc/objdir/gcc/collect-ld -z -u main -u __gcc_plt_call -o
/test/gnu/gc
c/objdir/gcc/testsuite/gcc/w_prof_global_array.exe /usr/ccs/lib/crt0.o
/var/tmp/
/ccgqCYtU.o /lib/unix98.o -L/test/gnu/gcc/objdir/gcc -L/usr/ccs/lib
-L/opt/langt
ools/lib /var/tmp//ccQX5WvC.o -lm -lgcov -lgcc -lgcc_eh -lc -lgcc -lgcc_eh
+init
 _GLOBAL__FI_w_prof_global_array_exe +fini _GLOBAL__FD_w_prof_global_array_exe
/usr/ccs/bin/ld: Unsatisfied symbols:
   _GLOBAL__FI_w_prof_global_array_exe (first referenced in +init option)
(code)
   _GLOBAL__FD_w_prof_global_array_exe (first referenced in +fini option)
(code)

This is the .s file for the collect2 c file:

        .LEVEL 1.1
        .SPACE $PRIVATE$
        .SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
        .SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
        .SPACE $TEXT$
        .SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
        .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
        .IMPORT $global$,DATA
        .IMPORT $$dyncall,MILLICODE
        .SPACE $PRIVATE$
        .SUBSPA $BSS$

        .align 4
count:
        .block 4
        .SPACE $PRIVATE$
        .SUBSPA $DATA$

        .align 4
ctors.1225:
        .word   P%_GLOBAL__I_65535_0_main
        .IMPORT _GLOBAL__I_65535_0_main,CODE

Without the -fwhole-program option, the constructors are retained.


-- 
           Summary: -fwhole-program option breaks collect2-generated global
                    constructors
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: driver
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: danglin at gcc dot gnu dot org
 GCC build triplet: hppa2.0w-hp-hpux11.11
  GCC host triplet: hppa2.0w-hp-hpux11.11
GCC target triplet: hppa2.0w-hp-hpux11.11


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


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

* [Bug driver/37409] -fwhole-program option breaks collect2-generated global constructors
  2008-09-07 17:50 [Bug driver/37409] New: -fwhole-program option breaks collect2-generated global constructors danglin at gcc dot gnu dot org
@ 2008-09-07 19:09 ` danglin at gcc dot gnu dot org
  2008-09-08  4:29 ` danglin at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: danglin at gcc dot gnu dot org @ 2008-09-07 19:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from danglin at gcc dot gnu dot org  2008-09-07 19:07 -------
It looks like this option can be removed in the LINK_SPEC define.


-- 

danglin at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|-fwhole-program option      |-fwhole-program option
                   |breaks collect2-generated   |breaks collect2-generated
                   |global constructors         |global constructors


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


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

* [Bug driver/37409] -fwhole-program option breaks collect2-generated global constructors
  2008-09-07 17:50 [Bug driver/37409] New: -fwhole-program option breaks collect2-generated global constructors danglin at gcc dot gnu dot org
  2008-09-07 19:09 ` [Bug driver/37409] " danglin at gcc dot gnu dot org
@ 2008-09-08  4:29 ` danglin at gcc dot gnu dot org
  2008-09-08  4:35 ` danglin at gcc dot gnu dot org
  2008-09-08 21:04 ` danglin at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: danglin at gcc dot gnu dot org @ 2008-09-08  4:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from danglin at gcc dot gnu dot org  2008-09-08 04:27 -------
Subject: Bug 37409

Author: danglin
Date: Mon Sep  8 04:26:15 2008
New Revision: 140099

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=140099
Log:
        PR driver/37409
        * pa-hpux.h (LINK_SPEC): Strip -fwhole-program.
        * pa-hpux10.h (LINK_SPEC): Likewise.
        * pa-hpux11.h (LINK_SPEC): Likewise.
`

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/pa/pa-hpux.h
    trunk/gcc/config/pa/pa-hpux10.h
    trunk/gcc/config/pa/pa-hpux11.h


-- 


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


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

* [Bug driver/37409] -fwhole-program option breaks collect2-generated global constructors
  2008-09-07 17:50 [Bug driver/37409] New: -fwhole-program option breaks collect2-generated global constructors danglin at gcc dot gnu dot org
  2008-09-07 19:09 ` [Bug driver/37409] " danglin at gcc dot gnu dot org
  2008-09-08  4:29 ` danglin at gcc dot gnu dot org
@ 2008-09-08  4:35 ` danglin at gcc dot gnu dot org
  2008-09-08 21:04 ` danglin at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: danglin at gcc dot gnu dot org @ 2008-09-08  4:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from danglin at gcc dot gnu dot org  2008-09-08 04:34 -------
Fixed.


-- 


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


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

* [Bug driver/37409] -fwhole-program option breaks collect2-generated global constructors
  2008-09-07 17:50 [Bug driver/37409] New: -fwhole-program option breaks collect2-generated global constructors danglin at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-09-08  4:35 ` danglin at gcc dot gnu dot org
@ 2008-09-08 21:04 ` danglin at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: danglin at gcc dot gnu dot org @ 2008-09-08 21:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from danglin at gcc dot gnu dot org  2008-09-08 21:03 -------
Let's try closing again.


-- 

danglin at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2008-09-08 21:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-07 17:50 [Bug driver/37409] New: -fwhole-program option breaks collect2-generated global constructors danglin at gcc dot gnu dot org
2008-09-07 19:09 ` [Bug driver/37409] " danglin at gcc dot gnu dot org
2008-09-08  4:29 ` danglin at gcc dot gnu dot org
2008-09-08  4:35 ` danglin at gcc dot gnu dot org
2008-09-08 21:04 ` danglin at gcc dot gnu dot 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).