From: Simon Ruderich Date: Sat, 10 Sep 2016 16:09:43 +0000 (+0200) Subject: Fix another Ada false positive for format flags X-Git-Tag: 0.07~1 X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=42b57fd;p=blhc%2Fblhc.git Fix another Ada false positive for format flags --- diff --git a/NEWS b/NEWS index 2f964cb..26a487e 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,8 @@ Version 0.XX - Sync architecture specific hardening support with dpkg 1.18.10. - Fix false positive in "gcc > file" (Debian Bug #828789), reported by Mathieu Parent. +- Fix another Ada false positive for format flags (Debian Bug #833939), + reported by Nicolas Boulenguez. Version 0.06 diff --git a/bin/blhc b/bin/blhc index c4e814c..1e77495 100755 --- a/bin/blhc +++ b/bin/blhc @@ -89,10 +89,10 @@ my @source_no_preprocess_compile_cpp = ( qw( mii ), ); my @source_no_preprocess_compile_ada = ( + # Ada source + qw( ada ), # Ada body qw( adb ), - # If you add another file, fix use of @source_no_preprocess_compile_ada - # below (search for $compile_ada). ); my @source_no_preprocess_compile = ( # C @@ -106,11 +106,15 @@ my @source_no_preprocess_compile = ( # Ada @source_no_preprocess_compile_ada, ); +my @source_no_preprocess_no_compile_ada = ( + # Ada specification + qw( ads ), +); my @source_no_preprocess_no_compile = ( # Assembly qw( s ), - # Ada specification - qw( ads ), + # Ada + @source_no_preprocess_no_compile_ada, ); my @source_no_preprocess = ( @source_no_preprocess_compile, @@ -161,6 +165,10 @@ my %extensions_compile_cpp = map { $_ => 1 } ( @source_preprocess_compile_cpp, @source_no_preprocess_compile_cpp, ); +my %extensions_ada = map { $_ => 1 } ( + @source_no_preprocess_compile_ada, + @source_no_preprocess_no_compile_ada, +); my %extensions_object = map { $_ => 1 } ( @object, ); @@ -1230,10 +1238,9 @@ LINE: $compile_cpp = 1; # Ada needs special CFLAGS, use them if only ada files are compiled. } elsif ($ada - and $compile - and array_equal(\@extensions, - \@source_no_preprocess_compile_ada)) { + and extension_found(\%extensions_ada, @extensions)) { $compile_ada = 1; + $preprocess = 0; # Ada uses no CPPFLAGS @cflags_backup = @cflags; @cflags = @cflags_ada; } diff --git a/t/logs/ada b/t/logs/ada index c6f45fb..8e6c596 100644 --- a/t/logs/ada +++ b/t/logs/ada @@ -14,3 +14,9 @@ gcc-4.6 -c -fPIC -g -O2 -fstack-protector-strong -gnatn -gnatw.eH test-d.ads gcc -c -g -O2 test.c gcc -g -O2 test.c + +gcc-6 -c -I./ -I../progs -g -O2 -fPIE -fstack-protector-strong -gnat2005 -gnato -gnatVa -fstack-check -gnatw.I -I- -o /«PKGBUILDDIR»/build/objects/arm_frm.o /«PKGBUILDDIR»/progs/arm_frm.adb +gcc-6 -c -I./ -I../progs -g -O2 -fPIE -fstack-protector-strong -gnat2005 -gnato -gnatVa -fstack-check -I- -x ada -o /«PKGBUILDDIR»/build/objects/arm_form.o /«PKGBUILDDIR»/progs/arm_form.ada + +gcc-6 -c -I./ -I../progs -g -O2 -fPIE -gnat2005 -gnato -gnatVa -fstack-check -gnatw.I -I- -o /«PKGBUILDDIR»/build/objects/arm_frm.o /«PKGBUILDDIR»/progs/arm_frm.adb +gcc-6 -c -I./ -I../progs -g -O2 -fPIE -gnat2005 -gnato -gnatVa -fstack-check -I- -x ada -o /«PKGBUILDDIR»/build/objects/arm_form.o /«PKGBUILDDIR»/progs/arm_form.ada diff --git a/t/logs/ada-pbuilder b/t/logs/ada-pbuilder index a6f4d3b..9c75d30 100644 --- a/t/logs/ada-pbuilder +++ b/t/logs/ada-pbuilder @@ -15,3 +15,9 @@ gcc-4.6 -c -fPIC -g -O2 -fstack-protector-strong -gnatn -gnatw.eH test-d.ads gcc -c -g -O2 test.c gcc -g -O2 test.c + +gcc-6 -c -I./ -I../progs -g -O2 -fPIE -fstack-protector-strong -gnat2005 -gnato -gnatVa -fstack-check -gnatw.I -I- -o /«PKGBUILDDIR»/build/objects/arm_frm.o /«PKGBUILDDIR»/progs/arm_frm.adb +gcc-6 -c -I./ -I../progs -g -O2 -fPIE -fstack-protector-strong -gnat2005 -gnato -gnatVa -fstack-check -I- -x ada -o /«PKGBUILDDIR»/build/objects/arm_form.o /«PKGBUILDDIR»/progs/arm_form.ada + +gcc-6 -c -I./ -I../progs -g -O2 -fPIE -gnat2005 -gnato -gnatVa -fstack-check -gnatw.I -I- -o /«PKGBUILDDIR»/build/objects/arm_frm.o /«PKGBUILDDIR»/progs/arm_frm.adb +gcc-6 -c -I./ -I../progs -g -O2 -fPIE -gnat2005 -gnato -gnatVa -fstack-check -I- -x ada -o /«PKGBUILDDIR»/build/objects/arm_form.o /«PKGBUILDDIR»/progs/arm_form.ada diff --git a/t/tests.t b/t/tests.t index 8050601..bd54050 100644 --- a/t/tests.t +++ b/t/tests.t @@ -751,11 +751,13 @@ LDFLAGS missing (-fPIE -pie -Wl,-z,relro -Wl,-z,now): g++-4.6 -Wl,-z,defs -o tes my $ada = 'CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc-4.6 -c -fPIC -g -O2 -fstack-protector-strong -Wformat -Wformat-security -Werror=format-security test.c LDFLAGS missing (-Wl,-z,relro): /usr/bin/gcc-4.6 -shared -lgnat-4.6 -o libtest.so.2 test-a.o test-b.o test-c.o -Wl,--as-needed -CFLAGS missing (-fstack-protector-strong -Wformat -Werror=format-security): gcc -c -g -O2 test.c +CFLAGS missing (-fPIE -fstack-protector-strong -Wformat -Werror=format-security): gcc -c -g -O2 test.c CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -c -g -O2 test.c -CFLAGS missing (-fstack-protector-strong -Wformat -Werror=format-security): gcc -g -O2 test.c +CFLAGS missing (-fPIE -fstack-protector-strong -Wformat -Werror=format-security): gcc -g -O2 test.c CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -g -O2 test.c -LDFLAGS missing (-Wl,-z,relro): gcc -g -O2 test.c +LDFLAGS missing (-fPIE -pie -Wl,-z,relro): gcc -g -O2 test.c +CFLAGS missing (-fstack-protector-strong): gcc-6 -c -I./ -I../progs -g -O2 -fPIE -gnat2005 -gnato -gnatVa -fstack-check -gnatw.I -I- -o /«PKGBUILDDIR»/build/objects/arm_frm.o /«PKGBUILDDIR»/progs/arm_frm.adb +CFLAGS missing (-fstack-protector-strong): gcc-6 -c -I./ -I../progs -g -O2 -fPIE -gnat2005 -gnato -gnatVa -fstack-check -I- -x ada -o /«PKGBUILDDIR»/build/objects/arm_form.o /«PKGBUILDDIR»/progs/arm_form.ada '; is_blhc 'ada', '', 8, $ada;