public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jack Howarth <howarth@bromo.med.uc.edu>
To: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>,
	       Andrew Pinski <pinskia@gmail.com>,
	Richard Henderson <rth@redhat.com>,
	       gcc-patches@gcc.gnu.org, iains@gcc.gnu.org,
	mikestump@comcast.net
Subject: Re: [PATCH] Avoid -lm and -lpthread in libjava on darwin
Date: Thu, 12 Aug 2010 22:08:00 -0000	[thread overview]
Message-ID: <20100812213826.GC26124@bromo.med.uc.edu> (raw)
In-Reply-To: <20100812210945.GA5561@gmx.de>

On Thu, Aug 12, 2010 at 11:09:46PM +0200, Ralf Wildenhues wrote:
> * Andrew Pinski wrote on Thu, Aug 12, 2010 at 08:23:13PM CEST:
> > On Thu, Aug 12, 2010 at 11:20 AM, Richard Henderson <rth@redhat.com> wrote:
> > > Is this patch necessary with the remove-outfile patch in place?
> > 
> > Yes because libtool calls ld directly for libjava.  I wish it did not
> > but it does.
> 
> * Jack Howarth wrote on Thu, Aug 12, 2010 at 08:24:30PM CEST:
> > The remove-outfile patch is necessary to make sure that the gcc
> > compilers don't shift libSystem forward in the linkage and
> > disrupt the logic behind libgcc_ext when -ldl, -lm or -lpthread
> > is passed to the compiler. The libjava patch covers the hardcoding
> > of -lpthread and -lm into the linker flags that are passed via
> > libtool directly to the linker.
> 
> So do I understand correctly that this ought to be fixed in libtool?
> Is the requirement to have libSystem last one that is specific to GCC
> or common to all software built with GCC?

Ralf,
  The requirement to keep libSystem last is a result of the addition of
libgcc_ext in FSF gcc-4.5 and later. The libgcc_ext shared library uses
versioned stubs to export those additional symbols from libgcc_s which aren't
present in Apple's versioned libgcc's. This is discussed in the
long and winding http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39888.
  Basically we need to insure that the linkage stays as...

	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 625.0.0)
	/sw/lib/gcc4.6/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)

without my remove-outfile patch, if you pass -ldl, -lm or -lpthread to the gcc compiler,
it will change the linkage to...

	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)
	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 625.0.0)
	/sw/lib/gcc4.5/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)

which breaks the logic used by libgcc_ext. The same problem can arise if a program
manually links via libtool with ld (even in the presence of the remove-outfile patch).
Hence the second libjava patch which prevents -lm and -lpthread from being used in the
libjava build on darwin.
         Jack
ps Note that testresults with the two patches from last night eliminated the failures
in gcc.dg/torture/builtin-math-7.c (PR42333) by insuring that the non-buggy FSF libgcc
___divdc3 routine is used instead of the less accurate one from the compiler-rt.llvm.org
project code. This is just as well since Apple doesn't seem interested in fixing that one...

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42333#c47

> 
> Thanks,
> Ralf

  reply	other threads:[~2010-08-12 21:38 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-12 11:44 Jack Howarth
2010-08-12 13:04 ` Andrew Haley
2010-08-18  9:05   ` IainS
2010-08-12 18:22 ` Richard Henderson
2010-08-12 18:24   ` Andrew Pinski
2010-08-12 21:34     ` Ralf Wildenhues
2010-08-12 22:08       ` Jack Howarth [this message]
2010-08-12 22:36         ` Jack Howarth
2010-08-12 23:21         ` IainS
2010-08-12 23:34           ` IainS
2010-08-13  0:28             ` Jack Howarth
2010-08-12 18:26   ` Jack Howarth
2010-08-12 22:33 ` Mike Stump
2010-08-12 22:46   ` IainS
2010-08-13  5:59     ` Mike Stump
2010-08-12 22:47   ` Mike Stump
2010-08-12 23:08     ` Jack Howarth
2010-08-13 10:08     ` Andrew Haley
2010-08-12 22:59   ` IainS

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=20100812213826.GC26124@bromo.med.uc.edu \
    --to=howarth@bromo.med.uc.edu \
    --cc=Ralf.Wildenhues@gmx.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=iains@gcc.gnu.org \
    --cc=mikestump@comcast.net \
    --cc=pinskia@gmail.com \
    --cc=rth@redhat.com \
    /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).