+2019-11-11 Claudiu Zissulescu <claziss@gmail.com>
+
+ * config/arc/arc.c (arc_legitimize_pic_address): Consider UNSPECs
+ as well, if interesting recover the symbol and re-legitimize the
+ pic address.
+
2019-11-11 Martin Liska <mliska@suse.cz>
* dbgcnt.def (DEBUG_COUNTER): Sort counters
switch (GET_CODE (addr))
{
+ case UNSPEC:
+ /* Can be one or our GOT or GOTOFFPC unspecs. This situation
+ happens when an address is not a legitimate constant and we
+ need the resolve it via force_reg in
+ prepare_move_operands. */
+ switch (XINT (addr, 1))
+ {
+ case ARC_UNSPEC_GOT:
+ case ARC_UNSPEC_GOTOFFPC:
+ /* Recover the symbol ref. */
+ addr = XVECEXP (addr, 0, 0);
+ break;
+ default:
+ return addr;
+ }
+ /* Fall through. */
case SYMBOL_REF:
/* TLS symbols are handled in different place. */
if (SYMBOL_REF_TLS_MODEL (addr))
+2019-11-11 Claudiu Zissulescu <claziss@gmail.com>
+
+ * gcc.target/arc/pic-2.c: New file.
+
2019-11-11 Tobias Burnus <tobias@codesourcery.com>
Mark Eggleston <mark.eggleston@codethink.com>
--- /dev/null
+/* { dg-do compile } */
+/* { dg-skip-if "PIC not available for ARC6xx" { arc6xx } } */
+/* { dg-options "-mno-sdata -O2 -fpic -fno-builtin" } */
+
+/* Check if we resolve correctly complex PIC addresses. */
+
+char *foo (unsigned size)
+{
+ static char buf[32];
+ register int i;
+
+ if (size > 31)
+ size = 31;
+
+ for (i = 0; i < size; i++)
+ {
+ buf[i] = ' ';
+ }
+ buf[size] = '\0';
+ return buf;
+}
+
+/* { dg-final { scan-assembler "@buf.\[0-9\]\+@pcl-1" } } */