Skip to content

Commit

Permalink
grsec: gcc-common.h - compat macros for gcc 7.1
Browse files Browse the repository at this point in the history
With gcc 7.1 DECL_ALIGN() was replaced by SET_DECL_ALIGN(). The same is
true for DECL_MODE().

Provide compatibility macros in gcc-common.h to fix compiling the
randstruct plugin.

Reported-by: zeepob and https://bugs.gentoo.org/show_bug.cgi?id=618372
Signed-off-by: Mathias Krause <minipli@googlemail.com>
  • Loading branch information
minipli committed Jun 13, 2017
1 parent 9e1de41 commit c497a76
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions scripts/gcc-plugins/gcc-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,11 @@ static inline void debug_gimple_stmt(const_gimple s)
#define debug_gimple_stmt(s) debug_gimple_stmt(CONST_CAST_GIMPLE(s))
#endif

#if BUILDING_GCC_VERSION < 7001
#define SET_DECL_ALIGN(n, a) ({ DECL_ALIGN(n) = (a); })
#define SET_DECL_MODE(n, m) ({ DECL_MODE(n) = (m); })
#endif

#if BUILDING_GCC_VERSION >= 7000
#define get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, preversep, pvolatilep, keep_aligning) \
get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, preversep, pvolatilep)
Expand Down
4 changes: 2 additions & 2 deletions scripts/gcc-plugins/randomize_layout_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,8 @@ static void randomize_layout_finish_decl(void *event_data, void *data)

DECL_SIZE(decl) = 0;
DECL_SIZE_UNIT(decl) = 0;
DECL_ALIGN(decl) = 0;
DECL_MODE (decl) = VOIDmode;
SET_DECL_ALIGN(decl, 0);
SET_DECL_MODE(decl, VOIDmode);
SET_DECL_RTL(decl, 0);
update_decl_size(decl);
layout_decl(decl, 0);
Expand Down

0 comments on commit c497a76

Please sign in to comment.