@@ -9272,7 +9272,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);
new file mode 100644
@@ -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);
+}
new file mode 100644
@@ -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);
+}