diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2003-11-29 13:29:05 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2003-11-29 13:29:05 +0000 |
commit | 79e5af700c2339548514a2e374755c8f12973858 (patch) | |
tree | ba3507d27cb011808ea953c1da687eb928406211 /gnu/usr.bin/gcc | |
parent | fb78aff219e3dd47214600bd7671510066ab8275 (diff) |
Add OpenBSD specific features:
- stub for bounded
- kprintf format.
- no strict aliasing in -O2
- no ident for each object file.
- recognize stack-protector option.
Diffstat (limited to 'gnu/usr.bin/gcc')
-rw-r--r-- | gnu/usr.bin/gcc/gcc/c-common.c | 19 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/gcc/c-format.c | 62 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/gcc/toplev.c | 14 |
3 files changed, 93 insertions, 2 deletions
diff --git a/gnu/usr.bin/gcc/gcc/c-common.c b/gnu/usr.bin/gcc/gcc/c-common.c index b40a35aecb5..9c95cf3e7ba 100644 --- a/gnu/usr.bin/gcc/gcc/c-common.c +++ b/gnu/usr.bin/gcc/gcc/c-common.c @@ -765,6 +765,8 @@ static tree handle_deprecated_attribute PARAMS ((tree *, tree, tree, int, bool *)); static tree handle_vector_size_attribute PARAMS ((tree *, tree, tree, int, bool *)); +static tree handle_bounded_attribute PARAMS ((tree *, tree, tree, int, + bool *)); static tree handle_nonnull_attribute PARAMS ((tree *, tree, tree, int, bool *)); static tree handle_nothrow_attribute PARAMS ((tree *, tree, tree, int, @@ -850,6 +852,8 @@ const struct attribute_spec c_common_attribute_table[] = handle_deprecated_attribute }, { "vector_size", 1, 1, false, true, false, handle_vector_size_attribute }, + { "bounded", 3, 4, false, true, false, + handle_bounded_attribute }, { "visibility", 1, 1, true, false, false, handle_visibility_attribute }, { "tls_model", 1, 1, true, false, false, @@ -6381,6 +6385,21 @@ vector_size_helper (type, bottom) return outer; } +/* Handle a "bounded" attribute; arguments as in + struct attribute_spec.handler. + Just a stub for now. */ + +static tree +handle_bounded_attribute (node, name, args, flags, no_add_attrs) + tree *node ATTRIBUTE_UNUSED; + tree name ATTRIBUTE_UNUSED; + tree args ATTRIBUTE_UNUSED; + int flags ATTRIBUTE_UNUSED; + bool *no_add_attrs ATTRIBUTE_UNUSED; +{ + return NULL_TREE; +} + /* Handle the "nonnull" attribute. */ static tree handle_nonnull_attribute (node, name, args, flags, no_add_attrs) diff --git a/gnu/usr.bin/gcc/gcc/c-format.c b/gnu/usr.bin/gcc/gcc/c-format.c index 083e91278f8..ad254ea61f9 100644 --- a/gnu/usr.bin/gcc/gcc/c-format.c +++ b/gnu/usr.bin/gcc/gcc/c-format.c @@ -54,7 +54,7 @@ set_Wformat (setting) /* This must be in the same order as format_types, with format_type_error last. */ -enum format_type { printf_format_type, scanf_format_type, +enum format_type { printf_format_type, kprintf_format_type, syslog_format_type, scanf_format_type, strftime_format_type, strfmon_format_type, format_type_error }; @@ -572,6 +572,14 @@ static const format_length_info printf_length_specs[] = { NULL, 0, 0, NULL, 0, 0 } }; +static const format_length_info kprintf_length_specs[] = +{ + { "h", FMT_LEN_h, STD_C89, NULL, 0, 0 }, + { "l", FMT_LEN_l, STD_C89, NULL, 0, 0 }, + { "L", FMT_LEN_L, STD_C89, NULL, 0, 0 }, + { NULL, 0, 0, NULL, 0, 0 } +}; + /* This differs from printf_length_specs only in that "Z" is not accepted. */ static const format_length_info scanf_length_specs[] = @@ -765,6 +773,46 @@ static const format_char_info print_char_table[] = { NULL, 0, 0, NOLENGTHS, NULL, NULL } }; +static const format_char_info kprint_char_table[] = +{ + /* C89 conversion specifiers. */ + { "di", 0, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T9L_LL, TEX_LL, T99_SST, T99_PD, T99_IM }, "-wp0 +'I", "i" }, + { "oxX", 0, STD_C89, { T89_UI, T99_UC, T89_US, T89_UL, T9L_ULL, TEX_ULL, T99_ST, T99_UPD, T99_UIM }, "-wp0#", "i" }, + { "u", 0, STD_C89, { T89_UI, T99_UC, T89_US, T89_UL, T9L_ULL, TEX_ULL, T99_ST, T99_UPD, T99_UIM }, "-wp0'I", "i" }, + { "c", 0, STD_C89, { T89_I, BADLEN, BADLEN, T94_WI, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "" }, + { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "cR" }, + { "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "c" }, +/* Kernel bitmap formatting */ + { "b", 1, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "" }, +/* Kernel recursive format */ + { ":", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "", "" }, +/* Kernel debugger auto-radix printing */ + { "nrz", 0, STD_C89, { T89_I, T89_I, T89_I, T89_L, T9L_LL, TEX_LL, BADLEN, BADLEN, BADLEN }, "-wp0# +", "" }, + { NULL, 0, 0, NOLENGTHS, NULL, NULL } +}; + +static const format_char_info syslog_char_table[] = +{ + /* C89 conversion specifiers. */ + { "di", 0, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T9L_LL, TEX_LL, T99_SST, T99_PD, T99_IM }, "-wp0 +'I", "i" }, + { "oxX", 0, STD_C89, { T89_UI, T99_UC, T89_US, T89_UL, T9L_ULL, TEX_ULL, T99_ST, T99_UPD, T99_UIM }, "-wp0#", "i" }, + { "u", 0, STD_C89, { T89_UI, T99_UC, T89_US, T89_UL, T9L_ULL, TEX_ULL, T99_ST, T99_UPD, T99_UIM }, "-wp0'I", "i" }, + { "fgG", 0, STD_C89, { T89_D, BADLEN, BADLEN, T99_D, BADLEN, T89_LD, BADLEN, BADLEN, BADLEN }, "-wp0 +#'", "" }, + { "eE", 0, STD_C89, { T89_D, BADLEN, BADLEN, T99_D, BADLEN, T89_LD, BADLEN, BADLEN, BADLEN }, "-wp0 +#", "" }, + { "c", 0, STD_C89, { T89_I, BADLEN, BADLEN, T94_WI, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "" }, + { "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, T94_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "cR" }, + { "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "c" }, + { "n", 1, STD_C89, { T89_I, T99_SC, T89_S, T89_L, T9L_LL, BADLEN, T99_SST, T99_PD, T99_IM }, "", "W" }, + /* C99 conversion specifiers. */ + { "F", 0, STD_C99, { T99_D, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN }, "-wp0 +#'", "" }, + { "aA", 0, STD_C99, { T99_D, BADLEN, BADLEN, T99_D, BADLEN, T99_LD, BADLEN, BADLEN, BADLEN }, "-wp0 +#", "" }, + /* X/Open conversion specifiers. */ + { "C", 0, STD_EXT, { TEX_WI, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-w", "" }, + { "S", 1, STD_EXT, { TEX_W, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "R" }, + { "m", 0, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "-wp", "" }, + { NULL, 0, 0, NOLENGTHS, NULL, NULL } +}; + static const format_char_info scan_char_table[] = { /* C89 conversion specifiers. */ @@ -828,6 +876,18 @@ static const format_kind_info format_types[] = 'w', 0, 'p', 0, 'L', &integer_type_node, &integer_type_node }, + { "kprintf", kprintf_length_specs, kprint_char_table, " +#0-'I", NULL, + printf_flag_specs, printf_flag_pairs, + FMT_FLAG_ARG_CONVERT|FMT_FLAG_DOLLAR_MULTIPLE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_EMPTY_PREC_OK, + 'w', 0, 'p', 0, 'L', + &integer_type_node, &integer_type_node + }, + { "syslog", printf_length_specs, syslog_char_table, " +#0-'I", NULL, + printf_flag_specs, printf_flag_pairs, + FMT_FLAG_ARG_CONVERT|FMT_FLAG_DOLLAR_MULTIPLE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_EMPTY_PREC_OK, + 'w', 0, 'p', 0, 'L', + &integer_type_node, &integer_type_node + }, { "scanf", scanf_length_specs, scan_char_table, "*'I", NULL, scanf_flag_specs, scanf_flag_pairs, FMT_FLAG_ARG_CONVERT|FMT_FLAG_SCANF_A_KLUDGE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_ZERO_WIDTH_BAD|FMT_FLAG_DOLLAR_GAP_POINTER_OK, diff --git a/gnu/usr.bin/gcc/gcc/toplev.c b/gnu/usr.bin/gcc/gcc/toplev.c index adccdc40361..e3b5ac5d010 100644 --- a/gnu/usr.bin/gcc/gcc/toplev.c +++ b/gnu/usr.bin/gcc/gcc/toplev.c @@ -852,7 +852,11 @@ int flag_instrument_function_entry_exit = 0; On SVR4 targets, it also controls whether or not to emit a string identifying the compiler. */ +#ifdef OPENBSD_NATIVE +int flag_no_ident = 1; +#else int flag_no_ident = 0; +#endif /* This will perform a peephole pass before sched2. */ int flag_peephole2 = 0; @@ -904,6 +908,9 @@ int align_functions_log; minimum function alignment. Zero means no alignment is forced. */ int force_align_functions_log; +/* Fake StackProtector option, does nothing. */ +int flag_propolice_protection = 0; + /* Table of supported debugging formats. */ static const struct { @@ -1186,6 +1193,8 @@ static const lang_independent_options f_options[] = N_("Report on permanent memory allocation at end of run") }, { "trapv", &flag_trapv, 1, N_("Trap for signed overflow in addition / subtraction / multiplication") }, + { "no-stack-protector", &flag_propolice_protection, 0, + N_("Fake disable stack protection") }, { "new-ra", &flag_new_regalloc, 1, N_("Use graph coloring register allocation.") }, }; @@ -1362,6 +1371,9 @@ documented_lang_options[] = { "-Wwrite-strings", N_("Mark strings as 'const char *'") }, { "-Wno-write-strings", "" }, + { "-Wbounded", + N_("Fake bounds checking option") }, + { "-Wno-bounded", "" }, #define DEFINE_LANG_NAME(NAME) { NULL, NAME }, @@ -4898,7 +4910,6 @@ parse_options_and_default_flags (argc, argv) flag_schedule_insns_after_reload = 1; #endif flag_regmove = 1; - flag_strict_aliasing = 1; flag_delete_null_pointer_checks = 1; flag_reorder_blocks = 1; flag_reorder_functions = 1; @@ -4906,6 +4917,7 @@ parse_options_and_default_flags (argc, argv) if (optimize >= 3) { + flag_strict_aliasing = 1; flag_inline_functions = 1; flag_rename_registers = 1; } |