Skip to content

Commit 4ed8244

Browse files
committed
Merge tag 'gcc-plugins-v4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull gcc plugins updates from Kees Cook: - update includes for gcc 8 (Valdis Kletnieks) - update initializers for gcc 8 * tag 'gcc-plugins-v4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: gcc-plugins: Use dynamic initializers gcc-plugins: Add include required by GCC release 8
2 parents a0f7938 + b867291 commit 4ed8244

File tree

4 files changed

+37
-78
lines changed

4 files changed

+37
-78
lines changed

scripts/gcc-plugins/gcc-common.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@
9797
#include "predict.h"
9898
#include "ipa-utils.h"
9999

100+
#if BUILDING_GCC_VERSION >= 8000
101+
#include "stringpool.h"
102+
#endif
103+
100104
#if BUILDING_GCC_VERSION >= 4009
101105
#include "attribs.h"
102106
#include "varasm.h"

scripts/gcc-plugins/latent_entropy_plugin.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -255,21 +255,14 @@ static tree handle_latent_entropy_attribute(tree *node, tree name,
255255
return NULL_TREE;
256256
}
257257

258-
static struct attribute_spec latent_entropy_attr = {
259-
.name = "latent_entropy",
260-
.min_length = 0,
261-
.max_length = 0,
262-
.decl_required = true,
263-
.type_required = false,
264-
.function_type_required = false,
265-
.handler = handle_latent_entropy_attribute,
266-
#if BUILDING_GCC_VERSION >= 4007
267-
.affects_type_identity = false
268-
#endif
269-
};
258+
static struct attribute_spec latent_entropy_attr = { };
270259

271260
static void register_attributes(void *event_data __unused, void *data __unused)
272261
{
262+
latent_entropy_attr.name = "latent_entropy";
263+
latent_entropy_attr.decl_required = true;
264+
latent_entropy_attr.handler = handle_latent_entropy_attribute;
265+
273266
register_attribute(&latent_entropy_attr);
274267
}
275268

scripts/gcc-plugins/randomize_layout_plugin.c

Lines changed: 21 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -580,68 +580,35 @@ static void finish_type(void *event_data, void *data)
580580
return;
581581
}
582582

583-
static struct attribute_spec randomize_layout_attr = {
584-
.name = "randomize_layout",
585-
// related to args
586-
.min_length = 0,
587-
.max_length = 0,
588-
.decl_required = false,
589-
// need type declaration
590-
.type_required = true,
591-
.function_type_required = false,
592-
.handler = handle_randomize_layout_attr,
593-
#if BUILDING_GCC_VERSION >= 4007
594-
.affects_type_identity = true
595-
#endif
596-
};
583+
static struct attribute_spec randomize_layout_attr = { };
584+
static struct attribute_spec no_randomize_layout_attr = { };
585+
static struct attribute_spec randomize_considered_attr = { };
586+
static struct attribute_spec randomize_performed_attr = { };
597587

598-
static struct attribute_spec no_randomize_layout_attr = {
599-
.name = "no_randomize_layout",
600-
// related to args
601-
.min_length = 0,
602-
.max_length = 0,
603-
.decl_required = false,
604-
// need type declaration
605-
.type_required = true,
606-
.function_type_required = false,
607-
.handler = handle_randomize_layout_attr,
588+
static void register_attributes(void *event_data, void *data)
589+
{
590+
randomize_layout_attr.name = "randomize_layout";
591+
randomize_layout_attr.type_required = true;
592+
randomize_layout_attr.handler = handle_randomize_layout_attr;
608593
#if BUILDING_GCC_VERSION >= 4007
609-
.affects_type_identity = true
594+
randomize_layout_attr.affects_type_identity = true;
610595
#endif
611-
};
612596

613-
static struct attribute_spec randomize_considered_attr = {
614-
.name = "randomize_considered",
615-
// related to args
616-
.min_length = 0,
617-
.max_length = 0,
618-
.decl_required = false,
619-
// need type declaration
620-
.type_required = true,
621-
.function_type_required = false,
622-
.handler = handle_randomize_considered_attr,
597+
no_randomize_layout_attr.name = "no_randomize_layout";
598+
no_randomize_layout_attr.type_required = true;
599+
no_randomize_layout_attr.handler = handle_randomize_layout_attr;
623600
#if BUILDING_GCC_VERSION >= 4007
624-
.affects_type_identity = false
601+
no_randomize_layout_attr.affects_type_identity = true;
625602
#endif
626-
};
627603

628-
static struct attribute_spec randomize_performed_attr = {
629-
.name = "randomize_performed",
630-
// related to args
631-
.min_length = 0,
632-
.max_length = 0,
633-
.decl_required = false,
634-
// need type declaration
635-
.type_required = true,
636-
.function_type_required = false,
637-
.handler = handle_randomize_performed_attr,
638-
#if BUILDING_GCC_VERSION >= 4007
639-
.affects_type_identity = false
640-
#endif
641-
};
604+
randomize_considered_attr.name = "randomize_considered";
605+
randomize_considered_attr.type_required = true;
606+
randomize_considered_attr.handler = handle_randomize_considered_attr;
607+
608+
randomize_performed_attr.name = "randomize_performed";
609+
randomize_performed_attr.type_required = true;
610+
randomize_performed_attr.handler = handle_randomize_performed_attr;
642611

643-
static void register_attributes(void *event_data, void *data)
644-
{
645612
register_attribute(&randomize_layout_attr);
646613
register_attribute(&no_randomize_layout_attr);
647614
register_attribute(&randomize_considered_attr);

scripts/gcc-plugins/structleak_plugin.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,16 @@ static tree handle_user_attribute(tree *node, tree name, tree args, int flags, b
5757
return NULL_TREE;
5858
}
5959

60-
static struct attribute_spec user_attr = {
61-
.name = "user",
62-
.min_length = 0,
63-
.max_length = 0,
64-
.decl_required = false,
65-
.type_required = false,
66-
.function_type_required = false,
67-
.handler = handle_user_attribute,
68-
#if BUILDING_GCC_VERSION >= 4007
69-
.affects_type_identity = true
70-
#endif
71-
};
60+
static struct attribute_spec user_attr = { };
7261

7362
static void register_attributes(void *event_data, void *data)
7463
{
64+
user_attr.name = "user";
65+
user_attr.handler = handle_user_attribute;
66+
#if BUILDING_GCC_VERSION >= 4007
67+
user_attr.affects_type_identity = true;
68+
#endif
69+
7570
register_attribute(&user_attr);
7671
}
7772

0 commit comments

Comments
 (0)