-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
glibc-2.29-strict-aliasing.patch
313 lines (282 loc) · 13.5 KB
/
glibc-2.29-strict-aliasing.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
diff -up glibc-2.39/csu/Makefile.34~ glibc-2.39/csu/Makefile
--- glibc-2.39/csu/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
+++ glibc-2.39/csu/Makefile 2024-01-31 23:44:39.572509209 +0100
@@ -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 -up glibc-2.39/debug/Makefile.34~ glibc-2.39/debug/Makefile
--- glibc-2.39/debug/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
+++ glibc-2.39/debug/Makefile 2024-01-31 23:44:39.572509209 +0100
@@ -166,6 +166,7 @@ CFLAGS-pread_chk.c += -fexceptions -fasy
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 -up glibc-2.39/inet/Makefile.34~ glibc-2.39/inet/Makefile
--- glibc-2.39/inet/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
+++ glibc-2.39/inet/Makefile 2024-01-31 23:44:39.572509209 +0100
@@ -128,6 +128,20 @@ CFLAGS-ifaddrs.c += $(config-cflags-wno-
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 -up glibc-2.39/libio/Makefile.34~ glibc-2.39/libio/Makefile
--- glibc-2.39/libio/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
+++ glibc-2.39/libio/Makefile 2024-01-31 23:44:39.572509209 +0100
@@ -179,6 +179,18 @@ CFLAGS-putc_u.c += $(config-cflags-wno-i
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
# Prevent fortification as these are built with -O0
CFLAGS-tst-bz24051.c += $(no-fortify-source)
diff -up glibc-2.39/libio/libioP.h.34~ glibc-2.39/libio/libioP.h
--- glibc-2.39/libio/libioP.h.34~ 2024-01-31 01:34:58.000000000 +0100
+++ glibc-2.39/libio/libioP.h 2024-01-31 23:44:39.572509209 +0100
@@ -937,8 +937,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
@@ -948,8 +948,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 -up glibc-2.39/locale/Makefile.34~ glibc-2.39/locale/Makefile
--- glibc-2.39/locale/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
+++ glibc-2.39/locale/Makefile 2024-01-31 23:44:39.572509209 +0100
@@ -172,6 +172,7 @@ CPPFLAGS-locale-programs = -DLOCALE_PATH
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 -up glibc-2.39/misc/Makefile.34~ glibc-2.39/misc/Makefile
--- glibc-2.39/misc/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
+++ glibc-2.39/misc/Makefile 2024-01-31 23:44:39.572509209 +0100
@@ -335,6 +335,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 -up glibc-2.39/nis/Makefile.34~ glibc-2.39/nis/Makefile
--- glibc-2.39/nis/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
+++ glibc-2.39/nis/Makefile 2024-01-31 23:44:39.572509209 +0100
@@ -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 -up glibc-2.39/nptl/Makefile.34~ glibc-2.39/nptl/Makefile
--- glibc-2.39/nptl/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
+++ glibc-2.39/nptl/Makefile 2024-01-31 23:44:39.572509209 +0100
@@ -263,6 +263,22 @@ CFLAGS-sem_clockwait.c = -fexceptions -f
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 -up glibc-2.39/nscd/Makefile.34~ glibc-2.39/nscd/Makefile
--- glibc-2.39/nscd/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
+++ glibc-2.39/nscd/Makefile 2024-01-31 23:44:39.572509209 +0100
@@ -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
+
ifeq (yesyes,$(have-fpie)$(build-shared))
CFLAGS-nscd += $(pie-ccflag)
endif
diff -up glibc-2.39/nss/Makefile.34~ glibc-2.39/nss/Makefile
--- glibc-2.39/nss/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
+++ glibc-2.39/nss/Makefile 2024-01-31 23:44:39.572509209 +0100
@@ -520,6 +520,9 @@ $(objpfx)mtrace-tst-nss-gai-hv2-canonnam
$(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 -up glibc-2.39/posix/Makefile.34~ glibc-2.39/posix/Makefile
--- glibc-2.39/posix/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
+++ glibc-2.39/posix/Makefile 2024-01-31 23:44:39.572509209 +0100
@@ -581,6 +581,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 -up glibc-2.39/resolv/Makefile.34~ glibc-2.39/resolv/Makefile
--- glibc-2.39/resolv/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
+++ glibc-2.39/resolv/Makefile 2024-01-31 23:44:39.576509248 +0100
@@ -237,6 +237,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 -up glibc-2.39/rt/Makefile.34~ glibc-2.39/rt/Makefile
--- glibc-2.39/rt/Makefile.34~ 2024-01-31 23:44:39.540508898 +0100
+++ glibc-2.39/rt/Makefile 2024-01-31 23:44:39.576509248 +0100
@@ -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
+
# Exclude fortified routines from being built with _FORTIFY_SOURCE
routines_no_fortify += \
mq_open \
diff -up glibc-2.39/setjmp/Makefile.34~ glibc-2.39/setjmp/Makefile
--- glibc-2.39/setjmp/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
+++ glibc-2.39/setjmp/Makefile 2024-01-31 23:44:39.576509248 +0100
@@ -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
# This test messes the stack on purpose, which triggers longjump fortify
diff -up glibc-2.39/stdio-common/Makefile.34~ glibc-2.39/stdio-common/Makefile
--- glibc-2.39/stdio-common/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
+++ glibc-2.39/stdio-common/Makefile 2024-01-31 23:44:39.576509248 +0100
@@ -436,6 +436,10 @@ $(objpfx)tst-errno-manual.out: tst-errno
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 -up glibc-2.39/sunrpc/Makefile.34~ glibc-2.39/sunrpc/Makefile
--- glibc-2.39/sunrpc/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
+++ glibc-2.39/sunrpc/Makefile 2024-01-31 23:44:39.576509248 +0100
@@ -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 -up glibc-2.39/support/Makefile.34~ glibc-2.39/support/Makefile
--- glibc-2.39/support/Makefile.34~ 2024-01-31 01:34:58.000000000 +0100
+++ glibc-2.39/support/Makefile 2024-01-31 23:44:39.576509248 +0100
@@ -227,6 +227,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 -up glibc-2.39/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h.34~ glibc-2.39/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h
--- glibc-2.39/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h.34~ 2024-01-31 23:44:39.576509248 +0100
+++ glibc-2.39/sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h 2024-01-31 23:45:21.024911385 +0100
@@ -16,6 +16,9 @@
<https://www.gnu.org/licenses/>. */
#include <ldsodefs.h>
+
+#pragma GCC diagnostic ignored "-Wstrict-aliasing"
+
#include <cpu-features.h>
/* The code checks if _rtld_global_ro was realocated before trying to access