Browse Source

bits/sigset.h: Fix _EXTERN_INLINE redefinition

Commit 251a3c19cb "sleep: employ __USE_EXTERN_INLINES (with necessary fixes)"
introduces following problems:

1. __USE_EXTERN_INLINES forcibly enabled build fails

 ...
   LD libuClibc-1.0.15.so
 libc/libc_so.a(cmsg_nxthdr.os): In function `__GI___cmsg_nxthdr':
 cmsg_nxthdr.c:(.text.__GI___cmsg_nxthdr+0x0): multiple definition of `__GI___cmsg_nxthdr'
 libc/libc_so.a(close.os):close.c:(.text.__GI___cmsg_nxthdr+0x0): first defined here
 libc/libc_so.a(creat.os): In function `__GI___cmsg_nxthdr':
 creat.c:(.text.__GI___cmsg_nxthdr+0x0): multiple definition of `__GI___cmsg_nxthdr'
 libc/libc_so.a(close.os):close.c:(.text.__GI___cmsg_nxthdr+0x0): first defined here
 ...

2. libuargp wrongly contains __cmsg_nxthdr/__sigismember/__sigdelset/__sigaddset
  global symbols on platforms which includes signal.h from sys/procfs.h
  As result, static linking will fail:

  TEST_LINK argp/ bug-argp1
 /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libc.a(sigsetops.os):
 In function `__GI___sigismember':
 sigsetops.c:(.text+0x0): multiple definition of `__sigismember'
 /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libuargp.a(argp-xinl.os):argp-xinl.c:(.text+0x0):
 first defined here
 /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libc.a(sigsetops.os):
 In function `__GI___sigaddset':
 sigsetops.c:(.text+0x28): multiple definition of `__sigaddset'
 /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libuargp.a(argp-xinl.os):argp-xinl.c:(.text+0x28):
 first defined here
 /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libc.a(sigsetops.os):
 In function `__GI___sigdelset':
 sigsetops.c:(.text+0x4c): multiple definition of `__sigdelset'
 /home/wbx/ppc-static/target_qemu-ppc-macppc_uclibc-ng_hard/usr/lib/libuargp.a(argp-xinl.os):argp-xinl.c:(.text+0x4c):
 first defined here

We have to partially revert 251a3c19cb to fix problems above. It is
safe to do this after commit
 162cfaea20 *: inline constant __sig{add,del}set and __sigismember
since we are able to use new inlines from within libc and leave the
rest of world(__USE_EXTERN_INLINES) equal to glibc now.

Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Leonid Lisovskiy 7 years ago
parent
commit
dd46699e46
2 changed files with 5 additions and 11 deletions
  1. 1 1
      libc/signal/sigsetops.c
  2. 4 10
      libc/sysdeps/linux/common/bits/sigset.h

+ 1 - 1
libc/signal/sigsetops.c

@@ -3,7 +3,7 @@
 
 #include <features.h>
 
-#define __PROVIDE_OUT_OF_LINE_SIGSETFN
+#define _EXTERN_INLINE
 #ifndef __USE_EXTERN_INLINES
 # define __USE_EXTERN_INLINES	1
 #endif

+ 4 - 10
libc/sysdeps/linux/common/bits/sigset.h

@@ -52,6 +52,10 @@ typedef struct {
 #if !defined _SIGSET_H_fns && defined _SIGNAL_H
 # define _SIGSET_H_fns 1
 
+# ifndef _EXTERN_INLINE
+#  define _EXTERN_INLINE __extern_inline
+# endif
+
 /* Return a mask that includes the bit for SIG only.  */
 /* Unsigned cast ensures shift/mask insns are used.  */
 # define __sigmask(sig) \
@@ -151,24 +155,14 @@ typedef struct {
 /* These functions needn't check for a bogus signal number -- error
    checking is done in the non __ versions.  */
 
-# if !defined __USE_EXTERN_INLINES || defined __PROVIDE_OUT_OF_LINE_SIGSETFN
 extern int __sigismember (const __sigset_t *, int);
 libc_hidden_proto(__sigismember)
 extern void __sigaddset (__sigset_t *, int);
 libc_hidden_proto(__sigaddset)
 extern void __sigdelset (__sigset_t *, int);
 libc_hidden_proto(__sigdelset)
-# endif
 
 # ifdef __USE_EXTERN_INLINES
-#  undef _EXTERN_INLINE
-#  ifdef __PROVIDE_OUT_OF_LINE_SIGSETFN
-#   define _EXTERN_INLINE
-#  else /* normal case */
-    /* dropped extern below: otherwise every module with __USE_EXTERN_INLINES
-     * will have its own copy of out-of line function emitted. */
-#   define _EXTERN_INLINE /*extern*/ __always_inline
-#  endif
 #  define __SIGSETFN(RET_TYPE, NAME, BODY, CONST)			\
 _EXTERN_INLINE RET_TYPE							\
 NAME (CONST __sigset_t *__set, int __sig)				\