From 78910c724501df80cb96d6b5e8d9276f50548a26 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Wed, 6 Oct 2021 11:01:07 +0100 Subject: [PATCH] plugins: Add more required build options --- annobin-global.h | 2 +- annocheck/hardened.c | 25 ++++++++++++++++++++++++- clang-plugin/Makefile.in | 7 ++++++- llvm-plugin/Makefile.in | 9 ++++++++- 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/annobin-global.h b/annobin-global.h index 0fbb192..3cc5648 100644 --- a/annobin-global.h +++ b/annobin-global.h @@ -19,7 +19,7 @@ extern "C" { /* The version of the package. NB/ This number is expected to be in the form "NNnn" where "NN" is major version number and "nn" is the minor version number. */ -#define ANNOBIN_VERSION 1010 +#define ANNOBIN_VERSION 1011 /* The version of the annotation specification supported. */ #define SPEC_VERSION 3 diff --git a/annocheck/hardened.c b/annocheck/hardened.c index c967680..24f710b 100644 --- a/annocheck/hardened.c +++ b/annocheck/hardened.c @@ -1037,6 +1037,24 @@ parse_dw_at_producer (annocheck_data * data, Dwarf_Attribute * attr) else info (data, TEST_WARNINGS, SOURCE_DW_AT_PRODUCER, "not found in string"); + if (skip_test (TEST_GLIBCXX_ASSERTIONS)) + ; + else if (strstr (string, "-D_GLIBCXX_ASSERTIONS") + || strstr (string, "-D _GLIBCXX_ASSERTIONS")) + pass (data, TEST_GLIBCXX_ASSERTIONS, SOURCE_DW_AT_PRODUCER, NULL); + else + info (data, TEST_GLIBCXX_ASSERTIONS, SOURCE_DW_AT_PRODUCER, "not found in string"); + + if (skip_test (TEST_FORTIFY)) + ; + else if (strstr (string, "-D_FORTIFY_SOURCE=2") + || strstr (string, "-D _FORTIFY_SOURCE=2") + || strstr (string, "-D_FORTIFY_SOURCE=3") + || strstr (string, "-D _FORTIFY_SOURCE=3")) + pass (data, TEST_FORTIFY, SOURCE_DW_AT_PRODUCER, NULL); + else + info (data, TEST_FORTIFY, SOURCE_DW_AT_PRODUCER, "not found in string"); + if (is_x86 ()) { if (skip_test (TEST_CF_PROTECTION)) @@ -4027,6 +4045,7 @@ check_for_gaps (annocheck_data * data) { einfo (VERBOSE2, "gap ignored - special symbol: %s", sym2); /* See comment above. */ + free ((char *) first_sym); continue; } @@ -4052,6 +4071,7 @@ check_for_gaps (annocheck_data * data) { einfo (VERBOSE2, "gap ignored - special symbol: %s", sym2); /* See comment above. */ + free ((char *) first_sym); continue; } @@ -4062,7 +4082,10 @@ check_for_gaps (annocheck_data * data) gap_found = true; if (! BE_VERBOSE) - break; + { + free ((char *) first_sym); + break; + } if (first_sym) { diff --git a/clang-plugin/Makefile.in b/clang-plugin/Makefile.in index 77eee69..4973337 100644 --- a/clang-plugin/Makefile.in +++ b/clang-plugin/Makefile.in @@ -8,9 +8,14 @@ LLVM_OPTIONS = \ -D__STDC_LIMIT_MACROS PLUGIN_OPTIONS = \ + -D_FORTIFY_SOURCE=2 \ + -D_GLIBCXX_ASSERTIONS \ -shared \ -fPIC \ - -g \ + -Wall \ + -O2 \ + -flto \ + -g -grecord-gcc-switches \ -Wl,-z,now INCDIR = @srcdir@/.. diff --git a/llvm-plugin/Makefile.in b/llvm-plugin/Makefile.in index c9544b9..3fe6ede 100644 --- a/llvm-plugin/Makefile.in +++ b/llvm-plugin/Makefile.in @@ -8,9 +8,14 @@ LLVM_OPTIONS = \ -D__STDC_LIMIT_MACROS PLUGIN_OPTIONS = \ + -D_FORTIFY_SOURCE=2 \ + -D_GLIBCXX_ASSERTIONS \ -shared \ -fPIC \ - -g \ + -Wall \ + -O2 \ + -flto \ + -g -grecord-gcc-switches \ -Wl,-z,now INCDIR = @srcdir@/.. @@ -42,9 +47,11 @@ PLUGIN = @abs_builddir@/$(PLUGIN_NAME) PLUGIN_TEST_OPTIONS = \ -D_FORTIFY_SOURCE=2 \ + -D_GLIBCXX_ASSERTIONS \ -O2 \ -g -grecord-gcc-switches \ -fPIE \ + -Wall \ -fstack-protector-strong \ -fsanitize=safe-stack -- 2.43.5