[PATCH] Use SHLIB_COMPAT for libc symbols only if building libc.so
Siddhesh Poyarekar
siddhesh@redhat.com
Tue Mar 18 05:53:00 GMT 2014
Hi,
SHLIB_COMPAT implicitly assumes that IS_IN_$(lib) is defined for the
library it is called for, which is not always true. When building
libm.so and libpthread.so, one would encounter SHLIB_COMPAT calls for
libc, which gets called without IS_IN_libc being defined, which raises
a warning with -Wundef.
One way to fix this would have been to change the conditional in
SHLIB_COMPAT definition to use if defined IS_IN_##lib, but I chose the
more explicit path, which was to mark only callers that would
encounter this problem, i.e. code where SHLIB_COMPAT(libc,...) is used
outside of libc.so.
I took a sha1sum of all generated binaries and verified that they're
the same before and after.
Siddhesh
* libio/libio.h [defined _LIBC && defined SHARED]: Call
SHLIB_COMPAT only when building libc.so.
* nptl/forward.c: Likewise.
diff --git a/libio/libio.h b/libio/libio.h
index 6077f5c..060b5f5 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -482,7 +482,7 @@ extern int _IO_fwide (_IO_FILE *__fp, int __mode) __THROW;
versions. */
# if defined _LIBC && defined SHARED
# include <shlib-compat.h>
-# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
+# if !defined NOT_IN_libc && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
# define _IO_fwide_maybe_incompatible \
(__builtin_expect (&_IO_stdin_used == NULL, 0))
extern const int _IO_stdin_used;
diff --git a/nptl/forward.c b/nptl/forward.c
index 6355c23..ff4c6e5 100644
--- a/nptl/forward.c
+++ b/nptl/forward.c
@@ -58,7 +58,7 @@ name decl \
FORWARD (pthread_attr_destroy, (pthread_attr_t *attr), (attr), 0)
-#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_1)
+#if !defined NOT_IN_libc && SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_1)
FORWARD (__pthread_attr_init_2_0, (pthread_attr_t *attr), (attr), 0)
compat_symbol (libc, __pthread_attr_init_2_0, pthread_attr_init, GLIBC_2_0);
#endif
@@ -98,7 +98,7 @@ FORWARD (pthread_attr_setscope, (pthread_attr_t *attr, int scope),
FORWARD (pthread_condattr_destroy, (pthread_condattr_t *attr), (attr), 0)
FORWARD (pthread_condattr_init, (pthread_condattr_t *attr), (attr), 0)
-#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
+#if !defined NOT_IN_libc && SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
FORWARD2 (__pthread_cond_broadcast_2_0, int attribute_compat_text_section,
(pthread_cond_2_0_t *cond), (cond), return 0)
compat_symbol (libc, __pthread_cond_broadcast_2_0, pthread_cond_broadcast,
@@ -108,7 +108,7 @@ FORWARD (__pthread_cond_broadcast, (pthread_cond_t *cond), (cond), 0)
versioned_symbol (libc, __pthread_cond_broadcast, pthread_cond_broadcast,
GLIBC_2_3_2);
-#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
+#if !defined NOT_IN_libc && SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
FORWARD2 (__pthread_cond_destroy_2_0, int attribute_compat_text_section,
(pthread_cond_2_0_t *cond), (cond), return 0)
compat_symbol (libc, __pthread_cond_destroy_2_0, pthread_cond_destroy,
@@ -118,7 +118,7 @@ FORWARD (__pthread_cond_destroy, (pthread_cond_t *cond), (cond), 0)
versioned_symbol (libc, __pthread_cond_destroy, pthread_cond_destroy,
GLIBC_2_3_2);
-#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
+#if !defined NOT_IN_libc && SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
FORWARD2 (__pthread_cond_init_2_0, int attribute_compat_text_section,
(pthread_cond_2_0_t *cond, const pthread_condattr_t *cond_attr),
(cond, cond_attr), return 0)
@@ -129,7 +129,7 @@ FORWARD (__pthread_cond_init,
(cond, cond_attr), 0)
versioned_symbol (libc, __pthread_cond_init, pthread_cond_init, GLIBC_2_3_2);
-#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
+#if !defined NOT_IN_libc && SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
FORWARD2 (__pthread_cond_signal_2_0, int attribute_compat_text_section,
(pthread_cond_2_0_t *cond), (cond), return 0)
compat_symbol (libc, __pthread_cond_signal_2_0, pthread_cond_signal,
@@ -139,7 +139,7 @@ FORWARD (__pthread_cond_signal, (pthread_cond_t *cond), (cond), 0)
versioned_symbol (libc, __pthread_cond_signal, pthread_cond_signal,
GLIBC_2_3_2);
-#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
+#if !defined NOT_IN_libc && SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
FORWARD2 (__pthread_cond_wait_2_0, int attribute_compat_text_section,
(pthread_cond_2_0_t *cond, pthread_mutex_t *mutex), (cond, mutex),
return 0)
@@ -151,7 +151,7 @@ FORWARD (__pthread_cond_wait, (pthread_cond_t *cond, pthread_mutex_t *mutex),
versioned_symbol (libc, __pthread_cond_wait, pthread_cond_wait,
GLIBC_2_3_2);
-#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
+#if !defined NOT_IN_libc && SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
FORWARD2 (__pthread_cond_timedwait_2_0, int attribute_compat_text_section,
(pthread_cond_2_0_t *cond, pthread_mutex_t *mutex,
const struct timespec *abstime), (cond, mutex, abstime),
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20140318/aaf97c07/attachment.sig>
More information about the Libc-alpha
mailing list