]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix gethostbyaddr in6addr_any, in6addr_loopback namespace (bug 18532).
authorJoseph Myers <joseph@codesourcery.com>
Wed, 17 Jun 2015 20:08:22 +0000 (20:08 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Wed, 17 Jun 2015 20:08:22 +0000 (20:08 +0000)
gethostbyaddr brings in references to in6addr_any and thereby
in6addr_loopback, which aren't in all the standards containing
gethostbyaddr (gethostbyaddr is in XPG4 and UNIX98, in6addr_any and
in6addr_loopback are new in POSIX.1:2001).  This patch fixes this by
making those symbols into weak aliases (safe in this case, unlike for
most data symbols, because these data symbols are const).

Tested for x86_64 and x86 (testsuite, and comparison of disassembly of
installed stripped shared libraries).  Disassembly is unchanged for
x86_64; for x86, I see some changes of stack offsets, but no other
code generation changes or code size differences.

[BZ #18532]
* inet/in6_addr.c (in6addr_any): Rename to __in6addr_any and
define as weak alias of __in6addr_any.  Use libc_hidden_data_weak.
(in6addr_loopback): Rename to __in6addr_loopback and define as
weak alias of __in6addr_loopback.  Use libc_hidden_data_weak.
* include/netinet/in.h (__in6addr_loopback): Declare.  Use
libc_hidden_proto.
(__in6addr_any): Likewise.
* inet/gethstbyad_r.c (PREPROCESS): Use __in6addr_any instead of
in6addr_any.
* conform/Makefile (test-xfail-XPG4/netdb.h/linknamespace): Remove
variable.
(test-xfail-UNIX98/netdb.h/linknamespace): Likewise.

ChangeLog
NEWS
conform/Makefile
include/netinet/in.h
inet/gethstbyad_r.c
inet/in6_addr.c

index 29c8a30138896883475ab2b73a92c273328f1a0d..bfd78a8970dfa5e37d92e8d862991e4afa478215 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2015-06-17  Joseph Myers  <joseph@codesourcery.com>
+
+       [BZ #18532]
+       * inet/in6_addr.c (in6addr_any): Rename to __in6addr_any and
+       define as weak alias of __in6addr_any.  Use libc_hidden_data_weak.
+       (in6addr_loopback): Rename to __in6addr_loopback and define as
+       weak alias of __in6addr_loopback.  Use libc_hidden_data_weak.
+       * include/netinet/in.h (__in6addr_loopback): Declare.  Use
+       libc_hidden_proto.
+       (__in6addr_any): Likewise.
+       * inet/gethstbyad_r.c (PREPROCESS): Use __in6addr_any instead of
+       in6addr_any.
+       * conform/Makefile (test-xfail-XPG4/netdb.h/linknamespace): Remove
+       variable.
+       (test-xfail-UNIX98/netdb.h/linknamespace): Likewise.
+
 2015-06-17  Andrew Senkevich  <andrew.senkevich@intel.com>
 
        * bits/libm-simd-decl-stubs.h: Added stubs for pow.
diff --git a/NEWS b/NEWS
index d49bfed3559d899cd61f5d426a86c011f3f98d59..a4a010708fda7120ed8b30d0f3f49cfd551b7a0f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -21,7 +21,7 @@ Version 2.22
   18210, 18211, 18217, 18220, 18221, 18234, 18244, 18247, 18287, 18319,
   18324, 18333, 18346, 18397, 18409, 18410, 18412, 18418, 18422, 18434,
   18444, 18468, 18469, 18470, 18479, 18483, 18495, 18496, 18497, 18498,
-  18507, 18512, 18519, 18520, 18522, 18527, 18528, 18529, 18530.
+  18507, 18512, 18519, 18520, 18522, 18527, 18528, 18529, 18530, 18532.
 
 * Cache information can be queried via sysconf() function on s390 e.g. with
   _SC_LEVEL1_ICACHE_SIZE as argument.
index 522249ad6a169d8a59af65f45cee6fd48ace2e27..9ad760187dbb7990b5155388fc1b51082e8510e4 100644 (file)
@@ -346,14 +346,12 @@ test-xfail-XOPEN2K8/ndbm.h/linknamespace = yes
 # Unsorted expected failures.
 test-xfail-XPG3/unistd.h/linknamespace = yes
 test-xfail-XPG4/fmtmsg.h/linknamespace = yes
-test-xfail-XPG4/netdb.h/linknamespace = yes
 test-xfail-XPG4/syslog.h/linknamespace = yes
 test-xfail-XPG4/unistd.h/linknamespace = yes
 test-xfail-POSIX/mqueue.h/linknamespace = yes
 test-xfail-POSIX/semaphore.h/linknamespace = yes
 test-xfail-UNIX98/fmtmsg.h/linknamespace = yes
 test-xfail-UNIX98/mqueue.h/linknamespace = yes
-test-xfail-UNIX98/netdb.h/linknamespace = yes
 test-xfail-UNIX98/syslog.h/linknamespace = yes
 test-xfail-UNIX98/unistd.h/linknamespace = yes
 test-xfail-UNIX98/wchar.h/linknamespace = yes
index 6fb5c86de999ba82627a678523ab8dba68cc909e..5e377469e782a5b1129cee0721ca6eaecd3b2155 100644 (file)
@@ -5,7 +5,11 @@
 #ifndef _ISOMAC
 libc_hidden_proto (bindresvport)
 libc_hidden_proto (in6addr_loopback)
+extern __typeof (in6addr_loopback) __in6addr_loopback;
+libc_hidden_proto (__in6addr_loopback)
 libc_hidden_proto (in6addr_any)
+extern __typeof (in6addr_any) __in6addr_any;
+libc_hidden_proto (__in6addr_any)
 #endif
 
 #endif
index 72ce441d20a4a2c019f3e9b1d3197f767f620eb4..06d39066c120bd921c46c001b2a42ee1a8265cd5 100644 (file)
@@ -32,7 +32,7 @@
    be performed.  */
 #define PREPROCESS \
   if (len == sizeof (struct in6_addr)                                        \
-      && __builtin_expect (memcmp (&in6addr_any, addr,                       \
+      && __builtin_expect (memcmp (&__in6addr_any, addr,                     \
                                   sizeof (struct in6_addr)), 1) == 0)        \
     {                                                                        \
       *h_errnop = HOST_NOT_FOUND;                                            \
index 782af6443f822444dbf4406b1763ac2b3f930f4b..fb7729001d6635b07fa8b25b6a4f3b1412634111 100644 (file)
 
 #include <netinet/in.h>
 
-const struct in6_addr in6addr_any =
+const struct in6_addr __in6addr_any =
 { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } };
-libc_hidden_data_def (in6addr_any)
-const struct in6_addr in6addr_loopback =
+libc_hidden_data_def (__in6addr_any)
+weak_alias (__in6addr_any, in6addr_any)
+libc_hidden_data_weak (in6addr_any)
+const struct in6_addr __in6addr_loopback =
 { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } };
-libc_hidden_data_def (in6addr_loopback)
+libc_hidden_data_def (__in6addr_loopback)
+weak_alias (__in6addr_loopback, in6addr_loopback)
+libc_hidden_data_weak (in6addr_loopback)