From 88f15389b533468857f01490368376b539a598b3 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Tue, 27 Dec 2022 23:07:57 +0100 Subject: [PATCH] Support -D_FORTIFY_SOURCE=3 --- NEWS | 2 ++ bin/blhc | 3 ++- t/logs/good | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index fba56fe..c2ef2bf 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,8 @@ Version 0.XX - Update moc handling for Qt6; reported by Ben Westover, patch from Ross Vandegrift (Debian bug #1019521). +- Support -D_FORTIFY_SOURCE=3 added in glibc 2.35; reported by Christian + Göttsche (Debian bug #1027084). Version 0.13 diff --git a/bin/blhc b/bin/blhc index f8399d7..ba27c55 100755 --- a/bin/blhc +++ b/bin/blhc @@ -243,7 +243,7 @@ my @def_cxxflags = ( # @def_cxxflags_* is the same as @def_cflags_*. my @def_cppflags = (); my @def_cppflags_fortify = ( - '-D_FORTIFY_SOURCE=2', # must be first, see cppflags_fortify_broken() + '-D_FORTIFY_SOURCE=[23]', # must be first, see cppflags_fortify_broken() # If you add another flag fix hack below (search for "Hack to fix") and # $def_cppflags_fortify[0]. ); @@ -299,6 +299,7 @@ my %flag_renames = ( '-O(?:2|3)' => '-O2', '-Wformat(?:=2)?' => '-Wformat', '--param[= ]ssp-buffer-size=4' => '--param=ssp-buffer-size=4', + '-D_FORTIFY_SOURCE=[23]' => '-D_FORTIFY_SOURCE=2', '-Wl,(?:-z,)?relro' => '-Wl,-z,relro', '-Wl,(?:-z,)?now' => '-Wl,-z,now', ); diff --git a/t/logs/good b/t/logs/good index d4d3e7d..9fe2a62 100644 --- a/t/logs/good +++ b/t/logs/good @@ -10,6 +10,7 @@ gcc -g -O2 -fstack-protector-strong -Wformat -Wformat-security -Werror=format-se gcc -g -O2 -fstack-protector-strong -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-b.c gcc -g -O2 -fstack-protector-strong -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-c.c gcc -g -O3 -fstack-protector-strong -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-d.c +gcc -g -O3 -fstack-protector-strong -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=3 -c test-e.c gcc -Wl,-z,relro -o test test-a.o test-b.o test-c.o -ltest # -Wformat-security is implied by -Werror=format-security and no longer used -- 2.43.2