[Re-sending in plain text-mode, sorry for the duplicates] Hi,
In PR91749, we have ICEs because -mflip-thumb switches to Thumb-1 (the default target cpu does not support Thumb-2). Although we already filter this in arm_configure_build_target, we forgot to handle cases when the mode is changed via attributes (either in the source code, or via -mflip-thumb). This patch adds the same error message when trying to apply the "thumb" attribute and the target does not support Thumb-2 (only if we are in FDPIC mode, of course). OK? Thanks, Christophe
gcc/ChangeLog: 2019-09-16 Christophe Lyon <christophe.l...@linaro.org> PR target/91749 * config/arm/arm.c (arm_valid_target_attribute_rec): Make sure the mode attributed is supported by FDPIC.
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index c452771..ceabe0a 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -31175,7 +31175,11 @@ arm_valid_target_attribute_rec (tree args, struct gcc_options *opts) { argstr = NULL; if (!strcmp (q, "thumb")) - opts->x_target_flags |= MASK_THUMB; + { + opts->x_target_flags |= MASK_THUMB; + if (TARGET_FDPIC && !arm_arch_thumb2) + sorry ("FDPIC mode is not supported in Thumb-1 mode"); + } else if (!strcmp (q, "arm")) opts->x_target_flags &= ~MASK_THUMB;