i386.c (legitimate_pic_address_disp_p): Disallow TLS SYMBOL_REFs not inside UNSPEC even in PLUS rtx.
* config/i386/i386.c (legitimate_pic_address_disp_p): Disallow TLS SYMBOL_REFs not inside UNSPEC even in PLUS rtx. * gcc.dg/tls/opt-7.c: New test. From-SVN: r70022
This commit is contained in:
parent
d759e96dc1
commit
a132b6a818
4 changed files with 39 additions and 9 deletions
|
@ -1,3 +1,8 @@
|
|||
2003-07-31 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* config/i386/i386.c (legitimate_pic_address_disp_p): Disallow TLS
|
||||
SYMBOL_REFs not inside UNSPEC even in PLUS rtx.
|
||||
|
||||
2003-07-31 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
|
||||
|
||||
* dwarf2out.c (loc_descriptor_from_tree, case CONSTRUCTOR): New case.
|
||||
|
|
|
@ -5661,15 +5661,23 @@ legitimate_pic_address_disp_p (register rtx disp)
|
|||
if (GET_CODE (disp) == LABEL_REF)
|
||||
return 1;
|
||||
if (GET_CODE (disp) == CONST
|
||||
&& GET_CODE (XEXP (disp, 0)) == PLUS
|
||||
&& ((GET_CODE (XEXP (XEXP (disp, 0), 0)) == SYMBOL_REF
|
||||
&& ix86_cmodel == CM_SMALL_PIC
|
||||
&& SYMBOL_REF_LOCAL_P (XEXP (XEXP (disp, 0), 0)))
|
||||
|| GET_CODE (XEXP (XEXP (disp, 0), 0)) == LABEL_REF)
|
||||
&& GET_CODE (XEXP (XEXP (disp, 0), 1)) == CONST_INT
|
||||
&& INTVAL (XEXP (XEXP (disp, 0), 1)) < 16*1024*1024
|
||||
&& INTVAL (XEXP (XEXP (disp, 0), 1)) >= -16*1024*1024)
|
||||
return 1;
|
||||
&& GET_CODE (XEXP (disp, 0)) == PLUS)
|
||||
{
|
||||
rtx op0 = XEXP (XEXP (disp, 0), 0);
|
||||
rtx op1 = XEXP (XEXP (disp, 0), 1);
|
||||
|
||||
/* TLS references should always be enclosed in UNSPEC. */
|
||||
if (tls_symbolic_operand (op0, GET_MODE (op0)))
|
||||
return 0;
|
||||
if (((GET_CODE (op0) == SYMBOL_REF
|
||||
&& ix86_cmodel == CM_SMALL_PIC
|
||||
&& SYMBOL_REF_LOCAL_P (op0))
|
||||
|| GET_CODE (op0) == LABEL_REF)
|
||||
&& GET_CODE (op1) == CONST_INT
|
||||
&& INTVAL (op1) < 16*1024*1024
|
||||
&& INTVAL (op1) >= -16*1024*1024)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (GET_CODE (disp) != CONST)
|
||||
return 0;
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2003-07-31 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* gcc.dg/tls/opt-7.c: New test.
|
||||
|
||||
2003-07-31 Andrew Pinski <pinskia@physics.uc.edu>
|
||||
|
||||
* g++.old-deja/g++.other/crash18.C: Remove.
|
||||
|
|
13
gcc/testsuite/gcc.dg/tls/opt-7.c
Normal file
13
gcc/testsuite/gcc.dg/tls/opt-7.c
Normal file
|
@ -0,0 +1,13 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -fPIC" } */
|
||||
|
||||
static __thread void *baz [4] __attribute__((tls_model ("initial-exec")));
|
||||
void foo (void)
|
||||
{
|
||||
void **u = (void **) baz;
|
||||
|
||||
u[0] = 0;
|
||||
u[1] = 0;
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler-not "\[48\]\\+baz" { target i?86-*-* x86_64-*-* } } } */
|
Loading…
Add table
Reference in a new issue