https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89290
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Uroš Bizjak from comment #3) > This address should be valid: > > (const:DI (plus:DI (unspec:DI [ > (symbol_ref:DI ("s") [flags 0x2a] <var_decl 0x7f1b48c08b40 > s>) > ] UNSPEC_NTPOFF) > (const_int 8 [0x8]))) > > and there is code that allows this form in ix86_legitimate_address_p: > > /* foo@dtpoff(%rX) is ok. */ > if (GET_CODE (disp) != CONST > || GET_CODE (XEXP (disp, 0)) != PLUS > || GET_CODE (XEXP (XEXP (disp, 0), 0)) != UNSPEC > || !CONST_INT_P (XEXP (XEXP (disp, 0), 1)) > || (XINT (XEXP (XEXP (disp, 0), 0), 1) != UNSPEC_DTPOFF > && XINT (XEXP (XEXP (disp, 0), 0), 1) != UNSPEC_NTPOFF)) > /* Non-constant pic memory reference. */ > return false; > > Jakub, can you maybe look into this issue? I will, probably by looking at why it works fine without -mcmodel=large, because in that case it generates those CONSTs with PLUS, UNSPEC_NTPOFF and CONST_INT offset.