public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/42818]  New: Static C++ linking breakage "undefined reference to ___real__Znwj" and others in libcygwin.a(_cygwin_crt0_common.o)
@ 2010-01-21  3:09 davek at gcc dot gnu dot org
  2010-01-21  3:20 ` [Bug target/42818] " davek at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: davek at gcc dot gnu dot org @ 2010-01-21  3:09 UTC (permalink / raw)
  To: gcc-bugs

[ Don't Panic.  There is already a fix for this bug, in fact two, one that is
suitable for our current Stage 3(4?) status but slightly suboptimal, another
that is better but blocked by an existing PR that won't be fixed until next
Stage1.  I just figured I should say that first of all. ]

There's a problematic interaction between the parts of cygwin backend's linker
specs, the cygwin libc CRT startup code, and the backend's support for N2800
#17.6.4.6 [replacement.functions].  When linking C++ executables statically,
this leads to symptoms such as those reported here:

    http://cygwin.com/ml/cygwin/2009-12/msg00583.html

/tmp/winsup/i686-pc-cygwin/winsup/cygwin/libcygwin.a(_cygwin_crt0_common.o):_cyg
> win_crt0_common.cc:(.data+0x0): undefined reference to `___real__Znwj'
> /tmp/winsup/i686-pc-cygwin/winsup/cygwin/libcygwin.a(_cygwin_crt0_common.o):_cyg
> win_crt0_common.cc:(.data+0x4): undefined reference to `___real__Znaj'
> /tmp/winsup/i686-pc-cygwin/winsup/cygwin/libcygwin.a(_cygwin_crt0_common.o):_cyg
> win_crt0_common.cc:(.data+0x8): undefined reference to `___real__ZdlPv'
> collect2: ld returned 1 exit status
> make[1]: *** [cygserver.exe] Error 1

The particular functions reported as undefined will be whatever subset of the
replaceable new/delete operators are referenced in the executable and drawn
into the final link.

I'll post analysis, patches and test results as separate comments.  I've not
set the severity of this bug any higher than "normal" because it's
already/about-to-be fixed, but I'm going to leave it open after applying the
stage3-suitable fix to remind me to apply the more optimal one when we return
to stage 1 and Bug 41594 and/or Bug 41596 get fixed.


-- 
           Summary: Static C++ linking breakage "undefined reference to
                    ___real__Znwj" and others in
                    libcygwin.a(_cygwin_crt0_common.o)
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, link-failure
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: davek at gcc dot gnu dot org
        ReportedBy: davek at gcc dot gnu dot org
 GCC build triplet: i686-pc-cygwin
  GCC host triplet: i686-pc-cygwin
GCC target triplet: i686-pc-cygwin
 BugsThisDependsOn: 41594,41596


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


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

end of thread, other threads:[~2024-03-17 19:50 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-42818-4@http.gcc.gnu.org/bugzilla/>
2010-12-16 13:07 ` [Bug target/42818] Static C++ linking breakage "undefined reference to ___real__Znwj" and others in libcygwin.a(_cygwin_crt0_common.o) rguenth at gcc dot gnu.org
2012-01-12 20:29 ` pinskia at gcc dot gnu.org
2024-03-17  5:13 ` iains at gcc dot gnu.org
2024-03-17 19:50 ` egallager at gcc dot gnu.org
2010-01-21  3:09 [Bug target/42818] New: " davek at gcc dot gnu dot org
2010-01-21  3:20 ` [Bug target/42818] " davek at gcc dot gnu dot org
2010-01-21  3:57 ` davek at gcc dot gnu dot org
2010-01-21  4:00 ` davek at gcc dot gnu dot org
2010-01-21  4:57 ` davek at gcc dot gnu dot org
2010-01-21  5:00 ` davek at gcc dot gnu dot org
2010-01-21  5:01 ` davek at gcc dot gnu dot org
2010-04-06 11:26 ` rguenth at gcc dot gnu dot org
2010-07-31  9:35 ` rguenth 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).