[PATCH][PR target/94542]Don't allow PC-relative addressing for TLS data
Segher Boessenkool
segher@kernel.crashing.org
Tue Apr 14 10:01:31 GMT 2020
Hi!
On Fri, Apr 10, 2020 at 06:00:45PM -0500, acsawdey wrote:
> One of the things that address_to_insn_form() is used for is determining
> whether a PC-relative addressing instruction could be used. In
> particular predicate pcrel_external_address and function
> prefixed_paddi_p() both use it for this purpose. So what emerged in
> PR/94542 is that it should be looking to see if the associated
> symbol_ref is a TLS symbol of some kind. TLS symbols cannot be addressed
> with PC-relative. This patch fixes both places in address_to_insn_form()
> where it is looking at a symbol_ref.
> 2020-04-10 Aaron Sawdey <acsawdey@linux.ibm.com>
>
> PR target/94542
> * config/rs6000/rs6000.c (address_to_insn_form): Do not attempt to
> use PC-relative addressing for TLS references.
> diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
> index 2b6613bcb7e..c77e60a718f 100644
> --- a/gcc/config/rs6000/rs6000.c
> +++ b/gcc/config/rs6000/rs6000.c
> @@ -24824,15 +24824,21 @@ address_to_insn_form (rtx addr,
> if (GET_RTX_CLASS (GET_CODE (addr)) == RTX_AUTOINC)
> return INSN_FORM_UPDATE;
>
> - /* Handle PC-relative symbols and labels. Check for both local and external
> - symbols. Assume labels are always local. */
> + /* Handle PC-relative symbols and labels. Check for both local and
> + external symbols. Assume labels are always local. TLS symbols
> + are not PC-relative. */
(Two spaces after dot).
As Will says, "... for rs6000." won't hurt.
Okay for trunk. Thanks!
Segher
More information about the Gcc-patches
mailing list