public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "davek at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/42818] Static C++ linking breakage "undefined reference to ___real__Znwj" and others in libcygwin.a(_cygwin_crt0_common.o)
Date: Thu, 21 Jan 2010 05:01:00 -0000	[thread overview]
Message-ID: <20100121050055.24145.qmail@sourceware.org> (raw)
In-Reply-To: <bug-42818-14373@http.gcc.gnu.org/bugzilla/>



------- Comment #6 from davek at gcc dot gnu dot org  2010-01-21 05:00 -------
So, the optimal solution would be to avoid using the redirection wrappers when
we're statically linking.

That's still possible: those undefined references without relocs don't cause
problems in and of themselves, but only because they turn the weak undefs that
*do* have relocs strong.  The obvious solution, since we're not using the
redirection wrapper functions, is to also not include the array of weak
function pointers.

That would be trival to do by building two different versions of the CRT
startup code in Cygwin itself, one for shared linking that contains the array,
one for static linking that doesn't, and selecting the appropriate one at link
time using a spec in the backend.

That would work fine for --static, but as things stand now, it will still fail
when just --static-libstdc++ is in use.  This is because of the situation
described in the two dependency PRs (Bug 41594 and Bug 41596): you can't test
for --static-libstdc++ in a spec, because the code in g++spec.c removes it from
the command-line.

So, I'm going to leave this bug open and suspend it now I've committed the
simple fix.  Then, next stage 1, we'll get the situation with
--static-libstdc++ resolved one way or another, and by that time I'll have
added the alternative startup CRT object to the Cygwin runtime, and then I'll
revert this fix and adjust the linker spec to select the correct startup
variant.


-- 

davek at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |SUSPENDED


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


  parent reply	other threads:[~2010-01-21  5:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2010-04-06 11:26 ` rguenth at gcc dot gnu dot org
2010-07-31  9:35 ` rguenth at gcc dot gnu dot org
     [not found] <bug-42818-4@http.gcc.gnu.org/bugzilla/>
2010-12-16 13:07 ` 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100121050055.24145.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).