Commit 6df0f285 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'gcc-plugins-v5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux

Pull gcc-plugins updates from Kees Cook:

 - Clean up gcc plugin builds now that GCC must be 4.9+ (Masahiro
   Yamada)

 - Update MAINTAINERS (Kees Cook)

* tag 'gcc-plugins-v5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  MAINTAINERS: Drop inactive gcc-plugins maintainer
  gcc-plugins: simplify GCC plugin-dev capability test
  gcc-plugins: remove code for GCC versions older than 4.9
parents 8bda68d6 53a57e60
......@@ -7339,7 +7339,6 @@ F: drivers/staging/gasket/
GCC PLUGINS
M: Kees Cook <keescook@chromium.org>
R: Emese Revfy <re.emese@gmail.com>
L: linux-hardening@vger.kernel.org
S: Maintained
F: Documentation/kbuild/gcc-plugins.rst
......
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
set -e
srctree=$(dirname "$0")
gccplugins_dir=$($* -print-file-name=plugin)
# we need a c++ compiler that supports the designated initializer GNU extension
$HOSTCC -c -x c++ -std=gnu++98 - -fsyntax-only -I $srctree/gcc-plugins -I $gccplugins_dir/include 2>/dev/null <<EOF
#include "gcc-common.h"
class test {
public:
int test;
} test = {
.test = 1
};
EOF
......@@ -9,7 +9,7 @@ menuconfig GCC_PLUGINS
bool "GCC plugins"
depends on HAVE_GCC_PLUGINS
depends on CC_IS_GCC
depends on $(success,$(srctree)/scripts/gcc-plugin.sh $(CC))
depends on $(success,test -e $(shell,$(CC) -print-file-name=plugin)/include/plugin-version.h)
default y
help
GCC plugins are loadable modules that provide extra features to the
......
This diff is collapsed.
......@@ -73,18 +73,11 @@
#define TODO_FLAGS_FINISH 0
#endif
#if BUILDING_GCC_VERSION >= 4009
namespace {
static const pass_data _PASS_NAME_PASS_DATA = {
#else
static struct gimple_opt_pass _PASS_NAME_PASS = {
.pass = {
#endif
.type = GIMPLE_PASS,
.name = _PASS_NAME_NAME,
#if BUILDING_GCC_VERSION >= 4008
.optinfo_flags = OPTGROUP_NONE,
#endif
#if BUILDING_GCC_VERSION >= 5000
#elif BUILDING_GCC_VERSION == 4009
.has_gate = _HAS_GATE,
......@@ -102,12 +95,8 @@ static struct gimple_opt_pass _PASS_NAME_PASS = {
.properties_destroyed = PROPERTIES_DESTROYED,
.todo_flags_start = TODO_FLAGS_START,
.todo_flags_finish = TODO_FLAGS_FINISH,
#if BUILDING_GCC_VERSION < 4009
}
#endif
};
#if BUILDING_GCC_VERSION >= 4009
class _PASS_NAME_PASS : public gimple_opt_pass {
public:
_PASS_NAME_PASS() : gimple_opt_pass(_PASS_NAME_PASS_DATA, g) {}
......@@ -128,7 +117,6 @@ class _PASS_NAME_PASS : public gimple_opt_pass {
#else
virtual unsigned int execute(void) { return _EXECUTE(); }
#endif
#endif
};
}
......
......@@ -141,18 +141,11 @@
#define FUNCTION_TRANSFORM_TODO_FLAGS_START 0
#endif
#if BUILDING_GCC_VERSION >= 4009
namespace {
static const pass_data _PASS_NAME_PASS_DATA = {
#else
static struct ipa_opt_pass_d _PASS_NAME_PASS = {
.pass = {
#endif
.type = IPA_PASS,
.name = _PASS_NAME_NAME,
#if BUILDING_GCC_VERSION >= 4008
.optinfo_flags = OPTGROUP_NONE,
#endif
#if BUILDING_GCC_VERSION >= 5000
#elif BUILDING_GCC_VERSION == 4009
.has_gate = _HAS_GATE,
......@@ -170,23 +163,8 @@ static struct ipa_opt_pass_d _PASS_NAME_PASS = {
.properties_destroyed = PROPERTIES_DESTROYED,
.todo_flags_start = TODO_FLAGS_START,
.todo_flags_finish = TODO_FLAGS_FINISH,
#if BUILDING_GCC_VERSION < 4009
},
.generate_summary = _GENERATE_SUMMARY,
.write_summary = _WRITE_SUMMARY,
.read_summary = _READ_SUMMARY,
#if BUILDING_GCC_VERSION >= 4006
.write_optimization_summary = _WRITE_OPTIMIZATION_SUMMARY,
.read_optimization_summary = _READ_OPTIMIZATION_SUMMARY,
#endif
.stmt_fixup = _STMT_FIXUP,
.function_transform_todo_flags_start = FUNCTION_TRANSFORM_TODO_FLAGS_START,
.function_transform = _FUNCTION_TRANSFORM,
.variable_transform = _VARIABLE_TRANSFORM,
#endif
};
#if BUILDING_GCC_VERSION >= 4009
class _PASS_NAME_PASS : public ipa_opt_pass_d {
public:
_PASS_NAME_PASS() : ipa_opt_pass_d(_PASS_NAME_PASS_DATA,
......@@ -206,7 +184,6 @@ class _PASS_NAME_PASS : public ipa_opt_pass_d {
virtual bool gate(function *) { return _GATE(); }
#else
virtual bool gate(void) { return _GATE(); }
#endif
#endif
virtual opt_pass *clone() { return new _PASS_NAME_PASS(); }
......
......@@ -73,18 +73,11 @@
#define TODO_FLAGS_FINISH 0
#endif
#if BUILDING_GCC_VERSION >= 4009
namespace {
static const pass_data _PASS_NAME_PASS_DATA = {
#else
static struct rtl_opt_pass _PASS_NAME_PASS = {
.pass = {
#endif
.type = RTL_PASS,
.name = _PASS_NAME_NAME,
#if BUILDING_GCC_VERSION >= 4008
.optinfo_flags = OPTGROUP_NONE,
#endif
#if BUILDING_GCC_VERSION >= 5000
#elif BUILDING_GCC_VERSION == 4009
.has_gate = _HAS_GATE,
......@@ -102,12 +95,8 @@ static struct rtl_opt_pass _PASS_NAME_PASS = {
.properties_destroyed = PROPERTIES_DESTROYED,
.todo_flags_start = TODO_FLAGS_START,
.todo_flags_finish = TODO_FLAGS_FINISH,
#if BUILDING_GCC_VERSION < 4009
}
#endif
};
#if BUILDING_GCC_VERSION >= 4009
class _PASS_NAME_PASS : public rtl_opt_pass {
public:
_PASS_NAME_PASS() : rtl_opt_pass(_PASS_NAME_PASS_DATA, g) {}
......@@ -136,12 +125,6 @@ opt_pass *_MAKE_PASS_NAME_PASS(void)
{
return new _PASS_NAME_PASS();
}
#else
struct opt_pass *_MAKE_PASS_NAME_PASS(void)
{
return &_PASS_NAME_PASS.pass;
}
#endif
/* clean up user provided defines */
#undef PASS_NAME
......
......@@ -73,18 +73,11 @@
#define TODO_FLAGS_FINISH 0
#endif
#if BUILDING_GCC_VERSION >= 4009
namespace {
static const pass_data _PASS_NAME_PASS_DATA = {
#else
static struct simple_ipa_opt_pass _PASS_NAME_PASS = {
.pass = {
#endif
.type = SIMPLE_IPA_PASS,
.name = _PASS_NAME_NAME,
#if BUILDING_GCC_VERSION >= 4008
.optinfo_flags = OPTGROUP_NONE,
#endif
#if BUILDING_GCC_VERSION >= 5000
#elif BUILDING_GCC_VERSION == 4009
.has_gate = _HAS_GATE,
......@@ -102,12 +95,8 @@ static struct simple_ipa_opt_pass _PASS_NAME_PASS = {
.properties_destroyed = PROPERTIES_DESTROYED,
.todo_flags_start = TODO_FLAGS_START,
.todo_flags_finish = TODO_FLAGS_FINISH,
#if BUILDING_GCC_VERSION < 4009
}
#endif
};
#if BUILDING_GCC_VERSION >= 4009
class _PASS_NAME_PASS : public simple_ipa_opt_pass {
public:
_PASS_NAME_PASS() : simple_ipa_opt_pass(_PASS_NAME_PASS_DATA, g) {}
......@@ -136,12 +125,6 @@ opt_pass *_MAKE_PASS_NAME_PASS(void)
{
return new _PASS_NAME_PASS();
}
#else
struct opt_pass *_MAKE_PASS_NAME_PASS(void)
{
return &_PASS_NAME_PASS.pass;
}
#endif
/* clean up user provided defines */
#undef PASS_NAME
......
......@@ -125,11 +125,7 @@ static tree handle_latent_entropy_attribute(tree *node, tree name,
bool *no_add_attrs)
{
tree type;
#if BUILDING_GCC_VERSION <= 4007
VEC(constructor_elt, gc) *vals;
#else
vec<constructor_elt, va_gc> *vals;
#endif
switch (TREE_CODE(*node)) {
default:
......@@ -181,11 +177,7 @@ static tree handle_latent_entropy_attribute(tree *node, tree name,
if (fld)
break;
#if BUILDING_GCC_VERSION <= 4007
vals = VEC_alloc(constructor_elt, gc, nelt);
#else
vec_alloc(vals, nelt);
#endif
for (fld = lst; fld; fld = TREE_CHAIN(fld)) {
tree random_const, fld_t = TREE_TYPE(fld);
......@@ -225,11 +217,7 @@ static tree handle_latent_entropy_attribute(tree *node, tree name,
elt_size_int = TREE_INT_CST_LOW(elt_size);
nelt = array_size_int / elt_size_int;
#if BUILDING_GCC_VERSION <= 4007
vals = VEC_alloc(constructor_elt, gc, nelt);
#else
vec_alloc(vals, nelt);
#endif
for (i = 0; i < nelt; i++) {
tree cst = size_int(i);
......
......@@ -590,16 +590,12 @@ static void register_attributes(void *event_data, void *data)
randomize_layout_attr.name = "randomize_layout";
randomize_layout_attr.type_required = true;
randomize_layout_attr.handler = handle_randomize_layout_attr;
#if BUILDING_GCC_VERSION >= 4007
randomize_layout_attr.affects_type_identity = true;
#endif
no_randomize_layout_attr.name = "no_randomize_layout";
no_randomize_layout_attr.type_required = true;
no_randomize_layout_attr.handler = handle_randomize_layout_attr;
#if BUILDING_GCC_VERSION >= 4007
no_randomize_layout_attr.affects_type_identity = true;
#endif
randomize_considered_attr.name = "randomize_considered";
randomize_considered_attr.type_required = true;
......
......@@ -80,10 +80,8 @@ static void sancov_start_unit(void __unused *gcc_data, void __unused *user_data)
nothrow_attr = tree_cons(get_identifier("nothrow"), NULL, NULL);
decl_attributes(&sancov_fndecl, nothrow_attr, 0);
gcc_assert(TREE_NOTHROW(sancov_fndecl));
#if BUILDING_GCC_VERSION > 4005
leaf_attr = tree_cons(get_identifier("leaf"), NULL, NULL);
decl_attributes(&sancov_fndecl, leaf_attr, 0);
#endif
}
__visible int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
......@@ -106,11 +104,7 @@ __visible int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gc
};
/* BBs can be split afterwards?? */
#if BUILDING_GCC_VERSION >= 4009
PASS_INFO(sancov, "asan", 0, PASS_POS_INSERT_BEFORE);
#else
PASS_INFO(sancov, "nrv", 1, PASS_POS_INSERT_BEFORE);
#endif
if (!plugin_default_version_check(version, &gcc_version)) {
error(G_("incompatible gcc/plugin versions"));
......
......@@ -80,10 +80,8 @@ static bool is_alloca(gimple stmt)
if (gimple_call_builtin_p(stmt, BUILT_IN_ALLOCA))
return true;
#if BUILDING_GCC_VERSION >= 4007
if (gimple_call_builtin_p(stmt, BUILT_IN_ALLOCA_WITH_ALIGN))
return true;
#endif
return false;
}
......@@ -322,7 +320,7 @@ static void remove_stack_tracking_gcall(void)
/* Delete the stackleak_track_stack() call */
delete_insn_and_edges(insn);
#if BUILDING_GCC_VERSION >= 4007 && BUILDING_GCC_VERSION < 8000
#if BUILDING_GCC_VERSION < 8000
if (GET_CODE(next) == NOTE &&
NOTE_KIND(next) == NOTE_INSN_CALL_ARG_LOCATION) {
insn = next;
......
......@@ -68,9 +68,7 @@ static void register_attributes(void *event_data, void *data)
{
user_attr.name = "user";
user_attr.handler = handle_user_attribute;
#if BUILDING_GCC_VERSION >= 4007
user_attr.affects_type_identity = true;
#endif
register_attribute(&user_attr);
}
......@@ -137,11 +135,9 @@ static void initialize(tree var)
if (!gimple_assign_single_p(stmt))
continue;
rhs1 = gimple_assign_rhs1(stmt);
#if BUILDING_GCC_VERSION >= 4007
/* ... of a non-clobbering expression... */
if (TREE_CLOBBER_P(rhs1))
continue;
#endif
/* ... to our variable... */
if (gimple_get_lhs(stmt) != var)
continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment