Hi! The following patch on top of the https://gcc.gnu.org/pipermail/gcc-patches/2020-September/553801.html patch fixes the gcc.target/arm/lto/pr96939_* test in certain ARM configurations. As said in the above mentioned patch, the generic code takes care of saving/restoring TargetVariables or Target Save options, so this just arranges for the generic code to save those instead of needing the arm backend to do it manually.
Bootstrapped/regtested on armv7hl-linux-gnueabi, ok for trunk? 2020-09-13 Jakub Jelinek <ja...@redhat.com> * config/arm/arm.opt (x_arm_arch_string, x_arm_cpu_string, x_arm_tune_string): Remove TargetSave entries. (march=, mcpu=, mtune=): Add Save keyword. * config/arm/arm.c (arm_option_save): Remove. (TARGET_OPTION_SAVE): Don't redefine. (arm_option_restore): Don't restore x_arm_*_string here. --- gcc/config/arm/arm.opt.jj 2020-01-12 11:54:36.273415521 +0100 +++ gcc/config/arm/arm.opt 2020-09-12 10:45:51.239935884 +0200 @@ -21,15 +21,6 @@ HeaderInclude config/arm/arm-opts.h -TargetSave -const char *x_arm_arch_string - -TargetSave -const char *x_arm_cpu_string - -TargetSave -const char *x_arm_tune_string - Enum Name(tls_type) Type(enum arm_tls_type) TLS dialect to use: @@ -82,7 +73,7 @@ mapcs-stack-check Target Report Mask(APCS_STACK) Undocumented march= -Target RejectNegative Negative(march=) ToLower Joined Var(arm_arch_string) +Target Save RejectNegative Negative(march=) ToLower Joined Var(arm_arch_string) Specify the name of the target architecture. ; Other arm_arch values are loaded from arm-tables.opt @@ -107,7 +98,7 @@ Target Report Mask(CALLER_INTERWORKING) Thumb: Assume function pointers may go to non-Thumb aware code. mcpu= -Target RejectNegative Negative(mcpu=) ToLower Joined Var(arm_cpu_string) +Target Save RejectNegative Negative(mcpu=) ToLower Joined Var(arm_cpu_string) Specify the name of the target CPU. mfloat-abi= @@ -232,7 +223,7 @@ Target Report Mask(TPCS_LEAF_FRAME) Thumb: Generate (leaf) stack frames even if not needed. mtune= -Target RejectNegative Negative(mtune=) ToLower Joined Var(arm_tune_string) +Target Save RejectNegative Negative(mtune=) ToLower Joined Var(arm_tune_string) Tune code for the given processor. mprint-tune-info --- gcc/config/arm/arm.c.jj 2020-09-11 17:44:28.643014087 +0200 +++ gcc/config/arm/arm.c 2020-09-12 10:48:09.951888347 +0200 @@ -247,8 +247,6 @@ static tree arm_build_builtin_va_list (v static void arm_expand_builtin_va_start (tree, rtx); static tree arm_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *); static void arm_option_override (void); -static void arm_option_save (struct cl_target_option *, struct gcc_options *, - struct gcc_options *); static void arm_option_restore (struct gcc_options *, struct gcc_options *, struct cl_target_option *); static void arm_override_options_after_change (void); @@ -443,9 +441,6 @@ static const struct attribute_spec arm_a #undef TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE #define TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE arm_override_options_after_change -#undef TARGET_OPTION_SAVE -#define TARGET_OPTION_SAVE arm_option_save - #undef TARGET_OPTION_RESTORE #define TARGET_OPTION_RESTORE arm_option_restore @@ -3042,24 +3037,11 @@ arm_override_options_after_change (void) arm_override_options_after_change_1 (&global_options, &global_options_set); } -/* Implement TARGET_OPTION_SAVE. */ -static void -arm_option_save (struct cl_target_option *ptr, struct gcc_options *opts, - struct gcc_options */* opts_set */) -{ - ptr->x_arm_arch_string = opts->x_arm_arch_string; - ptr->x_arm_cpu_string = opts->x_arm_cpu_string; - ptr->x_arm_tune_string = opts->x_arm_tune_string; -} - /* Implement TARGET_OPTION_RESTORE. */ static void arm_option_restore (struct gcc_options *opts, struct gcc_options *opts_set, struct cl_target_option *ptr) { - opts->x_arm_arch_string = ptr->x_arm_arch_string; - opts->x_arm_cpu_string = ptr->x_arm_cpu_string; - opts->x_arm_tune_string = ptr->x_arm_tune_string; arm_configure_build_target (&arm_active_target, ptr, opts_set, false); } Jakub