From owner-freebsd-hackers Thu Mar 13 15:44:26 2003 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D368C37B401 for ; Thu, 13 Mar 2003 15:44:24 -0800 (PST) Received: from ns1.xcllnt.net (209-128-86-226.BAYAREA.NET [209.128.86.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id DFD9743FB1 for ; Thu, 13 Mar 2003 15:44:23 -0800 (PST) (envelope-from marcel@xcllnt.net) Received: from ns1.xcllnt.net (localhost [127.0.0.1]) by ns1.xcllnt.net (8.12.8/8.12.8) with ESMTP id h2DNiNSd058605; Thu, 13 Mar 2003 15:44:23 -0800 (PST) (envelope-from marcel@ns1.xcllnt.net) Received: (from marcel@localhost) by ns1.xcllnt.net (8.12.8/8.12.8/Submit) id h2DNiNS4058604; Thu, 13 Mar 2003 15:44:23 -0800 (PST) Date: Thu, 13 Mar 2003 15:44:23 -0800 From: Marcel Moolenaar To: Joe Marcus Clarke Cc: hackers@FreeBSD.ORG Subject: Re: Question on gcc linker and -pthread Message-ID: <20030313234423.GA58541@ns1.xcllnt.net> References: <1047586732.84063.10.camel@gyros> <20030313230538.GA58315@ns1.xcllnt.net> <1047597337.84063.43.camel@gyros> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1047597337.84063.43.camel@gyros> User-Agent: Mutt/1.5.1i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, Mar 13, 2003 at 06:15:37PM -0500, Joe Marcus Clarke wrote: > > Using -Wl,-shared tricks the compiler driver in thinking you are > > creating an executable. It will therefore make sure dependencies > > are correct by adding -lc_r on the link line. You tell the linker > > however that you're creating a shared object, but now it also has > > -lc_r explicitly. Again, this can result in a bad shared object. > > Thanks for the explanation. After I sent the email, I looked at the > FreeBSD spec header for GCC. I saw that -lc_r is only passed to the > linker if -shared is not specified. > > I'm still a bit confused because for ports, ${PTHREAD_LIBS} is set to > -lc_r in -CURRENT which will result in shared objects having a libc_r.so > link. However, in -STABLE, ${PTHREAD_LIBS} is set to -pthread. If one > specifies -pthread in -CURRENT, they will get the -STABLE linking > behavior. So, all -CURRENT users won't see the undefined symbol problem > I'm seeing in -STABLE. Is this inconsistency by design? That's a good question. I tend to think it's not by design, as very little really is :-) > Since ia64 is > a -CURRENT only architecture, your explanation makes me think using > -lc_r explicitly in -CURRENT is still a bad idea. Yes. We have the same problem with libobjc.a that's being linked into a shared object (ports/lang/gnustep-base). The problem is not easily resolved, although it's easy to come up with possible solutions. -- Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message