This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

using glibc2.1 with compiler other than gcc: Problems



Using a compiler different from one of the gcc family, glibc has some
problems.  I tried to compile a program with tcc[1] and got the
following error while linking:

/tmp/tccEtDX9o/signals.b: In function `__sigismember':
/tmp/tccEtDX9o/signals.b(.text+0x0): multiple definition of `__sigismember'
/tmp/tccEtDX9o/memory.b(.text+0x0): first defined here

<bits/sigset.h> defines __sigismember with
_EXTERN_INLINE

which is defined (in <bits/sigset.h>) as:
# ifndef _EXTERN_INLINE
#  define _EXTERN_INLINE extern __inline
# endif

and __inline is defined in <sys/cdefs.h> as:
#else	/* Not GCC.  */
# define __inline		/* No inline functions.  */

The result of all this is that __sigismember (and also __sigaddset,
__sigdelset) is defined as just `extern' and therefore included in
each file.

The same problems is with the declaration of __cmsg_nxthdr in
<bits/socket.h>. 

What can we do to fix this in glibc 2.1?
a) Add a special 
#ifdef __TenDRA__
#  define __inline inline
#endif
since tcc can use inline.  This doesn't solve the general problem
since compiler y also needs extra defines...

b) implement __sigismember as macros?
c) add #if __GNUC__ around the inline functions?

For __sigismember and friends, I think we should go for solution c)
since the inlines are internal to glibc and not used in macros in the
normal name space.

For __cmsg_nxthdr we could do the same.

An alternative would be to define _EXTERN_INLINE like it's done in
<gmp.h>:
#ifndef _EXTERN_INLINE
#ifdef __GNUC__
#define _EXTERN_INLINE extern __inline__
#else
#define _EXTERN_INLINE static
#endif
#endif

I don't think we should optimize for other compilers than gcc but we
should allow the compiliation with other compilers at least.

Please tell me your comments, I'll make the patches.

Andreas

Footnotes: 
[1]  TenDRA CC, available from <http://alph.dera.gov.uk/TenDRA/>

-- 
 Andreas Jaeger   aj@arthur.rhein-neckar.de    jaeger@informatik.uni-kl.de
  for pgp-key finger ajaeger@alma.student.uni-kl.de


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]