Revert "Resolves: #1306511"

This reverts commit 49a15d1f64.
This commit is contained in:
Florian Weimer 2016-02-15 12:12:34 +01:00
parent 49a15d1f64
commit 432964b3d9
2 changed files with 4 additions and 70 deletions

View File

@ -1,67 +0,0 @@
commit 520dcf39f7b78a3b1db93c9be6a1c120eda699cd
Author: Florian Weimer <fweimer@redhat.com>
Date: Fri Feb 12 17:04:34 2016 +0100
bits/socket.h: Define struct sockaddr with may_alias attribute [BZ #19622]
As suggested by Marek Polacek.
Using struct sockaddr with aliasing violations is quite common, and the
POSIX interfaces more or less encourage it.
diff --git a/bits/socket.h b/bits/socket.h
index ab9f242..666842b 100644
--- a/bits/socket.h
+++ b/bits/socket.h
@@ -144,7 +144,7 @@ enum __socket_type
#include <bits/sockaddr.h>
/* Structure describing a generic socket address. */
-struct sockaddr
+struct __attribute_may_alias__ sockaddr
{
__SOCKADDR_COMMON (sa_); /* Common data: address family and length. */
char sa_data[14]; /* Address data. */
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 7fd4154..aee6ae3 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -407,6 +407,12 @@
[!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })]
#endif
+#if __GNUC_PREREQ (4,0)
+# define __attribute_may_alias__ __attribute__ ((__may_alias__))
+#else
+# define __attribute_may_alias__
+#endif
+
#include <bits/wordsize.h>
#if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
diff --git a/sysdeps/mach/hurd/bits/socket.h b/sysdeps/mach/hurd/bits/socket.h
index 02c5dac..bc26a28 100644
--- a/sysdeps/mach/hurd/bits/socket.h
+++ b/sysdeps/mach/hurd/bits/socket.h
@@ -148,7 +148,7 @@ enum __socket_type
#include <bits/sockaddr.h>
/* Structure describing a generic socket address. */
-struct sockaddr
+struct __attribute_may_alias__ sockaddr
{
__SOCKADDR_COMMON (sa_); /* Common data: address family and length. */
char sa_data[14]; /* Address data. */
diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h
index 0581c79..a1fc921 100644
--- a/sysdeps/unix/sysv/linux/bits/socket.h
+++ b/sysdeps/unix/sysv/linux/bits/socket.h
@@ -150,7 +150,7 @@ typedef __socklen_t socklen_t;
#include <bits/sockaddr.h>
/* Structure describing a generic socket address. */
-struct sockaddr
+struct __attribute_may_alias__ sockaddr
{
__SOCKADDR_COMMON (sa_); /* Common data: address family and length. */
char sa_data[14]; /* Address data. */

View File

@ -1,6 +1,6 @@
%define glibcsrcdir glibc-2.22-719-g1233be7
%define glibcversion 2.22.90
%define glibcrelease 34%{?dist}
%define glibcrelease 35%{?dist}
# Pre-release tarballs are pulled in from git using a command that is
# effectively:
#
@ -294,7 +294,6 @@ Patch2035: glibc-nsswitch-Add-group-merging-support.patch
Patch2036: glibc-gcc-PR69537.patch
Patch2037: glibc-isinf-cxx11.patch
Patch2038: glibc-rh1306511.patch
##############################################################################
#
@ -690,7 +689,6 @@ cat /proc/meminfo
%patch2035 -p1
%patch2036 -p1
%patch2037 -p1
%patch2038 -p1
##############################################################################
# %%prep - Additional prep required...
@ -1957,6 +1955,9 @@ rm -f *.filelist*
%endif
%changelog
* Mon Feb 15 2016 Florian Weimer <fweimer@redhat.com> - 2.22.90-35
- Revert may_alias attribute for struct sockaddr (#1306511).
* Sat Feb 13 2016 Florian Weimer <fweimer@redhat.com> - 2.22.90-34
- Auto-sync with upstream master.
- Support aliasing with struct sockaddr pointers (#1306511).