From owner-freebsd-hackers Fri Feb 27 05:37:45 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id FAA20534 for freebsd-hackers-outgoing; Fri, 27 Feb 1998 05:37:45 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from postman.opengroup.org (postman.opengroup.org [130.105.1.152]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id FAA20524 for ; Fri, 27 Feb 1998 05:37:41 -0800 (PST) (envelope-from k.#nojunk#keithley@opengroup.org) Received: from kaleb.keithley.belmont.ma.us (horizon5.camb.opengroup.org [130.105.39.29]) by postman.opengroup.org (8.8.6/8.8.6) with SMTP id IAA17610 for ; Fri, 27 Feb 1998 08:37:09 -0500 (EST) Message-ID: <34F70843.2781E494@opengroup.org> Date: Fri, 27 Feb 1998 13:38:59 -0500 From: "Kaleb S. KEITHLEY" Reply-To: kaleb@opengroup.org Organization: The Open Group X-Mailer: Mozilla 3.04Gold (X11; I; FreeBSD 3.0-971225-SNAP i386) MIME-Version: 1.0 To: hackers@FreeBSD.ORG Subject: Re: symbols in libc_r not in libc References: <199802271257.NAA24819@ws6423.gud.siemens.at> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG marino.ladavac@siemens.at wrote: > > > > > On a 3.0-971225-SNAP system, when I build Xlib thread-safe I use > > -D_REENTRANT and -D_THREAD_SAFE, and all references to errno are > > converted to *__error(). No problem there. > > > > Now when I link a non-threaded program, e.g. xterm, to the mt-safe Xlib, > > when I try to run it I get unresolved externals for ___error. > > > > What that tells me is that libc (not libc_r) needs a #pragma weak > > __error so that when I link non-threaded programs against libX11, > > they'll work, and when I link a threaded program with libX11 and libc_r, > > it'll get the right version of __error. > > > > As far as I can understand weak symbols, you can add your own version of > __error() in Xlib, as a weak symbol. In my not so humble opinion, that's a hack. > That way, the programs that do not > use libc_r get the __error() from Xlib, and the ones that do from libc_r > (I take it that the libc_r __error() is a strong symbol). This should > give you exactly what you need exactly where you need it. > > The Xlib implementation of __error() should naturally just return the > address of errno. Don't forget to undefine errno when you implement > the Xlib __error(). > > Hope I didn't miss anything. Well, just that Xlib isn't in the business of providing libc functions or putting a band-aid over a broken libc. The weak __error() function belongs in libc. -- Kaleb S. KEITHLEY To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message