From owner-freebsd-current Mon Nov 11 21:53:33 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 731B837B401 for ; Mon, 11 Nov 2002 21:53:31 -0800 (PST) Received: from motgate2.mot.com (motgate2.mot.com [136.182.1.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id DAC5C43E97 for ; Mon, 11 Nov 2002 21:53:27 -0800 (PST) (envelope-from rittle@latour.rsch.comm.mot.com) Received: from mothost.mot.com (mothost.mot.com [129.188.137.101]) by motgate2.mot.com (Motorola/Motgate2) with ESMTP id gAC5rZw4021504; Mon, 11 Nov 2002 22:53:35 -0700 (MST) Received: [from latour.rsch.comm.mot.com (latour.rsch.comm.mot.com [145.1.80.116]) by mothost.mot.com (MOT-pobox 2.0) with ESMTP id WAA25411; Mon, 11 Nov 2002 22:53:26 -0700 (MST)] Received: from latour.rsch.comm.mot.com (localhost.rsch.comm.mot.com [127.0.0.1]) by latour.rsch.comm.mot.com (8.12.6/8.12.6) with ESMTP id gAC5rQdF093275; Mon, 11 Nov 2002 23:53:26 -0600 (CST) (envelope-from rittle@latour.rsch.comm.mot.com) Received: (from rittle@localhost) by latour.rsch.comm.mot.com (8.12.6/8.12.6/Submit) id gAC5rQFi093274; Mon, 11 Nov 2002 23:53:26 -0600 (CST) Date: Mon, 11 Nov 2002 23:53:26 -0600 (CST) From: Loren James Rittle Message-Id: <200211120553.gAC5rQFi093274@latour.rsch.comm.mot.com> To: current@freebsd.org Subject: binutils symbol hiding and versioning (was Re: [PATCH] note the __sF change in src/UPDATING) In-Reply-To: <200211080929.17687.dfr@nlsystems.com> References: <3DCADE51.2090607@acm.org> Organization: Networks and Infrastructure Lab (IL02/2240), Motorola Labs Cc: dfr@nlsystems.com Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Doug Rabson wrote: > In the windows world, all this is handled by having a strict list of explicit > symbol exports, either in the source code using syntax extensions or with a > file supplied to the linker. I'm not sure whether binutils supports this kind > of thing but it would allow us to cut down the set of symbols exported from > libc.so. It does. Proof by example: libstdc++.so and libgcc_s.so built from sources included with FSF gcc 3.1 and all forward releases support this feature on FreeBSD. It works fine on FreeBSD 4.7 and 5.0 (with system copy of binutils in both cases). I don't know the exact version of binutils that added this feature but it was before 2.12[.2]. The ld features being used are both symbol versioning and symbol hiding. (Speaking of which, I am reminded to insert this advisement of a related minor issue with the current system compiler:) libstdc++.so as built along with the system compiler does not make use of these features yet on FreeBSD 5.0 since the system-static Makefiles to build the compiler-related libraries have not been updated to account for the feature and many extra symbols are exported as a result. libstdc++.so uses this linker features to present a more stable ABI, no matter the concrete implementation under the hood of the library. I am hoping that the gcc maintainer on the FreeBSD system-side will reconsider this issue before 5.0 is released. FYI, the libstdc++-v3 maintainers on the FSF side are only guaranteeing forward ABI compatibility of any sort if libstdc++.so is built with symbol versioning and symbol hiding. Also, I believe it may be an error to even ship a libstdc++.so unless it is linked against libgcc_s.so (and it currently is not so linked since we don't build libgcc_s.so). As I understand it, if a user of the system compiler attempts to build a stand-alone C++ shared library (i.e. no link against libstdc++.so) but then later uses it in an application that also uses libstdc++.so, EH will fail unless libgcc_s.so was properly built and used. I understand that FreeBSD circa 1996(?) attempted to use a "shared libgcc.so"; libgcc_s.so is similar but different. For one libgcc_s.so is only part of what was libgcc.a; i.e. all code still links against libgcc.a when libgcc_s.so is built and used properly. Regards, Loren To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message