From owner-freebsd-hackers@freebsd.org Thu May 10 20:22:39 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61070FD5CD7 for ; Thu, 10 May 2018 20:22:39 +0000 (UTC) (envelope-from joerg@bec.de) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:c:538::196]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E159E763D1 for ; Thu, 10 May 2018 20:22:38 +0000 (UTC) (envelope-from joerg@bec.de) X-Originating-IP: 87.153.197.147 Received: from britannica.bec.de (p5799C593.dip0.t-ipconnect.de [87.153.197.147]) (Authenticated sender: joerg@bec.de) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id E6ACFE0007; Thu, 10 May 2018 22:22:30 +0200 (CEST) Date: Thu, 10 May 2018 22:22:27 +0200 From: Joerg Sonnenberger To: Steve Kargl Cc: freebsd-hackers@freebsd.org Subject: Re: Runtime loader issue Message-ID: <20180510202227.GA6592@britannica.bec.de> Mail-Followup-To: Steve Kargl , freebsd-hackers@freebsd.org References: <20180509234551.GA39526@troutmask.apl.washington.edu> <20180510190549.GB14916@britannica.bec.de> <20180510194823.GA60567@troutmask.apl.washington.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180510194823.GA60567@troutmask.apl.washington.edu> User-Agent: Mutt/1.9.5 (2018-04-13) X-Spam-Level: X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 May 2018 20:22:39 -0000 On Thu, May 10, 2018 at 12:48:23PM -0700, Steve Kargl wrote: > On Thu, May 10, 2018 at 09:05:49PM +0200, Joerg Sonnenberger wrote: > > On Wed, May 09, 2018 at 04:45:51PM -0700, Steve Kargl wrote: > > > In review PR 228007, it came to my attention some individuals are > > > mis-characterizing a FreeBSD loader issue as "gfortran's FreeBSD > > > issue". > > > > I don't get why you are blaming the FreeBSD loader. In fact, this is a > > pretty common issue and the fault is and has always been that the GCC > > ecosystem is extremely bad about mixing different GCC versions in the > > runtime environment. It tends to somewhat work as long as you make sure > > that the main binary is using the newest GCC version, but it can still > > fail even then. > > > > It is a runtime loader issue in that the loader cannot not > deal with a name clash. It is not supposed to. The soname identifies the object. If you end up with multiple different objects with the same soname, it is your fault. It's not something the loader can magically fix. > Tijl's suggested fix of re-ordering the list of hints so > gcc7's libgcc_s.so.1 is found before /lib/libgcc_s.so.1 > works around the issue of executables compiled by gfortran7 > getting the correct libgcc_s.so.1. It doesn't solve the problem because it assumes that gfortran7's libgcc_so.so.1 is a superset of /lib/libgcc_s.so.1. This is a very popular assumption in GCCland and it turns out to be false surprisingly often. > As to your comment "the fault is and has always been that > the GCC ecosystem is extremely bad about mixing different > GCC version". libgcc_s.so.1 is a symbol versioned shared > library. As long as the ABI of symbols are not changed, > one can add new symbols without bumping the library version > number. GCC has added symbols to libgcc_s.so.1 since gcc > 4.2.1, and FreeBSD has not stayed in-sync. This is missing the point. GCC assumes that it always gets its own version of libgcc_s.so, because of course you are always going to compile things with the newest GCC in your system. Ironically, symbol versioning makes this situation *worse*, because symbol lookup no longer falls through consistently. > If you want to get snarky about different projects, don't > you think that "the fault is and has always been that the > FreeBSD ecosystem" (mis)appropriated the name libgcc when > clang came into the tree [1] because clang didn't have a > runtime library [2] and it was expedient to simply use > libgcc_s.so.1. Again, you are missing that the situation would happen just the same if the base compiler is GCC 4.2.1 and not Clang. Joerg