glibc40/glibc-2.29-strict-aliasing.patch
2023-10-05 10:41:09 +03:00

331 lines
12 KiB
Diff

diff --git a/csu/Makefile b/csu/Makefile
index fcd277e6..8c4ed5e4 100644
--- a/csu/Makefile
+++ b/csu/Makefile
@@ -121,7 +121,7 @@ endif
asm-CPPFLAGS += -I$(objpfx).
# Enable unwinding so backtrace unwinds to __libc_start_main
-CFLAGS-libc-start.c += -funwind-tables
+CFLAGS-libc-start.c += -funwind-tables -fno-strict-aliasing
include ../Rules
diff --git a/debug/Makefile b/debug/Makefile
index 52f9a785..f6f9f7f7 100644
--- a/debug/Makefile
+++ b/debug/Makefile
@@ -99,6 +99,7 @@ CFLAGS-pread_chk.c += -fexceptions -fasynchronous-unwind-tables
CFLAGS-pread64_chk.c += -fexceptions -fasynchronous-unwind-tables
CFLAGS-recv_chk.c += -fexceptions -fasynchronous-unwind-tables
CFLAGS-recvfrom_chk.c += -fexceptions -fasynchronous-unwind-tables
+CFLAGS-longjmp_chk.c += -fno-strict-aliasing
# Need to make sure the settings here override what configure might have
# set up for us, so keep the CFLAGS/CPPFLAGS split logical as the order is:
diff --git a/inet/Makefile b/inet/Makefile
index f5249ab2..f4055d70 100644
--- a/inet/Makefile
+++ b/inet/Makefile
@@ -113,6 +113,20 @@ CFLAGS-ifaddrs.c += $(config-cflags-wno-ignored-attributes)
CFLAGS-tst-checks-posix.c += -std=c99
CFLAGS-tst-sockaddr.c += -fno-strict-aliasing
+CFLAGS-gethstbyad_r.c += -fno-strict-aliasing
+CFLAGS-gethstbynm.c += -fno-strict-aliasing
+CFLAGS-gethstbynm2.c += -fno-strict-aliasing
+CFLAGS-gethstbynm2_r.c += -fno-strict-aliasing
+CFLAGS-gethstbynm_r.c += -fno-strict-aliasing
+CFLAGS-getnetbyad_r.c += -fno-strict-aliasing
+CFLAGS-getnetbynm_r.c += -fno-strict-aliasing
+CFLAGS-rcmd.c += -fno-strict-aliasing
+CFLAGS-rexec.c += -fno-strict-aliasing
+CFLAGS-ifaddrs.c += -fno-strict-aliasing
+CFLAGS-check_pf.c += -fno-strict-aliasing
+CFLAGS-check_native.c += -fno-strict-aliasing
+CFLAGS-netlink_assert_response.c += -fno-strict-aliasing
+
endif
# Install the rpc database file.
diff --git a/libio/Makefile b/libio/Makefile
index 52892a28..760e80a0 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -162,6 +162,18 @@ CFLAGS-putc_u.c += $(config-cflags-wno-ignored-attributes)
CFLAGS-iofgets_u.c += $(config-cflags-wno-ignored-attributes)
CFLAGS-iofputs_u.c += $(config-cflags-wno-ignored-attributes)
# XXX Do we need filedoalloc and wfiledoalloc? Others?
+CFLAGS-iofopncook.c += -fno-strict-aliasing
+CFLAGS-iopopen.c += -fno-strict-aliasing
+CFLAGS-vswprintf.c += -fno-strict-aliasing
+CFLAGS-wmemstream.c += -fno-strict-aliasing
+CFLAGS-memstream.c += -fno-strict-aliasing
+CFLAGS-obprintf.c += -fno-strict-aliasing
+CFLAGS-stdfiles.c += -fno-strict-aliasing
+CFLAGS-stdio.c += -fno-strict-aliasing
+CFLAGS-oldiofopen.c += -fno-strict-aliasing
+CFLAGS-oldiofdopen.c += -fno-strict-aliasing
+CFLAGS-oldiopopen.c += -fno-strict-aliasing
+CFLAGS-oldstdfiles.c += -fno-strict-aliasing
CFLAGS-tst_putwc.c += -DOBJPFX=\"$(objpfx)\"
diff --git a/libio/libioP.h b/libio/libioP.h
index a5f00822..e9bb971e 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -842,8 +842,8 @@ extern struct _IO_FILE_plus _IO_stderr_;
static inline bool
_IO_legacy_file (FILE *fp)
{
- return fp == (FILE *) &_IO_stdin_ || fp == (FILE *) &_IO_stdout_
- || fp == (FILE *) &_IO_stderr_;
+ return (void*)fp == &_IO_stdin_ || (void*)fp == &_IO_stdout_
+ || (void*)fp == &_IO_stderr_;
}
#endif
@@ -853,8 +853,8 @@ static inline void
_IO_deallocate_file (FILE *fp)
{
/* The current stream variables. */
- if (fp == (FILE *) &_IO_2_1_stdin_ || fp == (FILE *) &_IO_2_1_stdout_
- || fp == (FILE *) &_IO_2_1_stderr_)
+ if ((void*)fp == &_IO_2_1_stdin_ || (void*)fp == &_IO_2_1_stdout_
+ || (void*)fp == &_IO_2_1_stderr_)
return;
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
if (_IO_legacy_file (fp))
diff --git a/locale/Makefile b/locale/Makefile
index d7036b08..17ba6bff 100644
--- a/locale/Makefile
+++ b/locale/Makefile
@@ -106,6 +106,7 @@ CPPFLAGS-locale-programs = -DLOCALE_PATH='$(localepath)' \
CFLAGS-charmap.c += -Wno-write-strings -Wno-char-subscripts
CFLAGS-locfile.c += -Wno-write-strings -Wno-char-subscripts
CFLAGS-charmap-dir.c += -Wno-write-strings
+CFLAGS-C-ctype.c += -fno-strict-aliasing
# Set libof-* for each routine.
cpp-srcs-left := $(localedef-modules) $(localedef-aux) $(locale-modules) \
diff --git a/misc/Makefile b/misc/Makefile
index 1a09f777..d811012b 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -158,6 +158,8 @@ CFLAGS-mmap.op = $(no-stack-protector)
CFLAGS-mmap64.o = $(no-stack-protector)
CFLAGS-mmap64.op = $(no-stack-protector)
+CFLAGS-tsearch.c += -fno-strict-aliasing
+
include ../Rules
$(objpfx)libg.a: $(dep-dummy-lib); $(make-dummy-lib)
diff --git a/nis/Makefile b/nis/Makefile
index 6caccbe3..976cad3f 100644
--- a/nis/Makefile
+++ b/nis/Makefile
@@ -52,6 +52,7 @@ endif # have-GLIBC_2.28
include ../Rules
+CFLAGS-nis_callback.c += -fno-strict-aliasing
libnsl-libc = $(common-objpfx)linkobj/libc.so
# Target-specific variable setting to link objects using deprecated
diff --git a/nptl/Makefile b/nptl/Makefile
index 6d1ae452..96d23161 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -262,6 +262,22 @@ CFLAGS-sem_clockwait.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-futex-internal.c += -fexceptions -fasynchronous-unwind-tables
+CFLAGS-pthread_create.c += -fno-strict-aliasing
+CFLAGS-sem_clockwait.c += -fno-strict-aliasing
+CFLAGS-sem_wait.c += -fno-strict-aliasing
+CFLAGS-sem_waitcommon.c += -fno-strict-aliasing
+CFLAGS-sem_timedwait.c += -fno-strict-aliasing
+CFLAGS-sem_post.c += -fno-strict-aliasing
+CFLAGS-unwind.c += -fno-strict-aliasing
+CFLAGS-pthread_attr_copy.c += -fno-strict-aliasing
+CFLAGS-pthread_cond_common.c += -fno-strict-aliasing
+CFLAGS-pthread_cond_destroy.c += -fno-strict-aliasing
+CFLAGS-pthread_cond_wait.c += -fno-strict-aliasing
+CFLAGS-pthread_cond_signal.c += -fno-strict-aliasing
+CFLAGS-pthread_cond_broadcast.c += -fno-strict-aliasing
+CFLAGS-pthread_setattr_default_np.c += -fno-strict-aliasing
+CFLAGS-pthread_getattr_default_np.c += -fno-strict-aliasing
+
LDLIBS-tst-once5 = -lstdc++
CFLAGS-tst-thread_local1.o = -std=gnu++11
LDLIBS-tst-thread_local1 = -lstdc++
diff --git a/nscd/Makefile b/nscd/Makefile
index c2e70d33..fd2d235c 100644
--- a/nscd/Makefile
+++ b/nscd/Makefile
@@ -79,6 +79,14 @@ CFLAGS-nscd_gethst_r.c += -fexceptions
CFLAGS-nscd_getai.c += -fexceptions
CFLAGS-nscd_initgroups.c += -fexceptions
+CFLAGS-nscd_helper.c += -fno-strict-aliasing
+CFLAGS-nscd.c += -fno-strict-aliasing
+CFLAGS-connections.c += -fno-strict-aliasing
+CFLAGS-gethstbyad_r.c += -fno-strict-aliasing
+CFLAGS-gethstbynm3_r.c += -fno-strict-aliasing
+CFLAGS-aicache.c += -fno-strict-aliasing
+CFLAGS-gai.c += -fno-strict-aliasing
+
CPPFLAGS-nscd += -D_FORTIFY_SOURCE=2
ifeq (yesyes,$(have-fpie)$(build-shared))
diff --git a/nss/Makefile b/nss/Makefile
index 6ef5bf23..c4d0bda8 100644
--- a/nss/Makefile
+++ b/nss/Makefile
@@ -236,6 +236,9 @@ $(objpfx)mtrace-tst-nss-gai-hv2-canonname.out: \
$(objpfx)tst-nss-gai-hv2-canonname.mtrace; } > $@; \
$(evaluate-test)
+CFLAGS-getnssent_r.c += -fno-strict-aliasing
+CFLAGS-digits_dots.c += -fno-strict-aliasing
+
# Disable DT_RUNPATH on NSS tests so that the glibc internal NSS
# functions can load testing NSS modules via DT_RPATH.
LDFLAGS-tst-nss-test1 = -Wl,--disable-new-dtags
diff --git a/posix/Makefile b/posix/Makefile
index 38a42795..b671f618 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -280,6 +280,12 @@ CFLAGS-execvp.os = -fomit-frame-pointer
CFLAGS-execlp.os = -fomit-frame-pointer
CFLAGS-nanosleep.c += -fexceptions -fasynchronous-unwind-tables
CFLAGS-fork.c = $(libio-mtsafe) $(config-cflags-wno-ignored-attributes)
+CFLAGS-glob.c += -fno-strict-aliasing
+CFLAGS-glob-lstat-compat.c += -fno-strict-aliasing
+CFLAGS-glob64.c += -fno-strict-aliasing
+CFLAGS-glob64-lstat-compat.c += -fno-strict-aliasing
+CFLAGS-oldglob.c += -fno-strict-aliasing
+CFLAGS-getaddrinfo.c += -fno-strict-aliasing
tstgetopt-ARGS = -a -b -cfoobar --required foobar --optional=bazbug \
--none random --col --color --colour
diff --git a/resolv/Makefile b/resolv/Makefile
index 60f5d468..a659ba2d 100644
--- a/resolv/Makefile
+++ b/resolv/Makefile
@@ -236,6 +236,18 @@ include ../gen-locales.mk
CFLAGS-res_hconf.c += -fexceptions
CFLAGS-inet_pton.c += $(config-cflags-wno-ignored-attributes)
+CFLAGS-gethstbyad_r.c += -fno-strict-aliasing
+CFLAGS-res-close.c += -fno-strict-aliasing
+CFLAGS-resolv_context.c += -fno-strict-aliasing
+CFLAGS-resolv_conf.c += -fno-strict-aliasing
+CFLAGS-res_mkquery.c += -fno-strict-aliasing
+CFLAGS-res_query.c += -fno-strict-aliasing
+CFLAGS-res_send.c += -fno-strict-aliasing
+CFLAGS-compat-hnamaddr.c += -fno-strict-aliasing
+CFLAGS-compat-gethnamaddr.c += -fno-strict-aliasing
+CFLAGS-dns-host.c += -fno-strict-aliasing
+CFLAGS-dns-network.c += -fno-strict-aliasing
+CFLAGS-dns-canon.c += -fno-strict-aliasing
# The DNS NSS modules needs the resolver.
$(objpfx)libnss_dns.so: $(objpfx)libresolv.so
diff --git a/rt/Makefile b/rt/Makefile
index a97333dc..900c560f 100644
--- a/rt/Makefile
+++ b/rt/Makefile
@@ -100,6 +100,8 @@ CFLAGS-aio_suspend.c += -fexceptions
CFLAGS-mq_timedreceive.c += -fexceptions -fasynchronous-unwind-tables
CFLAGS-mq_timedsend.c += -fexceptions -fasynchronous-unwind-tables
+CFLAGS-timer_create.c += -fno-strict-aliasing
+
LDFLAGS-rt.so = -Wl,--enable-new-dtags,-z,nodelete
$(objpfx)librt.so: $(shared-thread-library)
diff --git a/setjmp/Makefile b/setjmp/Makefile
index e5733a8c..6b994c86 100644
--- a/setjmp/Makefile
+++ b/setjmp/Makefile
@@ -36,6 +36,10 @@ tests-internal := \
gen-as-const-headers += jmp_buf-macros.sym
+CFLAGS-sigjmp.c += -fno-strict-aliasing
+CFLAGS-longjmp.c += -fno-strict-aliasing
+CFLAGS-longjmp_chk.c += -fno-strict-aliasing
+
include ../Rules
$(objpfx)tst-setjmp-fp: $(libm)
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index fdc49f32..2ba834c0 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -392,6 +392,10 @@ $(objpfx)tst-errno-manual.out: tst-errno-manual.py \
CFLAGS-vfprintf.c += -Wno-uninitialized
CFLAGS-vfwprintf.c += -Wno-uninitialized
+CFLAGS-vfscanf-internal.c += -fno-strict-aliasing
+CFLAGS-vfwscanf-internal.c += -fno-strict-aliasing
+CFLAGS-vfprintf-internal.c += -fno-strict-aliasing
+CFLAGS-vfwprintf-internal.c += -fno-strict-aliasing
CFLAGS-tmpfile.c += -fexceptions
CFLAGS-tmpfile64.c += -fexceptions
diff --git a/sunrpc/Makefile b/sunrpc/Makefile
index ec2ea04c..54169763 100644
--- a/sunrpc/Makefile
+++ b/sunrpc/Makefile
@@ -97,6 +97,21 @@ CFLAGS-pmap_rmt.c += -fexceptions
CFLAGS-clnt_perr.c += -fexceptions
CFLAGS-openchild.c += -fexceptions
+CFLAGS-authuxprot.c += -fno-strict-aliasing
+CFLAGS-pmap_rmt.c += -fno-strict-aliasing
+CFLAGS-rpc_prot.c += -fno-strict-aliasing
+CFLAGS-rpc_cmsg.c += -fno-strict-aliasing
+CFLAGS-authdes_prot.c += -fno-strict-aliasing
+CFLAGS-rtime.c += -fno-strict-aliasing
+CFLAGS-svcauth_des.c += -fno-strict-aliasing
+CFLAGS-svc_unix.c += -fno-strict-aliasing
+CFLAGS-auth_des.c += -fno-strict-aliasing
+CFLAGS-clnt_udp.c += -fno-strict-aliasing
+CFLAGS-key_call.c += -fno-strict-aliasing
+CFLAGS-pm_getport.c += -fno-strict-aliasing
+CFLAGS-svc_tcp.c += -fno-strict-aliasing
+CFLAGS-svc_udp.c += -fno-strict-aliasing
+
$(objpfx)tst-getmyaddr: $(common-objpfx)linkobj/libc.so
$(objpfx)tst-xdrmem: $(common-objpfx)linkobj/libc.so
$(objpfx)tst-xdrmem2: $(common-objpfx)linkobj/libc.so
diff --git a/support/Makefile b/support/Makefile
index 48cd7458..21e67357 100644
--- a/support/Makefile
+++ b/support/Makefile
@@ -220,6 +220,8 @@ ifeq ($(build-shared),yes)
libsupport-inhibit-o += .o
endif
+CFLAGS-resolv_test.c = -fno-strict-aliasing
+
CFLAGS-support_paths.c = \
-DSRCDIR_PATH=\"`cd .. ; pwd`\" \
-DOBJDIR_PATH=\"`cd $(objpfx)/..; pwd`\" \
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h b/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h
index 3dd00e02..90bfb0db 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h
@@ -17,6 +17,8 @@
#include <ldsodefs.h>
+#pragma GCC diagnostic ignored "-Wstrict-aliasing"
+
/* The code checks if _rtld_global_ro was realocated before trying to access
the dl_hwcap field. The assembly is to make the compiler not optimize the
test (&_rtld_global_ro != NULL), which is always true in ISO C (but not