Small fixes for gcc-plugins when using certain gcc versions:

- Update gcc-common.h for gcc 7 from Emese Revfy.
 - Fix latent_entropy type for early gcc on ARM from PaX Team.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 Comment: Kees Cook <kees@outflux.net>
 
 iQIcBAABCgAGBQJYbAXTAAoJEIly9N/cbcAms4UP/jlpN0j2HxHm5k2md2m0SXEs
 DosCt1k6nVaCGw0VgR0FqFlyCdQG9wVyW9PO/4QfJMqXpZyFesOgGn8KnXS/Luje
 L/KhdUDew+hp7K9kwOB1YIMHkba1Q3TlutY/2PIHCR9Bx5XrcRWJ3kYyT+Hir6LS
 9nZh9Ji7xzmH/rfm1Qoh9BXuVZm4sIOUA6Lnb36iQ7c6+g8khMsDm97XdrTclDtv
 GEv3aBBTkM9yAqj946Re5enZUxQjvPtxpd+vCuy+3STvz7L7R71GoCOw4ZvUeZ24
 hmVUhnlpIVPEnayUFXohDdRuQdW2F+7X1JNM49reKUc2a33HSWpLSmFYIPQI+FD7
 ICCHks/8uMmT1z7DuF9XjnEOZbHpjKhABRyFv3BT7FrJJI0ufnrJu99hDSFxP1QO
 xGKEVuv+xYFelM+UNA66MjLzMHUqTRUpSkU1vcTeM7k7U/Lo/ztVKfNQjTo0dv1I
 JpG6f/R7LNzm9ZB7bN6dJWE/Y0PWxoG7aJteYS39CA9NghNOhjuYMhx43F5Xyqbq
 E7lgK8rCzGSryEAE4ntRS7JFG52bo0WJSkv67uTAGpGIzcOZsDXGDtA0fDP8yLw7
 mBn6RAL66UYX1lLs4avml7DHWtclQzxpnHUNsAF71m6d2ZuYvaRKGl7dVbLFPIOb
 6vz210IaQLnCZtP2otqC
 =mLY6
 -----END PGP SIGNATURE-----

Merge tag 'gcc-plugins-v4.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux

Pull gcc-plugins fixes from Kees Cook:
 "Small fixes for gcc-plugins when using certain gcc versions:

   - update gcc-common.h for gcc 7 (Emese Revfy)

   - fix latent_entropy type for early gcc on ARM (PaX Team)"

* tag 'gcc-plugins-v4.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  gcc-plugins: update gcc-common.h for gcc-7
  latent_entropy: fix ARM build error on earlier gcc
This commit is contained in:
Linus Torvalds 2017-01-04 08:56:05 -08:00
Родитель 0f64df3012 81d873a871
Коммит 99b9be7763
2 изменённых файлов: 87 добавлений и 2 удалений

Просмотреть файл

