Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gcc-plugins: remove support for GCC 4.9 and older

The minimum GCC version has been bumped to 5.1, so we can get rid of all
the compatibility code for anything older than that.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20210922182632.633394-1-ardb@kernel.org

authored by

Ard Biesheuvel and committed by
Kees Cook
4c78c727 f02003c8

+1 -208
+1 -130
scripts/gcc-plugins/gcc-common.h
··· 27 27 #include "except.h" 28 28 #include "function.h" 29 29 #include "toplev.h" 30 - #if BUILDING_GCC_VERSION >= 5000 31 30 #include "expr.h" 32 - #endif 33 31 #include "basic-block.h" 34 32 #include "intl.h" 35 33 #include "ggc.h" ··· 37 39 #include "params.h" 38 40 #endif 39 41 40 - #if BUILDING_GCC_VERSION <= 4009 41 - #include "pointer-set.h" 42 - #else 43 42 #include "hash-map.h" 44 - #endif 45 43 46 44 #if BUILDING_GCC_VERSION >= 7000 47 45 #include "memmodel.h" ··· 93 99 #include "gimple-ssa.h" 94 100 #include "ssa-iterators.h" 95 101 96 - #if BUILDING_GCC_VERSION >= 5000 97 102 #include "builtins.h" 98 - #endif 99 103 100 104 /* missing from basic_block.h... */ 101 105 void debug_dominance_info(enum cdi_direction dir); ··· 144 152 #define TODO_dump_func 0 145 153 #define TODO_dump_cgraph 0 146 154 147 - #if BUILDING_GCC_VERSION <= 4009 148 - #define TODO_verify_il 0 149 - #define AVAIL_INTERPOSABLE AVAIL_OVERWRITABLE 150 - 151 - #define section_name_prefix LTO_SECTION_NAME_PREFIX 152 - #define fatal_error(loc, gmsgid, ...) fatal_error((gmsgid), __VA_ARGS__) 153 - 154 - rtx emit_move_insn(rtx x, rtx y); 155 - 156 - typedef struct rtx_def rtx_insn; 157 - 158 - static inline const char *get_decl_section_name(const_tree decl) 159 - { 160 - if (DECL_SECTION_NAME(decl) == NULL_TREE) 161 - return NULL; 162 - 163 - return TREE_STRING_POINTER(DECL_SECTION_NAME(decl)); 164 - } 165 - 166 - static inline void set_decl_section_name(tree node, const char *value) 167 - { 168 - if (value) 169 - DECL_SECTION_NAME(node) = build_string(strlen(value) + 1, value); 170 - else 171 - DECL_SECTION_NAME(node) = NULL; 172 - } 173 - #endif 174 - 175 - #if BUILDING_GCC_VERSION == 4009 176 - typedef struct gimple_statement_asm gasm; 177 - typedef struct gimple_statement_base gassign; 178 - typedef struct gimple_statement_call gcall; 179 - typedef struct gimple_statement_base gcond; 180 - typedef struct gimple_statement_base gdebug; 181 - typedef struct gimple_statement_base ggoto; 182 - typedef struct gimple_statement_phi gphi; 183 - typedef struct gimple_statement_base greturn; 184 - 185 - static inline gasm *as_a_gasm(gimple stmt) 186 - { 187 - return as_a<gasm>(stmt); 188 - } 189 - 190 - static inline const gasm *as_a_const_gasm(const_gimple stmt) 191 - { 192 - return as_a<const gasm>(stmt); 193 - } 194 - 195 - static inline gassign *as_a_gassign(gimple stmt) 196 - { 197 - return stmt; 198 - } 199 - 200 - static inline const gassign *as_a_const_gassign(const_gimple stmt) 201 - { 202 - return stmt; 203 - } 204 - 205 - static inline gcall *as_a_gcall(gimple stmt) 206 - { 207 - return as_a<gcall>(stmt); 208 - } 209 - 210 - static inline const gcall *as_a_const_gcall(const_gimple stmt) 211 - { 212 - return as_a<const gcall>(stmt); 213 - } 214 - 215 - static inline gcond *as_a_gcond(gimple stmt) 216 - { 217 - return stmt; 218 - } 219 - 220 - static inline const gcond *as_a_const_gcond(const_gimple stmt) 221 - { 222 - return stmt; 223 - } 224 - 225 - static inline gdebug *as_a_gdebug(gimple stmt) 226 - { 227 - return stmt; 228 - } 229 - 230 - static inline const gdebug *as_a_const_gdebug(const_gimple stmt) 231 - { 232 - return stmt; 233 - } 234 - 235 - static inline ggoto *as_a_ggoto(gimple stmt) 236 - { 237 - return stmt; 238 - } 239 - 240 - static inline const ggoto *as_a_const_ggoto(const_gimple stmt) 241 - { 242 - return stmt; 243 - } 244 - 245 - static inline gphi *as_a_gphi(gimple stmt) 246 - { 247 - return as_a<gphi>(stmt); 248 - } 249 - 250 - static inline const gphi *as_a_const_gphi(const_gimple stmt) 251 - { 252 - return as_a<const gphi>(stmt); 253 - } 254 - 255 - static inline greturn *as_a_greturn(gimple stmt) 256 - { 257 - return stmt; 258 - } 259 - 260 - static inline const greturn *as_a_const_greturn(const_gimple stmt) 261 - { 262 - return stmt; 263 - } 264 - #endif 265 - 266 155 #define TODO_ggc_collect 0 267 156 #define NODE_SYMBOL(node) (node) 268 157 #define NODE_DECL(node) (node)->decl ··· 155 282 return g->get_passes()->get_pass_for_id(id); 156 283 } 157 284 158 - #if BUILDING_GCC_VERSION >= 5000 && BUILDING_GCC_VERSION < 6000 285 + #if BUILDING_GCC_VERSION < 6000 159 286 /* gimple related */ 160 287 template <> 161 288 template <> ··· 165 292 } 166 293 #endif 167 294 168 - #if BUILDING_GCC_VERSION >= 5000 169 295 #define TODO_verify_ssa TODO_verify_il 170 296 #define TODO_verify_flow TODO_verify_il 171 297 #define TODO_verify_stmts TODO_verify_il ··· 405 533 { 406 534 referring_node->remove_stmt_references(stmt); 407 535 } 408 - #endif 409 536 410 537 #if BUILDING_GCC_VERSION < 6000 411 538 #define get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, preversep, pvolatilep, keep_aligning) \
-19
scripts/gcc-plugins/gcc-generate-gimple-pass.h
··· 78 78 .type = GIMPLE_PASS, 79 79 .name = _PASS_NAME_NAME, 80 80 .optinfo_flags = OPTGROUP_NONE, 81 - #if BUILDING_GCC_VERSION >= 5000 82 - #elif BUILDING_GCC_VERSION == 4009 83 - .has_gate = _HAS_GATE, 84 - .has_execute = _HAS_EXECUTE, 85 - #else 86 - .gate = _GATE, 87 - .execute = _EXECUTE, 88 - .sub = NULL, 89 - .next = NULL, 90 - .static_pass_number = 0, 91 - #endif 92 81 .tv_id = TV_NONE, 93 82 .properties_required = PROPERTIES_REQUIRED, 94 83 .properties_provided = PROPERTIES_PROVIDED, ··· 91 102 _PASS_NAME_PASS() : gimple_opt_pass(_PASS_NAME_PASS_DATA, g) {} 92 103 93 104 #ifndef NO_GATE 94 - #if BUILDING_GCC_VERSION >= 5000 95 105 virtual bool gate(function *) { return _GATE(); } 96 - #else 97 - virtual bool gate(void) { return _GATE(); } 98 - #endif 99 106 #endif 100 107 101 108 virtual opt_pass * clone () { return new _PASS_NAME_PASS(); } 102 109 103 110 #ifndef NO_EXECUTE 104 - #if BUILDING_GCC_VERSION >= 5000 105 111 virtual unsigned int execute(function *) { return _EXECUTE(); } 106 - #else 107 - virtual unsigned int execute(void) { return _EXECUTE(); } 108 - #endif 109 112 }; 110 113 } 111 114
-19
scripts/gcc-plugins/gcc-generate-ipa-pass.h
··· 146 146 .type = IPA_PASS, 147 147 .name = _PASS_NAME_NAME, 148 148 .optinfo_flags = OPTGROUP_NONE, 149 - #if BUILDING_GCC_VERSION >= 5000 150 - #elif BUILDING_GCC_VERSION == 4009 151 - .has_gate = _HAS_GATE, 152 - .has_execute = _HAS_EXECUTE, 153 - #else 154 - .gate = _GATE, 155 - .execute = _EXECUTE, 156 - .sub = NULL, 157 - .next = NULL, 158 - .static_pass_number = 0, 159 - #endif 160 149 .tv_id = TV_NONE, 161 150 .properties_required = PROPERTIES_REQUIRED, 162 151 .properties_provided = PROPERTIES_PROVIDED, ··· 169 180 _VARIABLE_TRANSFORM) {} 170 181 171 182 #ifndef NO_GATE 172 - #if BUILDING_GCC_VERSION >= 5000 173 183 virtual bool gate(function *) { return _GATE(); } 174 - #else 175 - virtual bool gate(void) { return _GATE(); } 176 - #endif 177 184 178 185 virtual opt_pass *clone() { return new _PASS_NAME_PASS(); } 179 186 180 187 #ifndef NO_EXECUTE 181 - #if BUILDING_GCC_VERSION >= 5000 182 188 virtual unsigned int execute(function *) { return _EXECUTE(); } 183 - #else 184 - virtual unsigned int execute(void) { return _EXECUTE(); } 185 - #endif 186 189 #endif 187 190 }; 188 191 }
-19
scripts/gcc-plugins/gcc-generate-rtl-pass.h
··· 78 78 .type = RTL_PASS, 79 79 .name = _PASS_NAME_NAME, 80 80 .optinfo_flags = OPTGROUP_NONE, 81 - #if BUILDING_GCC_VERSION >= 5000 82 - #elif BUILDING_GCC_VERSION == 4009 83 - .has_gate = _HAS_GATE, 84 - .has_execute = _HAS_EXECUTE, 85 - #else 86 - .gate = _GATE, 87 - .execute = _EXECUTE, 88 - .sub = NULL, 89 - .next = NULL, 90 - .static_pass_number = 0, 91 - #endif 92 81 .tv_id = TV_NONE, 93 82 .properties_required = PROPERTIES_REQUIRED, 94 83 .properties_provided = PROPERTIES_PROVIDED, ··· 91 102 _PASS_NAME_PASS() : rtl_opt_pass(_PASS_NAME_PASS_DATA, g) {} 92 103 93 104 #ifndef NO_GATE 94 - #if BUILDING_GCC_VERSION >= 5000 95 105 virtual bool gate(function *) { return _GATE(); } 96 - #else 97 - virtual bool gate(void) { return _GATE(); } 98 - #endif 99 106 #endif 100 107 101 108 virtual opt_pass *clone() { return new _PASS_NAME_PASS(); } 102 109 103 110 #ifndef NO_EXECUTE 104 - #if BUILDING_GCC_VERSION >= 5000 105 111 virtual unsigned int execute(function *) { return _EXECUTE(); } 106 - #else 107 - virtual unsigned int execute(void) { return _EXECUTE(); } 108 - #endif 109 112 #endif 110 113 }; 111 114 }
-19
scripts/gcc-plugins/gcc-generate-simple_ipa-pass.h
··· 78 78 .type = SIMPLE_IPA_PASS, 79 79 .name = _PASS_NAME_NAME, 80 80 .optinfo_flags = OPTGROUP_NONE, 81 - #if BUILDING_GCC_VERSION >= 5000 82 - #elif BUILDING_GCC_VERSION == 4009 83 - .has_gate = _HAS_GATE, 84 - .has_execute = _HAS_EXECUTE, 85 - #else 86 - .gate = _GATE, 87 - .execute = _EXECUTE, 88 - .sub = NULL, 89 - .next = NULL, 90 - .static_pass_number = 0, 91 - #endif 92 81 .tv_id = TV_NONE, 93 82 .properties_required = PROPERTIES_REQUIRED, 94 83 .properties_provided = PROPERTIES_PROVIDED, ··· 91 102 _PASS_NAME_PASS() : simple_ipa_opt_pass(_PASS_NAME_PASS_DATA, g) {} 92 103 93 104 #ifndef NO_GATE 94 - #if BUILDING_GCC_VERSION >= 5000 95 105 virtual bool gate(function *) { return _GATE(); } 96 - #else 97 - virtual bool gate(void) { return _GATE(); } 98 - #endif 99 106 #endif 100 107 101 108 virtual opt_pass *clone() { return new _PASS_NAME_PASS(); } 102 109 103 110 #ifndef NO_EXECUTE 104 - #if BUILDING_GCC_VERSION >= 5000 105 111 virtual unsigned int execute(function *) { return _EXECUTE(); } 106 - #else 107 - virtual unsigned int execute(void) { return _EXECUTE(); } 108 - #endif 109 112 #endif 110 113 }; 111 114 }
-2
scripts/gcc-plugins/structleak_plugin.c
··· 103 103 if (type == NULL_TREE || type == error_mark_node) 104 104 return; 105 105 106 - #if BUILDING_GCC_VERSION >= 5000 107 106 if (TREE_CODE(type) == ENUMERAL_TYPE) 108 107 return; 109 - #endif 110 108 111 109 if (TYPE_USERSPACE(type)) 112 110 return;