From owner-freebsd-current Fri Jan 7 23:52:30 2000 Delivered-To: freebsd-current@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id A9DB115135 for ; Fri, 7 Jan 2000 23:52:25 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (beefcake.zeta.org.au [203.26.10.12]) by mailman.zeta.org.au (8.8.7/8.8.7) with ESMTP id SAA27388; Sat, 8 Jan 2000 18:52:16 +1100 Date: Sat, 8 Jan 2000 18:52:12 +1100 (EST) From: Bruce Evans X-Sender: bde@alphplex.bde.org To: Luoqi Chen Cc: current@FreeBSD.ORG, jasone@canonware.com Subject: Re: __sigisempty() undefined if "cc -g" used. In-Reply-To: <200001080036.TAA05054@lor.watermarkgroup.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, 7 Jan 2000, Luoqi Chen wrote: > > In an effort to chase down a libc_r bug, I compiled libc_r with CFLAGS=-g > > (and later CFLAGS=-g3), but ran into linker problems as a result. > > > > blitz:~> gcc poll.c -pthread > > /usr/lib/libc_r.so: undefined reference to `__sigisempty' > > > > Even the simplest of C programs will get this linker error if using the > > -pthread option. > > > > So, __sigisempty is an inline function, defined in > > /usr/include/sys/signalvar.h: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ should not be used outside of the kernel. Especially not kernel inline functions in it. User servicable parts should be in . > > extern __inline int ^^^^^^ Bug. This also breaks compiling the kernel with -O. You apparently clobbered -O in CFLAGS by setting CFLAGS=-g. -g normally needs to be added to CC to avoid breaking CFLAGS (CC='cc -g'). > > __sigisempty(sigset_t *set) > > { > > int i; > > > > for (i = 0; i < _SIG_WORDS; i++) { > > if (set->__bits[i]) > > return (0); > > } > > return (1); > > } > > > It doesn't make much sense to have an "extern" inline function, gcc probably > was confused by this, change "extern" to "static" and try again. `extern' makes sense (see gcc.info), and is extensively used in Linux, but usually it does the same things `static' except it breaks compiling with -O. It prevents zillions of copies of the function being produced (non-inline) in certain cases where inlining is not done (e.g., with -O). A normal non-inline extern version of the function must be provided to handle these cases. Sloppy use of `extern inline' doesn't provide the extern function. Forcing use of the extern version may be useful for profiling and similar instrumentation (-finstrument-functions?), and for debugging. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message