[Bug middle-end/41729] New: Undefined reference with -fPIC -fwhole-program -flto

View: New views
4 Messages — Rating Filter:   Alert me  

[Bug middle-end/41729] New: Undefined reference with -fPIC -fwhole-program -flto

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

extern "C" {
    extern int printf (__const char *__restrict __format, ...);
}
class cException { };
class TCmdenvApp {
public:
    virtual int run();
};
int TCmdenvApp::run()
{
  try {
      printf("\nPreparing for Run #%d...\n", 1);
  }
  catch (cException *e) {
  }
}
int main()
{
  TCmdenvApp app;
  app.run();
}

> ./g++ -B. -B ../x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs cmdenv.3.ii -flto -fwhole-program -fPIC
/tmp/ccc2e3Uh.lto.o:(.gcc_except_table+0x10): undefined reference to `.LDFCM0'
collect2: ld returned 1 exit status

works without either of -flto, -fwhole-program or -fPIC.

It looks like .LDFCM0 is privatized on read-in to .LDFCM0.1932 in
lto_set_decl_assembler_name but dwarf2out does not compensate for that?


--
           Summary: Undefined reference with -fPIC -fwhole-program -flto
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: lto
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


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


[Bug middle-end/41729] Undefined reference with -fPIC -fwhole-program -flto

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #1 from hubicka at gcc dot gnu dot org  2009-11-11 22:15 -------
This seems to be some issue with EH producing type infos too early.
LDFCM0 appears there is action record:
.LLSDACSE1:
        .byte   0x1     # Action record table
        .byte   0x0
        .align 4
        .long   .LDFCM0-.

and later here:
        .type   .LDFCM0.2083, @object
        .size   .LDFCM0.2083, 8
.LDFCM0.2083:
        .quad   _ZTIP10cException
        .hidden DW.ref.__gxx_personality_v0
        .weak   DW.ref.__gxx_personality_v0
        .section      
.data.DW.ref.__gxx_personality_v0,"awG",@progbits,DW.ref.__gxx_personality_v0,comdat
        .align 8
        .type   DW.ref.__gxx_personality_v0, @object
        .size   DW.ref.__gxx_personality_v0, 8

it is however gets this


--

hubicka at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |hubicka at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-11-11 22:15:17
               date|                            |


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


[Bug middle-end/41729] Undefined reference with -fPIC -fwhole-program -flto

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #2 from hubicka at gcc dot gnu dot org  2009-11-11 23:45 -------
Subject: Bug 41729

Author: hubicka
Date: Wed Nov 11 23:45:09 2009
New Revision: 154108

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154108
Log:

        PR middle-end/41729
        * ipa.c (function_and_variable_visibility): Do not privatize COMDAT
        and WEAK variables at -fwhole-program.

        PR middle-end/41735
        * ipa.c (whole_program_function_and_variable_visility): COMDAT
        functions/variables are not needed even if they are externally visible.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/ipa.c


--


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


[Bug middle-end/41729] Undefined reference with -fPIC -fwhole-program -flto

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #3 from hubicka at gcc dot gnu dot org  2009-11-12 12:42 -------
Fixed by my patch.


--

hubicka at gcc dot gnu dot org changed:

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


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