fb633ea
From 96aefb90e843648812d1832789f4a88ea5350605 Mon Sep 17 00:00:00 2001
fb633ea
From: Andreas Schwab <schwab@redhat.com>
fb633ea
Date: Tue, 25 May 2010 15:09:20 +0200
fb633ea
Subject: [PATCH] Avoid strict-aliasing issues
fb633ea
fb633ea
---
fb633ea
 elf/Makefile                           |    1 +
fb633ea
 inet/Makefile                          |    2 ++
fb633ea
 nis/Makefile                           |    2 ++
fb633ea
 nss/Makefile                           |    1 +
fb633ea
 resolv/Makefile                        |    1 +
fb633ea
 sunrpc/Makefile                        |    4 ++++
fb633ea
 sysdeps/powerpc/powerpc64/elf/Makefile |    2 ++
fb633ea
 7 files changed, 13 insertions(+), 0 deletions(-)
a0c4aeb
diff -Nrup a/elf/Makefile b/elf/Makefile
7f32dad
--- a/elf/Makefile	2012-08-29 07:45:37.000000000 -0600
7f32dad
+++ b/elf/Makefile	2012-08-30 09:42:41.980592920 -0600
fb633ea
@@ -50,6 +50,7 @@ include ../Makeconfig
fb633ea
 ifeq ($(unwind-find-fde),yes)
fb633ea
 routines += unwind-dw2-fde-glibc
fb633ea
 shared-only-routines += unwind-dw2-fde-glibc
fb633ea
+CFLAGS-unwind-dw2-fde-glibc.c += -fno-strict-aliasing
fb633ea
 endif
fb633ea
 
fb633ea
 before-compile  = $(objpfx)trusted-dirs.h
a0c4aeb
diff -Nrup a/inet/Makefile b/inet/Makefile
7f32dad
--- a/inet/Makefile	2012-08-29 07:45:37.000000000 -0600
7f32dad
+++ b/inet/Makefile	2012-08-30 09:42:41.981592916 -0600
fb633ea
@@ -54,6 +54,8 @@ tests := htontest test_ifindex tst-ntoa
fb633ea
 
fb633ea
 include ../Rules
fb633ea
 
fb633ea
+CFLAGS-tst-inet6_rth.c += -fno-strict-aliasing
fb633ea
+
fb633ea
 ifeq ($(have-thread-library),yes)
fb633ea
 
7f32dad
 CFLAGS-gethstbyad_r.c = -fexceptions
a0c4aeb
diff -Nrup a/nis/Makefile b/nis/Makefile
7f32dad
--- a/nis/Makefile	2012-08-29 07:45:37.000000000 -0600
7f32dad
+++ b/nis/Makefile	2012-08-30 09:42:41.982592912 -0600
fb633ea
@@ -71,6 +71,8 @@ libnss_nisplus-inhibit-o = $(filter-out
fb633ea
 
fb633ea
 include ../Rules
fb633ea
 
fb633ea
+CFLAGS-nis_findserv.c += -fno-strict-aliasing
fb633ea
+CFLAGS-ypclnt.c += -fno-strict-aliasing
fb633ea
 
fb633ea
 $(objpfx)libnss_compat.so: $(objpfx)libnsl.so$(libnsl.so-version)
fb633ea
 $(objpfx)libnss_nis.so: $(objpfx)libnsl.so$(libnsl.so-version) \
a0c4aeb
diff -Nrup a/nss/Makefile b/nss/Makefile
7f32dad
--- a/nss/Makefile	2012-08-29 07:45:37.000000000 -0600
7f32dad
+++ b/nss/Makefile	2012-08-30 09:42:42.021592753 -0600
fb633ea
@@ -101,6 +101,7 @@ $(libnss_db-dbs:%=$(objpfx)%.c): $(objpf
fb633ea
 	 echo '#include "$<"') > $@.new
fb633ea
 	mv -f $@.new $@
fb633ea
 
fb633ea
+CFLAGS-files-hosts.c += -fno-strict-aliasing
fb633ea
 
fb633ea
 $(objpfx)makedb: $(makedb-modules:%=$(objpfx)%.o)
fb633ea
 
a0c4aeb
diff -Nrup a/resolv/Makefile b/resolv/Makefile
7f32dad
--- a/resolv/Makefile	2012-08-29 07:45:37.000000000 -0600
7f32dad
+++ b/resolv/Makefile	2012-08-30 09:42:42.023592745 -0600
fb633ea
@@ -80,6 +80,7 @@ ifeq (yes,$(have-ssp))
fb633ea
 CFLAGS-libresolv += -fstack-protector
fb633ea
 endif
fb633ea
 CFLAGS-res_hconf.c = -fexceptions
fb633ea
+CFLAGS-res_send.c += -fno-strict-aliasing
fb633ea
 
fb633ea
 # The BIND code elicits some harmless warnings.
fb633ea
 +cflags += -Wno-strict-prototypes -Wno-write-strings
a0c4aeb
diff -Nrup a/sunrpc/Makefile b/sunrpc/Makefile
7f32dad
--- a/sunrpc/Makefile	2012-08-29 07:45:37.000000000 -0600
7f32dad
+++ b/sunrpc/Makefile	2012-08-30 09:42:42.024592741 -0600
fb633ea
@@ -150,6 +150,10 @@ sunrpc-CPPFLAGS = -D_RPC_THREAD_SAFE_
fb633ea
 CPPFLAGS += $(sunrpc-CPPFLAGS)
fb633ea
 BUILD_CPPFLAGS += $(sunrpc-CPPFLAGS)
fb633ea
 
fb633ea
+CFLAGS-clnt_tcp.c += -fno-strict-aliasing
fb633ea
+CFLAGS-clnt_udp.c += -fno-strict-aliasing
fb633ea
+CFLAGS-clnt_unix.c += -fno-strict-aliasing
fb633ea
+
fb633ea
 $(objpfx)tst-getmyaddr: $(common-objpfx)linkobj/libc.so
fb633ea
 $(objpfx)tst-xdrmem: $(common-objpfx)linkobj/libc.so
fb633ea
 $(objpfx)tst-xdrmem2: $(common-objpfx)linkobj/libc.so
a0c4aeb
diff -Nrup a/sysdeps/powerpc/powerpc64/Makefile b/sysdeps/powerpc/powerpc64/Makefile
7f32dad
--- a/sysdeps/powerpc/powerpc64/Makefile	2012-08-30 09:42:17.872692135 -0600
7f32dad
+++ b/sysdeps/powerpc/powerpc64/Makefile	2012-08-30 09:42:42.024592741 -0600
a0c4aeb
@@ -37,6 +37,8 @@ CFLAGS-rtld-strnlen.os = $(no-special-re
a0c4aeb
 
a0c4aeb
 CFLAGS-libc-start.c += -fno-asynchronous-unwind-tables
fb633ea
 
fb633ea
+CFLAGS-gmon-start.c += -fno-strict-aliasing
fb633ea
+
fb633ea
 ifeq ($(subdir),csu)
fb633ea
 sysdep_routines += hp-timing
fb633ea
 elide-routines.os += hp-timing