summaryrefslogtreecommitdiff
path: root/gcc/opts.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/opts.c')
-rw-r--r--gcc/opts.c86
1 files changed, 67 insertions, 19 deletions
diff --git a/gcc/opts.c b/gcc/opts.c
index 4013ea51fd2..2f9a6380fe1 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -139,13 +139,13 @@ set_struct_debug_option (struct gcc_options *opts, location_t loc,
/* Strip off a legitimate source ending from the input string NAME of
length LEN. Rather than having to know the names used by all of
our front ends, we strip off an ending of a period followed by
- up to five characters. (Java uses ".class".) */
+ up to fource characters. (C++ uses ".cpp".) */
void
strip_off_ending (char *name, int len)
{
int i;
- for (i = 2; i < 6 && len > i; i++)
+ for (i = 2; i < 5 && len > i; i++)
{
if (name[len - i] == '.')
{
@@ -823,8 +823,8 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
{
if (opts_set->x_flag_reorder_blocks_and_partition)
inform (loc,
- "-freorder-blocks-and-partition does not work "
- "with exceptions on this architecture");
+ "%<-freorder-blocks-and-partition%> does not work "
+ "with exceptions on this architecture");
opts->x_flag_reorder_blocks_and_partition = 0;
opts->x_flag_reorder_blocks = 1;
}
@@ -839,8 +839,8 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
{
if (opts_set->x_flag_reorder_blocks_and_partition)
inform (loc,
- "-freorder-blocks-and-partition does not support "
- "unwind info on this architecture");
+ "%<-freorder-blocks-and-partition%> does not support "
+ "unwind info on this architecture");
opts->x_flag_reorder_blocks_and_partition = 0;
opts->x_flag_reorder_blocks = 1;
}
@@ -857,8 +857,8 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
{
if (opts_set->x_flag_reorder_blocks_and_partition)
inform (loc,
- "-freorder-blocks-and-partition does not work "
- "on this architecture");
+ "%<-freorder-blocks-and-partition%> does not work "
+ "on this architecture");
opts->x_flag_reorder_blocks_and_partition = 0;
opts->x_flag_reorder_blocks = 1;
}
@@ -895,7 +895,8 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
&& !opts->x_flag_use_linker_plugin)))
{
if (opts_set->x_flag_fat_lto_objects)
- error_at (loc, "-fno-fat-lto-objects are supported only with linker plugin");
+ error_at (loc, "%<-fno-fat-lto-objects%> are supported only with "
+ "linker plugin");
opts->x_flag_fat_lto_objects = 1;
}
}
@@ -954,26 +955,26 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
if ((opts->x_flag_sanitize & SANITIZE_USER_ADDRESS)
&& (opts->x_flag_sanitize & SANITIZE_KERNEL_ADDRESS))
error_at (loc,
- "-fsanitize=address is incompatible with "
- "-fsanitize=kernel-address");
+ "%<-fsanitize=address%> is incompatible with "
+ "%<-fsanitize=kernel-address%>");
/* And with TSan. */
if ((opts->x_flag_sanitize & SANITIZE_ADDRESS)
&& (opts->x_flag_sanitize & SANITIZE_THREAD))
error_at (loc,
- "-fsanitize=address and -fsanitize=kernel-address "
- "are incompatible with -fsanitize=thread");
+ "%<-fsanitize=address%> and %<-fsanitize=kernel-address%> "
+ "are incompatible with %<-fsanitize=thread%>");
if ((opts->x_flag_sanitize & SANITIZE_LEAK)
&& (opts->x_flag_sanitize & SANITIZE_THREAD))
error_at (loc,
- "-fsanitize=leak is incompatible with -fsanitize=thread");
+ "%<-fsanitize=leak%> is incompatible with %<-fsanitize=thread%>");
/* Check error recovery for -fsanitize-recover option. */
for (int i = 0; sanitizer_opts[i].name != NULL; ++i)
if ((opts->x_flag_sanitize_recover & sanitizer_opts[i].flag)
&& !sanitizer_opts[i].can_recover)
- error_at (loc, "-fsanitize-recover=%s is not supported",
+ error_at (loc, "%<-fsanitize-recover=%s%> is not supported",
sanitizer_opts[i].name);
/* When instrumenting the pointers, we don't want to remove
@@ -999,11 +1000,18 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
if (opts->x_flag_stack_reuse != SR_NONE
&& opts_set->x_flag_stack_reuse != SR_NONE)
error_at (loc,
- "-fsanitize-address-use-after-scope requires "
- "-fstack-reuse=none option");
+ "%<-fsanitize-address-use-after-scope%> requires "
+ "%<-fstack-reuse=none%> option");
opts->x_flag_stack_reuse = SR_NONE;
}
+
+ if ((opts->x_flag_sanitize & SANITIZE_USER_ADDRESS) && opts->x_flag_tm)
+ sorry ("transactional memory is not supported with %<-fsanitize=address%>");
+
+ if ((opts->x_flag_sanitize & SANITIZE_KERNEL_ADDRESS) && opts->x_flag_tm)
+ sorry ("transactional memory is not supported with "
+ "%<-fsanitize=kernel-address%>");
}
#define LEFT_COLUMN 27
@@ -1253,6 +1261,15 @@ print_filtered_help (unsigned int include_flags,
help = new_help;
}
+ if (option->range_max != -1)
+ {
+ char b[128];
+ snprintf (b, sizeof (b), "<%d,%d>", option->range_min,
+ option->range_max);
+ opt = concat (opt, b, NULL);
+ len += strlen (b);
+ }
+
wrap_help (help, opt, len, columns);
displayed = true;
@@ -1504,6 +1521,7 @@ const struct sanitizer_opts_s sanitizer_opts[] =
true),
SANITIZER_OPT (object-size, SANITIZE_OBJECT_SIZE, true),
SANITIZER_OPT (vptr, SANITIZE_VPTR, true),
+ SANITIZER_OPT (pointer-overflow, SANITIZE_POINTER_OVERFLOW, true),
SANITIZER_OPT (all, ~0U, true),
#undef SANITIZER_OPT
{ NULL, 0U, 0UL, false }
@@ -1604,7 +1622,7 @@ parse_sanitizer_options (const char *p, location_t loc, int scode,
if (code == OPT_fsanitize_)
{
if (complain)
- error_at (loc, "-fsanitize=all option is not valid");
+ error_at (loc, "%<-fsanitize=all%> option is not valid");
}
else
flags |= ~(SANITIZE_THREAD | SANITIZE_LEAK
@@ -1900,6 +1918,9 @@ common_handle_option (struct gcc_options *opts,
opts_set->x_param_values);
maybe_set_param_value (PARAM_ASAN_STACK, 0, opts->x_param_values,
opts_set->x_param_values);
+ maybe_set_param_value (PARAM_ASAN_PROTECT_ALLOCAS, 0,
+ opts->x_param_values,
+ opts_set->x_param_values);
maybe_set_param_value (PARAM_ASAN_USE_AFTER_RETURN, 0,
opts->x_param_values,
opts_set->x_param_values);
@@ -2115,7 +2136,7 @@ common_handle_option (struct gcc_options *opts,
#ifndef ACCEL_COMPILER
case OPT_foffload_abi_:
- error_at (loc, "-foffload-abi option can be specified only for "
+ error_at (loc, "%<-foffload-abi%> option can be specified only for "
"offload compiler");
break;
#endif
@@ -2187,6 +2208,33 @@ common_handle_option (struct gcc_options *opts,
opts->x_flag_ipa_reference = false;
break;
+ case OPT_fpatchable_function_entry_:
+ {
+ char *patch_area_arg = xstrdup (arg);
+ char *comma = strchr (patch_area_arg, ',');
+ if (comma)
+ {
+ *comma = '\0';
+ function_entry_patch_area_size =
+ integral_argument (patch_area_arg);
+ function_entry_patch_area_start =
+ integral_argument (comma + 1);
+ }
+ else
+ {
+ function_entry_patch_area_size =
+ integral_argument (patch_area_arg);
+ function_entry_patch_area_start = 0;
+ }
+ if (function_entry_patch_area_size < 0
+ || function_entry_patch_area_start < 0
+ || function_entry_patch_area_size
+ < function_entry_patch_area_start)
+ error ("invalid arguments for %<-fpatchable_function_entry%>");
+ free (patch_area_arg);
+ }
+ break;
+
case OPT_ftree_vectorize:
if (!opts_set->x_flag_tree_loop_vectorize)
opts->x_flag_tree_loop_vectorize = value;