Skip to content

Commit

Permalink
[ARC] Backport ix emitting TLS symbols.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-9-branch@273658 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
claziss committed Jul 22, 2019
1 parent 2cd79ab commit 869e468
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 1 deletion.
6 changes: 6 additions & 0 deletions gcc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2019-07-22 Claudiu Zissulescu <claziss@synopsys.com>

Backport from mainline.
* config/arc/arc.c (prepare_move_operands): Always use an
intermediate register when storing a TLS symbols.

2019-07-20 Richard Sandiford <richard.sandiford@arm.com>

Backport from mainline
Expand Down
2 changes: 1 addition & 1 deletion gcc/config/arc/arc.c
Original file line number Diff line number Diff line change
Expand Up @@ -8951,7 +8951,7 @@ prepare_move_operands (rtx *operands, machine_mode mode)
if (GET_CODE (operands[1]) == SYMBOL_REF)
{
enum tls_model model = SYMBOL_REF_TLS_MODEL (operands[1]);
if (MEM_P (operands[0]) && flag_pic)
if (MEM_P (operands[0]))
operands[1] = force_reg (mode, operands[1]);
else if (model)
operands[1] = arc_legitimize_tls_address (operands[1], model);
Expand Down
6 changes: 6 additions & 0 deletions gcc/testsuite/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2019-07-22 Claudiu Zissulescu <claziss@synopsys.com>

Backport from mainline
* gcc.target/arc/tls-2.c: New test.
* gcc.target/arc/tls-3.c: Likewise.

2019-07-20 Richard Sandiford <richard.sandiford@arm.com>

Backport from mainline
Expand Down
14 changes: 14 additions & 0 deletions gcc/testsuite/gcc.target/arc/tls-2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* { dg-do compile } */
/* { dg-require-effective-target tls } */
/* { dg-skip-if "" { arc*-*-elf* } } */
/* { dg-options "-O2" } */

typedef int type_a;
__thread int b;
int c;

extern int bar (char *, int, int *, int, int *, char, type_a, int *, int *);
int foo (int *f, char buffer, type_a buflen, int *g)
{
bar("", c, (int *)foo, 1, (int *)f, buffer, buflen, (int *)g, &b);
}
19 changes: 19 additions & 0 deletions gcc/testsuite/gcc.target/arc/tls-3.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* { dg-do compile } */
/* { dg-require-effective-target tls } */
/* { dg-skip-if "" { arc*-*-elf* } } */
/* { dg-options "-Os -fPIC" } */


typedef struct
{
int(a);
char b[];
} type_c;


extern int bar (char *, int, char *);
static _Thread_local type_c d;
int foo(void)
{
bar(d.b, 0, d.b);
}

0 comments on commit 869e468

Please sign in to comment.