https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82725

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Well, r58383 only allowed some exceptions that would be otherwise rejected
before.
If we want to handle for ntpoff symbol + small offset, then I think we need to
handle it in legitimate_pic_address_disp_p instead.  We have there:
15148     if (TARGET_64BIT)
15149       {
15150         /* We are unsafe to allow PLUS expressions.  This limit allowed
distance
15151            of GOT tables.  We should not need these anyway.  */
15152         if (GET_CODE (disp) != UNSPEC
15153             || (XINT (disp, 1) != UNSPEC_GOTPCREL
15154                 && XINT (disp, 1) != UNSPEC_GOTOFF
15155                 && XINT (disp, 1) != UNSPEC_PCREL
15156                 && XINT (disp, 1) != UNSPEC_PLTOFF))
15157           return false;
15158   
15159         if (GET_CODE (XVECEXP (disp, 0, 0)) != SYMBOL_REF
15160             && GET_CODE (XVECEXP (disp, 0, 0)) != LABEL_REF)
15161           return false;
15162         return true;
15163       }

and for 32-bit target fall through and handle plus and then UNSPEC_DTPOFF and
UNSPEC_NTPOFF with offsets.
Wonder if offsets other than signed 32-bit are valid and assembler/linker will
deal with them though, something like:
extern __thread int a[];
int *
foo (void)
{
  return &a[0x200000000];
}

Reply via email to