@ -39,6 +39,9 @@
#include "hash-map.h"
#endif
#if BUILDING_GCC_VERSION >= 7000
#include "memmodel.h"
#endif
#include "emit-rtl.h"
#include "debug.h"
#include "target.h"
@ -91,6 +94,9 @@
#include "tree-ssa-alias.h"
#include "tree-ssa.h"
#include "stringpool.h"
#if BUILDING_GCC_VERSION >= 7000
#include "tree-vrp.h"
#endif
#include "tree-ssanames.h"
#include "print-tree.h"
#include "tree-eh.h"
@ -287,6 +293,22 @@ static inline struct cgraph_node *cgraph_next_function_with_gimple_body(struct c
return NULL;
}
static inline bool cgraph_for_node_and_aliases(cgraph_node_ptr node, bool (*callback)(cgraph_node_ptr, void *), void *data, bool include_overwritable)
{
cgraph_node_ptr alias;
if (callback(node, data))
return true;
for (alias = node->same_body; alias; alias = alias->next) {
if (include_overwritable || cgraph_function_body_availability(alias) > AVAIL_OVERWRITABLE)
if (cgraph_for_node_and_aliases(alias, callback, data, include_overwritable))
return true;
}
return false;
}
#define FOR_EACH_FUNCTION_WITH_GIMPLE_BODY(node) \
for ((node) = cgraph_first_function_with_gimple_body(); (node); \
(node) = cgraph_next_function_with_gimple_body(node))
@ -399,6 +421,7 @@ typedef union gimple_statement_d gassign;
typedef union gimple_statement_d gcall;
typedef union gimple_statement_d gcond;
typedef union gimple_statement_d gdebug;
typedef union gimple_statement_d ggoto;
typedef union gimple_statement_d gphi;
typedef union gimple_statement_d greturn;
@ -452,6 +475,16 @@ static inline const gdebug *as_a_const_gdebug(const_gimple stmt)
return stmt;
}
static inline ggoto *as_a_ggoto(gimple stmt)
{
return stmt;
}
static inline const ggoto *as_a_const_ggoto(const_gimple stmt)
{
return stmt;
}
static inline gphi *as_a_gphi(gimple stmt)
{
return stmt;
@ -496,6 +529,14 @@ static inline const greturn *as_a_const_greturn(const_gimple stmt)
typedef struct rtx_def rtx_insn;
static inline const char *get_decl_section_name(const_tree decl)
{
if (DECL_SECTION_NAME(decl) == NULL_TREE)
return NULL;
return TREE_STRING_POINTER(DECL_SECTION_NAME(decl));
}
static inline void set_decl_section_name(tree node, const char *value)
{
if (value)
@ -511,6 +552,7 @@ typedef struct gimple_statement_base gassign;
typedef struct gimple_statement_call gcall;
typedef struct gimple_statement_base gcond;
typedef struct gimple_statement_base gdebug;
typedef struct gimple_statement_base ggoto;
typedef struct gimple_statement_phi gphi;
typedef struct gimple_statement_base greturn;
@ -564,6 +606,16 @@ static inline const gdebug *as_a_const_gdebug(const_gimple stmt)
return stmt;
}
static inline ggoto *as_a_ggoto(gimple stmt)
{
return stmt;
}
static inline const ggoto *as_a_const_ggoto(const_gimple stmt)
{
return stmt;
}
static inline gphi *as_a_gphi(gimple stmt)
{
return as_a<gphi>(stmt);
@ -611,6 +663,11 @@ inline bool is_a_helper<const gassign *>::test(const_gimple gs)
#define INSN_DELETED_P(insn) (insn)->deleted()
static inline const char *get_decl_section_name(const_tree decl)
{
return DECL_SECTION_NAME(decl);
}
/* symtab/cgraph related */
#define debug_cgraph_node(node) (node)->debug()
#define cgraph_get_node(decl) cgraph_node::get(decl)
@ -619,6 +676,7 @@ inline bool is_a_helper<const gassign *>::test(const_gimple gs)
#define cgraph_n_nodes symtab->cgraph_count
#define cgraph_max_uid symtab->cgraph_max_uid
#define varpool_get_node(decl) varpool_node::get(decl)
#define dump_varpool_node(file, node) (node)->dump(file)
#define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \
(caller)->create_edge((callee), (call_stmt), (count), (freq))
@ -674,6 +732,11 @@ static inline cgraph_node_ptr cgraph_alias_target(cgraph_node_ptr node)
return node->get_alias_target();
}
static inline bool cgraph_for_node_and_aliases(cgraph_node_ptr node, bool (*callback)(cgraph_node_ptr, void *), void *data, bool include_overwritable)
{
return node->call_for_symbol_thunks_and_aliases(callback, data, include_overwritable);
}
static inline struct cgraph_node_hook_list *cgraph_add_function_insertion_hook(cgraph_node_hook hook, void *data)
{
return symtab->add_cgraph_insertion_hook(hook, data);
@ -729,6 +792,13 @@ static inline gimple gimple_build_assign_with_ops(enum tree_code subcode, tree l
return gimple_build_assign(lhs, subcode, op1, op2 PASS_MEM_STAT);
}
template <>
template <>
inline bool is_a_helper<const ggoto *>::test(const_gimple gs)
{
return gs->code == GIMPLE_GOTO;
}
template <>
template <>
inline bool is_a_helper<const greturn *>::test(const_gimple gs)
@ -766,6 +836,16 @@ static inline const gcall *as_a_const_gcall(const_gimple stmt)
return as_a<const gcall *>(stmt);
}
static inline ggoto *as_a_ggoto(gimple stmt)
{
return as_a<ggoto *>(stmt);
}
static inline const ggoto *as_a_const_ggoto(const_gimple stmt)
{
return as_a<const ggoto *>(stmt);
}
static inline gphi *as_a_gphi(gimple stmt)
{
return as_a<gphi *>(stmt);
@ -828,4 +908,9 @@ 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 >= 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)
#endif
#endif

Просмотреть файл

@ -328,9 +328,9 @@ static enum tree_code get_op(tree *rhs)
op = LROTATE_EXPR;
/*
* This code limits the value of random_const to
* the size of a wide int for the rotation
* the size of a long for the rotation
*/
random_const &= HOST_BITS_PER_WIDE_INT - 1;
random_const %= TYPE_PRECISION(long_unsigned_type_node);
break;
}