aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf32-tic6x.c48
-rw-r--r--gas/ChangeLog10
-rw-r--r--gas/config/tc-tic6x.c95
-rw-r--r--gas/config/tc-tic6x.h3
-rw-r--r--gas/testsuite/ChangeLog9
-rw-r--r--gas/testsuite/gas/tic6x/pcr-relocs-undef.d4
-rw-r--r--gas/testsuite/gas/tic6x/pcr-relocs-undef.s3
-rw-r--r--gas/testsuite/gas/tic6x/pcr-relocs.d31
-rw-r--r--gas/testsuite/gas/tic6x/pcr-relocs.s25
-rw-r--r--gas/testsuite/gas/tic6x/reloc-bad-2.l279
-rw-r--r--gas/testsuite/gas/tic6x/reloc-bad-2.s24
-rw-r--r--ld/testsuite/ChangeLog5
-rw-r--r--ld/testsuite/ld-tic6x/pcr-reloc.d39
-rw-r--r--ld/testsuite/ld-tic6x/pcr-reloc.s28
15 files changed, 473 insertions, 136 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b9a0473..7cdd215 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2011-05-20 Bernd Schmidt <bernds@codesourcery.com>
+
+ * elf32-tic6x.c (elf32_tic6x_howto_table): Add entries for
+ R_C6000_PCR_H16 and R_C6000_PCR_L16.
+ (elf32_tic6x_relocate_section): Handle them.
+
2011-05-18 Nick Clifton <nickc@redhat.com>
PR ld/12761
diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c
index efacfb9..9b2b0f0 100644
--- a/bfd/elf32-tic6x.c
+++ b/bfd/elf32-tic6x.c
@@ -528,8 +528,32 @@ static reloc_howto_type elf32_tic6x_howto_table[] =
0, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
- EMPTY_HOWTO (29),
- EMPTY_HOWTO (30),
+ HOWTO (R_C6000_PCR_H16, /* type */
+ 16, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ TRUE, /* pc_relative */
+ 7, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_C6000_PCR_H16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x007fff80, /* dst_mask */
+ TRUE), /* pcrel_offset */
+ HOWTO (R_C6000_PCR_L16, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ TRUE, /* pc_relative */
+ 7, /* bitpos */
+ complain_overflow_dont,/* complain_on_overflow */
+ bfd_elf_generic_reloc, /* special_function */
+ "R_C6000_PCR_L16", /* name */
+ FALSE, /* partial_inplace */
+ 0, /* src_mask */
+ 0x007fff80, /* dst_mask */
+ TRUE), /* pcrel_offset */
EMPTY_HOWTO (31),
EMPTY_HOWTO (32),
EMPTY_HOWTO (33),
@@ -1112,8 +1136,8 @@ static reloc_howto_type elf32_tic6x_howto_table_rel[] =
0, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
- EMPTY_HOWTO (29),
- EMPTY_HOWTO (30),
+ EMPTY_HOWTO (R_C6000_PCR_H16),
+ EMPTY_HOWTO (R_C6000_PCR_L16),
EMPTY_HOWTO (31),
EMPTY_HOWTO (32),
EMPTY_HOWTO (33),
@@ -2264,7 +2288,7 @@ elf32_tic6x_relocate_section (bfd *output_bfd,
Elf_Internal_Sym *sym;
asection *sec;
struct elf_link_hash_entry *h;
- bfd_vma off, relocation;
+ bfd_vma off, off2, relocation;
bfd_boolean unresolved_reloc;
bfd_reloc_status_type r;
struct bfd_link_hash_entry *sbh;
@@ -2378,6 +2402,20 @@ elf32_tic6x_relocate_section (bfd *output_bfd,
unresolved_reloc = FALSE;
break;
+ case R_C6000_PCR_H16:
+ case R_C6000_PCR_L16:
+ off = (input_section->output_section->vma
+ + input_section->output_offset
+ + rel->r_offset);
+ /* These must be calculated as R = S - FP(FP(PC) - A).
+ PC, here, is the value we just computed in OFF. RELOCATION
+ has the address of S + A. */
+ relocation -= rel->r_addend;
+ off2 = ((off & ~(bfd_vma)0x1f) - rel->r_addend) & (bfd_vma)~0x1f;
+ off2 = relocation - off2;
+ relocation = off + off2;
+ break;
+
case R_C6000_DSBT_INDEX:
relocation = elf32_tic6x_hash_table (info)->params.dsbt_index;
if (!info->shared || relocation != 0)
diff --git a/gas/ChangeLog b/gas/ChangeLog
index a732657..f7d0444 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,13 @@
+2011-05-20 Bernd Schmidt <bernds@codesourcery.com>
+
+ * config/tc-tic6x.c (tic6x_operators): Add "pcr_offset".
+ (tic6x_parse_name): Handle it.
+ (tic6x_fix_new_exp): Handle O_pcr_offset.
+ (tic6x_fix_adjustable): Return 0 for the new relocs.
+ (md_apply_fix): Handle them.
+ (tc_gen_reloc): Likewise.
+ * config/tc-tic6x.h (tic6x_fix_info): Add a fix_subsy member.
+
2011-05-18 Nick Clifton <nickc@redhat.com>
PR gas/12754
diff --git a/gas/config/tc-tic6x.c b/gas/config/tc-tic6x.c
index 73bea63..017254a 100644
--- a/gas/config/tc-tic6x.c
+++ b/gas/config/tc-tic6x.c
@@ -1738,6 +1738,8 @@ static const tic6x_operator_table tic6x_operators[] = {
{ "dpr_hword", O_dpr_hword },
#define O_dpr_word O_md6
{ "dpr_word", O_dpr_word },
+#define O_pcr_offset O_md7
+ { "pcr_offset", O_pcr_offset }
};
/* Parse a name in some machine-specific way. Used on C6X to handle
@@ -1752,7 +1754,7 @@ tic6x_parse_name (const char *name, expressionS *exprP,
const char *inner_name;
unsigned int i;
operatorT op = O_illegal;
- symbolS *sym;
+ symbolS *sym, *op_sym = NULL;
if (*name != '$')
return 0;
@@ -1791,6 +1793,37 @@ tic6x_parse_name (const char *name, expressionS *exprP,
name_end = p;
skip_whitespace (p);
+ if (op == O_pcr_offset)
+ {
+ char *op_name_start, *op_name_end;
+
+ if (*p != ',')
+ {
+ *input_line_pointer = 0;
+ return 0;
+ }
+ p++;
+ skip_whitespace (p);
+
+ if (!is_name_beginner (*p))
+ {
+ *input_line_pointer = 0;
+ return 0;
+ }
+
+ op_name_start = p;
+ p++;
+ while (is_part_of_name (*p))
+ p++;
+ op_name_end = p;
+ skip_whitespace (p);
+
+ c = *op_name_end;
+ *op_name_end = 0;
+ op_sym = symbol_find_or_make (op_name_start);
+ *op_name_end = c;
+ }
+
if (*p != ')')
{
*input_line_pointer = 0;
@@ -1815,7 +1848,7 @@ tic6x_parse_name (const char *name, expressionS *exprP,
exprP->X_op = op;
exprP->X_add_symbol = sym;
exprP->X_add_number = 0;
- exprP->X_op_symbol = NULL;
+ exprP->X_op_symbol = op_sym;
exprP->X_md = 0;
return 1;
@@ -1833,6 +1866,7 @@ tic6x_fix_new_exp (fragS *frag, int where, int size, expressionS *exp,
bfd_boolean fix_adda)
{
bfd_reloc_code_real_type new_reloc = BFD_RELOC_UNUSED;
+ symbolS *subsy = NULL;
fixS *fix;
switch (exp->X_op)
@@ -1935,6 +1969,25 @@ tic6x_fix_new_exp (fragS *frag, int where, int size, expressionS *exp,
}
break;
+ case O_pcr_offset:
+ subsy = exp->X_op_symbol;
+ switch (r_type)
+ {
+ case BFD_RELOC_C6000_ABS_S16:
+ case BFD_RELOC_C6000_ABS_L16:
+ new_reloc = BFD_RELOC_C6000_PCR_L16;
+ break;
+
+ case BFD_RELOC_C6000_ABS_H16:
+ new_reloc = BFD_RELOC_C6000_PCR_H16;
+ break;
+
+ default:
+ as_bad (_("$PCR_OFFSET not supported in this context"));
+ return;
+ }
+ break;
+
case O_symbol:
break;
@@ -1952,6 +2005,7 @@ tic6x_fix_new_exp (fragS *frag, int where, int size, expressionS *exp,
else
fix = fix_new (frag, where, size, exp->X_add_symbol, exp->X_add_number,
pcrel, new_reloc);
+ fix->tc_fix_data.fix_subsy = subsy;
fix->tc_fix_data.fix_adda = fix_adda;
}
@@ -1991,6 +2045,7 @@ void
tic6x_init_fix_data (fixS *fixP)
{
fixP->tc_fix_data.fix_adda = FALSE;
+ fixP->tc_fix_data.fix_subsy = NULL;
}
/* Return true if the fix can be handled by GAS, false if it must
@@ -2011,6 +2066,10 @@ tic6x_fix_adjustable (fixS *fixP)
case BFD_RELOC_C6000_PREL31:
return 0;
+ case BFD_RELOC_C6000_PCR_H16:
+ case BFD_RELOC_C6000_PCR_L16:
+ return 0;
+
default:
return 1;
}
@@ -3823,6 +3882,19 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
abort ();
break;
+ case BFD_RELOC_C6000_PCR_H16:
+ case BFD_RELOC_C6000_PCR_L16:
+ if (fixP->fx_done || !seg->use_rela_p)
+ {
+ offsetT newval = md_chars_to_number (buf, 4);
+ int shift = fixP->fx_r_type == BFD_RELOC_C6000_PCR_H16 ? 16 : 0;
+
+ MODIFY_VALUE (newval, value, shift, 7, 16);
+
+ md_number_to_chars (buf, newval, 4);
+ }
+ break;
+
case BFD_RELOC_C6000_SBR_U15_B:
if (fixP->fx_done || !seg->use_rela_p)
{
@@ -4437,7 +4509,24 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
if (!bfd_is_com_section (symbol))
reloc->addend -= symbol->value;
}
-
+ if (r_type == BFD_RELOC_C6000_PCR_H16
+ || r_type == BFD_RELOC_C6000_PCR_L16)
+ {
+ symbolS *t = fixp->tc_fix_data.fix_subsy;
+ segT sub_symbol_segment;
+
+ resolve_symbol_value (t);
+ sub_symbol_segment = S_GET_SEGMENT (t);
+ if (sub_symbol_segment == undefined_section)
+ as_bad_where (fixp->fx_file, fixp->fx_line,
+ _("undefined symbol %s in PCR relocation"),
+ S_GET_NAME (t));
+ else
+ {
+ reloc->addend = reloc->address & ~0x1F;
+ reloc->addend -= S_GET_VALUE (t);
+ }
+ }
return reloc;
}
diff --git a/gas/config/tc-tic6x.h b/gas/config/tc-tic6x.h
index ca85968..12bdead 100644
--- a/gas/config/tc-tic6x.h
+++ b/gas/config/tc-tic6x.h
@@ -142,6 +142,9 @@ typedef struct
instruction, whereas a non-constant represents a DP-relative
value counting in the appropriate units). */
bfd_boolean fix_adda;
+ /* The symbol to be subtracted in case of a PCR_H16 or PCR_L16
+ reloc. */
+ symbolS *fix_subsy;
} tic6x_fix_info;
#define TC_FIX_TYPE tic6x_fix_info
#define TC_INIT_FIX_DATA(fixP) tic6x_init_fix_data (fixP)
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index fc8d6e0..949e2f1 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2011-05-20 Bernd Schmidt <bernds@codesourcery.com>
+
+ * gas/tic6x/pcr-relocs.d: New test.
+ * gas/tic6x/pcr-relocs.s: New test.
+ * gas/tic6x/pcr-relocs-undef.d: New test.
+ * gas/tic6x/pcr-relocs-undef.s: New test.
+ * gas/tic6x/reloc-bad-2.s: Update for pcr_offset.
+ * gas/tic6x/reloc-bad-2.l: Update for pcr_offset.
+
2011-05-18 Nick Clifton <nickc@redhat.com>
* gas/arm/req.l: Updated expected warning message.
diff --git a/gas/testsuite/gas/tic6x/pcr-relocs-undef.d b/gas/testsuite/gas/tic6x/pcr-relocs-undef.d
new file mode 100644
index 0000000..26358aa
--- /dev/null
+++ b/gas/testsuite/gas/tic6x/pcr-relocs-undef.d
@@ -0,0 +1,4 @@
+#name: C6X PCR relocs against undefined symbol
+#as:
+#source: pcr-relocs-undef.s
+#error: undefined symbol
diff --git a/gas/testsuite/gas/tic6x/pcr-relocs-undef.s b/gas/testsuite/gas/tic6x/pcr-relocs-undef.s
new file mode 100644
index 0000000..bb08e7a
--- /dev/null
+++ b/gas/testsuite/gas/tic6x/pcr-relocs-undef.s
@@ -0,0 +1,3 @@
+ .text
+ .align 5
+ mvk .s2 $PCR_OFFSET (S0,L1), b2
diff --git a/gas/testsuite/gas/tic6x/pcr-relocs.d b/gas/testsuite/gas/tic6x/pcr-relocs.d
new file mode 100644
index 0000000..893def2
--- /dev/null
+++ b/gas/testsuite/gas/tic6x/pcr-relocs.d
@@ -0,0 +1,31 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: C6X PCR H16/L16 relocs
+#as: -mlittle-endian
+
+.*: *file format elf32-tic6x-le
+
+Disassembly of section \.text:
+0+00 <[^>]*> 00800264[ \t]+ldw \.D1T1 \*\+a0\(0\),a1
+0+04 <[^>]*> 00800264[ \t]+ldw \.D1T1 \*\+a0\(0\),a1
+0+08 <[^>]*> 00800264[ \t]+ldw \.D1T1 \*\+a0\(0\),a1
+0+0c <[^>]*> 004003e2[ \t]+mvc \.S2 pce1,b0
+0+10 <[^>]*> 01000264[ \t]+ldw \.D1T1 \*\+a0\(0\),a2
+0+14 <[^>]*> 0100002a[ \t]+mvk \.S2 0,b2
+[ \t]+14: R_C6000_PCR_L16 S0\+0xfffffff4
+0+18 <[^>]*> 0100006a[ \t]+mvkh \.S2 0,b2
+[ \t]+18: R_C6000_PCR_H16 S0\+0xfffffff4
+0+1c <[^>]*> 0100002a[ \t]+mvk \.S2 0,b2
+[ \t]+1c: R_C6000_PCR_L16 S0\+0xffffffc8
+0+20 <[^>]*> 0100006a[ \t]+mvkh \.S2 0,b2
+[ \t]+20: R_C6000_PCR_H16 S0\+0xffffffe8
+0+24 <[^>]*> 0100002a[ \t]+mvk \.S2 0,b2
+[ \t]+24: R_C6000_PCR_L16 S1\+0x14
+0+28 <[^>]*> 0100006a[ \t]+mvkh \.S2 0,b2
+[ \t]+28: R_C6000_PCR_H16 S1\+0x14
+0+2c <[^>]*> 0100002a[ \t]+mvk \.S2 0,b2
+[ \t]+2c: R_C6000_PCR_L16 S1\+0xffffffe8
+0+30 <[^>]*> 0100006a[ \t]+mvkh \.S2 0,b2
+[ \t]+30: R_C6000_PCR_H16 S1\+0xffffffe8
+0+34 <[^>]*> 00800264[ \t]+ldw \.D1T1 \*\+a0\(0\),a1
+0+38 <[^>]*> 004003e2[ \t]+mvc \.S2 pce1,b0
+0+3c <[^>]*> 00800264[ \t]+ldw \.D1T1 \*\+a0\(0\),a1
diff --git a/gas/testsuite/gas/tic6x/pcr-relocs.s b/gas/testsuite/gas/tic6x/pcr-relocs.s
new file mode 100644
index 0000000..d4e1019
--- /dev/null
+++ b/gas/testsuite/gas/tic6x/pcr-relocs.s
@@ -0,0 +1,25 @@
+ .text
+ .align 5
+L0:
+ ldw .d1t1 *a0,a1
+ ldw .d1t1 *a0,a1
+ ldw .d1t1 *a0,a1
+L1:
+ MVC .s2 PCE1, b0
+ ldw .d1t1 *a0,a2
+ mvk .s2 $PCR_OFFSET (S0,L1), b2
+ mvkh .s2 $PCR_OFFSET (S0,L1), b2
+ mvk .s2 $PCR_OFFSET (S0,L2), b2
+ mvkh .s2 $PCR_OFFSET (S0,L2), b2
+ mvkl .s2 $PCR_OFFSET (S1,L1), b2
+ mvkh .s2 $PCR_OFFSET (S1,L1), b2
+ mvkl .s2 $PCR_OFFSET (S1,L2), b2
+ mvkh .s2 $PCR_OFFSET (S1,L2), b2
+
+S0:
+ ldw .d1t1 *a0,a1
+L2:
+ MVC .s2 PCE1, b0
+
+S1:
+ ldw .d1t1 *a0,a1
diff --git a/gas/testsuite/gas/tic6x/reloc-bad-2.l b/gas/testsuite/gas/tic6x/reloc-bad-2.l
index bfb2548..765912f 100644
--- a/gas/testsuite/gas/tic6x/reloc-bad-2.l
+++ b/gas/testsuite/gas/tic6x/reloc-bad-2.l
@@ -5,145 +5,168 @@
[^:]*:9: Error: \$DPR_BYTE not supported in this context
[^:]*:10: Error: \$DPR_HWORD not supported in this context
[^:]*:11: Error: \$DPR_WORD not supported in this context
-[^:]*:16: Error: \$DSBT_INDEX not supported in this context
-[^:]*:17: Error: \$GOT not supported in this context
-[^:]*:18: Error: \$DPR_GOT not supported in this context
-[^:]*:19: Error: \$DPR_BYTE not supported in this context
-[^:]*:20: Error: \$DPR_HWORD not supported in this context
-[^:]*:21: Error: \$DPR_WORD not supported in this context
-[^:]*:22: Error: \$DSBT_INDEX not supported in this context
-[^:]*:23: Error: \$GOT not supported in this context
-[^:]*:24: Error: \$DPR_GOT not supported in this context
-[^:]*:25: Error: \$DPR_BYTE not supported in this context
-[^:]*:26: Error: \$DPR_HWORD not supported in this context
-[^:]*:27: Error: \$DPR_WORD not supported in this context
-[^:]*:28: Error: \$DPR_GOT not supported in this context
-[^:]*:29: Error: \$DPR_BYTE not supported in this context
-[^:]*:30: Error: \$DPR_HWORD not supported in this context
-[^:]*:31: Error: \$DPR_WORD not supported in this context
-[^:]*:32: Error: \$DSBT_INDEX not supported in this context
-[^:]*:33: Error: \$GOT not supported in this context
-[^:]*:34: Error: \$DPR_GOT not supported in this context
-[^:]*:35: Error: \$DPR_HWORD not supported in this context
-[^:]*:36: Error: \$DPR_WORD not supported in this context
-[^:]*:37: Error: \$DSBT_INDEX not supported in this context
-[^:]*:38: Error: \$GOT not supported in this context
-[^:]*:39: Error: \$DPR_GOT not supported in this context
-[^:]*:40: Error: \$DPR_HWORD not supported in this context
-[^:]*:41: Error: \$DPR_WORD not supported in this context
+[^:]*:12: Error: \$PCR_OFFSET not supported in this context
+[^:]*:17: Error: \$DSBT_INDEX not supported in this context
+[^:]*:18: Error: \$GOT not supported in this context
+[^:]*:19: Error: \$DPR_GOT not supported in this context
+[^:]*:20: Error: \$DPR_BYTE not supported in this context
+[^:]*:21: Error: \$DPR_HWORD not supported in this context
+[^:]*:22: Error: \$DPR_WORD not supported in this context
+[^:]*:23: Error: \$PCR_OFFSET not supported in this context
+[^:]*:24: Error: \$DSBT_INDEX not supported in this context
+[^:]*:25: Error: \$GOT not supported in this context
+[^:]*:26: Error: \$DPR_GOT not supported in this context
+[^:]*:27: Error: \$DPR_BYTE not supported in this context
+[^:]*:28: Error: \$DPR_HWORD not supported in this context
+[^:]*:29: Error: \$DPR_WORD not supported in this context
+[^:]*:30: Error: \$PCR_OFFSET not supported in this context
+[^:]*:31: Error: \$DPR_GOT not supported in this context
+[^:]*:32: Error: \$DPR_BYTE not supported in this context
+[^:]*:33: Error: \$DPR_HWORD not supported in this context
+[^:]*:34: Error: \$DPR_WORD not supported in this context
+[^:]*:35: Error: \$PCR_OFFSET not supported in this context
+[^:]*:36: Error: \$DSBT_INDEX not supported in this context
+[^:]*:37: Error: \$GOT not supported in this context
+[^:]*:38: Error: \$DPR_GOT not supported in this context
+[^:]*:39: Error: \$DPR_HWORD not supported in this context
+[^:]*:40: Error: \$DPR_WORD not supported in this context
[^:]*:42: Error: \$DSBT_INDEX not supported in this context
[^:]*:43: Error: \$GOT not supported in this context
-[^:]*:44: Error: \$DSBT_INDEX not supported in this context
-[^:]*:45: Error: \$GOT not supported in this context
-[^:]*:46: Error: \$DSBT_INDEX not supported in this context
-[^:]*:47: Error: \$GOT not supported in this context
-[^:]*:48: Error: \$DSBT_INDEX not supported in this context
-[^:]*:49: Error: \$GOT not supported in this context
-[^:]*:50: Error: \$DPR_GOT not supported in this context
-[^:]*:51: Error: \$DPR_BYTE not supported in this context
-[^:]*:52: Error: \$DPR_HWORD not supported in this context
-[^:]*:53: Error: \$DPR_WORD not supported in this context
-[^:]*:54: Error: \$DSBT_INDEX not supported in this context
-[^:]*:55: Error: \$GOT not supported in this context
-[^:]*:56: Error: \$DPR_GOT not supported in this context
-[^:]*:57: Error: \$DPR_BYTE not supported in this context
-[^:]*:58: Error: \$DPR_HWORD not supported in this context
-[^:]*:59: Error: \$DPR_WORD not supported in this context
+[^:]*:44: Error: \$DPR_GOT not supported in this context
+[^:]*:45: Error: \$DPR_HWORD not supported in this context
+[^:]*:46: Error: \$DPR_WORD not supported in this context
+[^:]*:47: Error: \$DSBT_INDEX not supported in this context
+[^:]*:48: Error: \$GOT not supported in this context
+[^:]*:49: Error: \$DSBT_INDEX not supported in this context
+[^:]*:50: Error: \$GOT not supported in this context
+[^:]*:51: Error: \$DSBT_INDEX not supported in this context
+[^:]*:52: Error: \$GOT not supported in this context
+[^:]*:53: Error: \$DSBT_INDEX not supported in this context
+[^:]*:54: Error: \$GOT not supported in this context
+[^:]*:55: Error: \$DPR_GOT not supported in this context
+[^:]*:56: Error: \$DPR_BYTE not supported in this context
+[^:]*:57: Error: \$DPR_HWORD not supported in this context
+[^:]*:58: Error: \$DPR_WORD not supported in this context
+[^:]*:59: Error: \$PCR_OFFSET not supported in this context
[^:]*:60: Error: \$DSBT_INDEX not supported in this context
[^:]*:61: Error: \$GOT not supported in this context
[^:]*:62: Error: \$DPR_GOT not supported in this context
[^:]*:63: Error: \$DPR_BYTE not supported in this context
[^:]*:64: Error: \$DPR_HWORD not supported in this context
[^:]*:65: Error: \$DPR_WORD not supported in this context
-[^:]*:66: Error: \$DSBT_INDEX not supported in this context
-[^:]*:67: Error: \$GOT not supported in this context
-[^:]*:68: Error: \$DPR_GOT not supported in this context
-[^:]*:69: Error: \$DPR_BYTE not supported in this context
-[^:]*:70: Error: \$DPR_HWORD not supported in this context
-[^:]*:71: Error: \$DPR_WORD not supported in this context
-[^:]*:72: Error: \$DSBT_INDEX not supported in this context
-[^:]*:73: Error: \$GOT not supported in this context
-[^:]*:74: Error: \$DPR_GOT not supported in this context
-[^:]*:75: Error: \$DPR_BYTE not supported in this context
-[^:]*:76: Error: \$DPR_HWORD not supported in this context
-[^:]*:77: Error: \$DPR_WORD not supported in this context
-[^:]*:78: Error: \$DSBT_INDEX not supported in this context
-[^:]*:79: Error: \$GOT not supported in this context
-[^:]*:80: Error: \$DPR_GOT not supported in this context
-[^:]*:81: Error: \$DPR_BYTE not supported in this context
-[^:]*:82: Error: \$DPR_HWORD not supported in this context
-[^:]*:83: Error: \$DPR_WORD not supported in this context
-[^:]*:84: Error: \$DSBT_INDEX not supported in this context
-[^:]*:85: Error: \$GOT not supported in this context
-[^:]*:86: Error: \$DPR_GOT not supported in this context
-[^:]*:87: Error: \$DPR_BYTE not supported in this context
-[^:]*:88: Error: \$DPR_HWORD not supported in this context
-[^:]*:89: Error: \$DPR_WORD not supported in this context
-[^:]*:90: Error: \$DSBT_INDEX not supported in this context
-[^:]*:91: Error: \$GOT not supported in this context
-[^:]*:92: Error: \$DPR_GOT not supported in this context
-[^:]*:93: Error: \$DPR_BYTE not supported in this context
-[^:]*:94: Error: \$DPR_HWORD not supported in this context
-[^:]*:95: Error: \$DPR_WORD not supported in this context
-[^:]*:96: Error: \$DSBT_INDEX not supported in this context
-[^:]*:97: Error: \$GOT not supported in this context
-[^:]*:98: Error: \$DPR_GOT not supported in this context
-[^:]*:99: Error: \$DPR_BYTE not supported in this context
-[^:]*:100: Error: \$DPR_HWORD not supported in this context
-[^:]*:101: Error: \$DPR_WORD not supported in this context
+[^:]*:66: Error: \$PCR_OFFSET not supported in this context
+[^:]*:67: Error: \$DSBT_INDEX not supported in this context
+[^:]*:68: Error: \$GOT not supported in this context
+[^:]*:69: Error: \$DPR_GOT not supported in this context
+[^:]*:70: Error: \$DPR_BYTE not supported in this context
+[^:]*:71: Error: \$DPR_HWORD not supported in this context
+[^:]*:72: Error: \$DPR_WORD not supported in this context
+[^:]*:73: Error: \$PCR_OFFSET not supported in this context
+[^:]*:74: Error: \$DSBT_INDEX not supported in this context
+[^:]*:75: Error: \$GOT not supported in this context
+[^:]*:76: Error: \$DPR_GOT not supported in this context
+[^:]*:77: Error: \$DPR_BYTE not supported in this context
+[^:]*:78: Error: \$DPR_HWORD not supported in this context
+[^:]*:79: Error: \$DPR_WORD not supported in this context
+[^:]*:80: Error: \$PCR_OFFSET not supported in this context
+[^:]*:81: Error: \$DSBT_INDEX not supported in this context
+[^:]*:82: Error: \$GOT not supported in this context
+[^:]*:83: Error: \$DPR_GOT not supported in this context
+[^:]*:84: Error: \$DPR_BYTE not supported in this context
+[^:]*:85: Error: \$DPR_HWORD not supported in this context
+[^:]*:86: Error: \$DPR_WORD not supported in this context
+[^:]*:87: Error: \$PCR_OFFSET not supported in this context
+[^:]*:88: Error: \$DSBT_INDEX not supported in this context
+[^:]*:89: Error: \$GOT not supported in this context
+[^:]*:90: Error: \$DPR_GOT not supported in this context
+[^:]*:91: Error: \$DPR_BYTE not supported in this context
+[^:]*:92: Error: \$DPR_HWORD not supported in this context
+[^:]*:93: Error: \$DPR_WORD not supported in this context
+[^:]*:94: Error: \$PCR_OFFSET not supported in this context
+[^:]*:95: Error: \$DSBT_INDEX not supported in this context
+[^:]*:96: Error: \$GOT not supported in this context
+[^:]*:97: Error: \$DPR_GOT not supported in this context
+[^:]*:98: Error: \$DPR_BYTE not supported in this context
+[^:]*:99: Error: \$DPR_HWORD not supported in this context
+[^:]*:100: Error: \$DPR_WORD not supported in this context
+[^:]*:101: Error: \$PCR_OFFSET not supported in this context
[^:]*:102: Error: \$DSBT_INDEX not supported in this context
[^:]*:103: Error: \$GOT not supported in this context
[^:]*:104: Error: \$DPR_GOT not supported in this context
[^:]*:105: Error: \$DPR_BYTE not supported in this context
[^:]*:106: Error: \$DPR_HWORD not supported in this context
[^:]*:107: Error: \$DPR_WORD not supported in this context
-[^:]*:108: Error: \$DSBT_INDEX not supported in this context
-[^:]*:109: Error: \$GOT not supported in this context
-[^:]*:110: Error: \$DPR_GOT not supported in this context
-[^:]*:111: Error: \$DPR_BYTE not supported in this context
-[^:]*:112: Error: \$DPR_HWORD not supported in this context
-[^:]*:113: Error: \$DPR_WORD not supported in this context
-[^:]*:114: Error: \$DSBT_INDEX not supported in this context
-[^:]*:115: Error: \$GOT not supported in this context
-[^:]*:116: Error: \$DPR_GOT not supported in this context
-[^:]*:117: Error: \$DPR_BYTE not supported in this context
-[^:]*:118: Error: \$DPR_HWORD not supported in this context
-[^:]*:119: Error: \$DPR_WORD not supported in this context
-[^:]*:120: Error: \$DSBT_INDEX not supported in this context
-[^:]*:121: Error: \$GOT not supported in this context
-[^:]*:122: Error: \$DPR_GOT not supported in this context
-[^:]*:123: Error: \$DPR_BYTE not supported in this context
-[^:]*:124: Error: \$DPR_HWORD not supported in this context
-[^:]*:125: Error: \$DPR_WORD not supported in this context
-[^:]*:126: Error: \$DSBT_INDEX not supported in this context
-[^:]*:127: Error: \$GOT not supported in this context
-[^:]*:128: Error: \$DPR_GOT not supported in this context
-[^:]*:129: Error: \$DPR_BYTE not supported in this context
-[^:]*:130: Error: \$DPR_HWORD not supported in this context
-[^:]*:131: Error: \$DPR_WORD not supported in this context
-[^:]*:132: Error: \$DSBT_INDEX not supported in this context
-[^:]*:133: Error: \$GOT not supported in this context
-[^:]*:134: Error: \$DPR_GOT not supported in this context
-[^:]*:135: Error: \$DPR_BYTE not supported in this context
-[^:]*:136: Error: \$DPR_HWORD not supported in this context
-[^:]*:137: Error: \$DPR_WORD not supported in this context
-[^:]*:138: Error: \$DPR_GOT not supported in this context
-[^:]*:139: Error: \$DPR_BYTE not supported in this context
-[^:]*:140: Error: \$DPR_HWORD not supported in this context
-[^:]*:141: Error: \$DPR_WORD not supported in this context
-[^:]*:142: Error: \$DSBT_INDEX not supported in this context
-[^:]*:143: Error: \$GOT not supported in this context
-[^:]*:144: Error: \$DPR_GOT not supported in this context
-[^:]*:145: Error: \$DPR_BYTE not supported in this context
-[^:]*:146: Error: \$DPR_HWORD not supported in this context
-[^:]*:147: Error: \$DPR_WORD not supported in this context
-[^:]*:148: Error: \$DSBT_INDEX not supported in this context
-[^:]*:149: Error: \$GOT not supported in this context
-[^:]*:150: Error: \$DPR_GOT not supported in this context
-[^:]*:151: Error: \$DPR_BYTE not supported in this context
-[^:]*:152: Error: \$DPR_HWORD not supported in this context
-[^:]*:153: Error: \$DPR_WORD not supported in this context
-[^:]*:154: Error: \$DPR_GOT not supported in this context
-[^:]*:155: Error: \$DPR_BYTE not supported in this context
-[^:]*:156: Error: \$DPR_HWORD not supported in this context
-[^:]*:157: Error: \$DPR_WORD not supported in this context
+[^:]*:108: Error: \$PCR_OFFSET not supported in this context
+[^:]*:109: Error: \$DSBT_INDEX not supported in this context
+[^:]*:110: Error: \$GOT not supported in this context
+[^:]*:111: Error: \$DPR_GOT not supported in this context
+[^:]*:112: Error: \$DPR_BYTE not supported in this context
+[^:]*:113: Error: \$DPR_HWORD not supported in this context
+[^:]*:114: Error: \$DPR_WORD not supported in this context
+[^:]*:115: Error: \$PCR_OFFSET not supported in this context
+[^:]*:116: Error: \$DSBT_INDEX not supported in this context
+[^:]*:117: Error: \$GOT not supported in this context
+[^:]*:118: Error: \$DPR_GOT not supported in this context
+[^:]*:119: Error: \$DPR_BYTE not supported in this context
+[^:]*:120: Error: \$DPR_HWORD not supported in this context
+[^:]*:121: Error: \$DPR_WORD not supported in this context
+[^:]*:122: Error: \$PCR_OFFSET not supported in this context
+[^:]*:123: Error: \$DSBT_INDEX not supported in this context
+[^:]*:124: Error: \$GOT not supported in this context
+[^:]*:125: Error: \$DPR_GOT not supported in this context
+[^:]*:126: Error: \$DPR_BYTE not supported in this context
+[^:]*:127: Error: \$DPR_HWORD not supported in this context
+[^:]*:128: Error: \$DPR_WORD not supported in this context
+[^:]*:129: Error: \$PCR_OFFSET not supported in this context
+[^:]*:130: Error: \$DSBT_INDEX not supported in this context
+[^:]*:131: Error: \$GOT not supported in this context
+[^:]*:132: Error: \$DPR_GOT not supported in this context
+[^:]*:133: Error: \$DPR_BYTE not supported in this context
+[^:]*:134: Error: \$DPR_HWORD not supported in this context
+[^:]*:135: Error: \$DPR_WORD not supported in this context
+[^:]*:136: Error: \$PCR_OFFSET not supported in this context
+[^:]*:137: Error: \$DSBT_INDEX not supported in this context
+[^:]*:138: Error: \$GOT not supported in this context
+[^:]*:139: Error: \$DPR_GOT not supported in this context
+[^:]*:140: Error: \$DPR_BYTE not supported in this context
+[^:]*:141: Error: \$DPR_HWORD not supported in this context
+[^:]*:142: Error: \$DPR_WORD not supported in this context
+[^:]*:143: Error: \$PCR_OFFSET not supported in this context
+[^:]*:144: Error: \$DSBT_INDEX not supported in this context
+[^:]*:145: Error: \$GOT not supported in this context
+[^:]*:146: Error: \$DPR_GOT not supported in this context
+[^:]*:147: Error: \$DPR_BYTE not supported in this context
+[^:]*:148: Error: \$DPR_HWORD not supported in this context
+[^:]*:149: Error: \$DPR_WORD not supported in this context
+[^:]*:150: Error: \$PCR_OFFSET not supported in this context
+[^:]*:151: Error: \$DSBT_INDEX not supported in this context
+[^:]*:152: Error: \$GOT not supported in this context
+[^:]*:153: Error: \$DPR_GOT not supported in this context
+[^:]*:154: Error: \$DPR_BYTE not supported in this context
+[^:]*:155: Error: \$DPR_HWORD not supported in this context
+[^:]*:156: Error: \$DPR_WORD not supported in this context
+[^:]*:157: Error: \$PCR_OFFSET not supported in this context
+[^:]*:158: Error: \$DPR_GOT not supported in this context
+[^:]*:159: Error: \$DPR_BYTE not supported in this context
+[^:]*:160: Error: \$DPR_HWORD not supported in this context
+[^:]*:161: Error: \$DPR_WORD not supported in this context
+[^:]*:162: Error: \$PCR_OFFSET not supported in this context
+[^:]*:163: Error: \$DSBT_INDEX not supported in this context
+[^:]*:164: Error: \$GOT not supported in this context
+[^:]*:165: Error: \$DPR_GOT not supported in this context
+[^:]*:166: Error: \$DPR_BYTE not supported in this context
+[^:]*:167: Error: \$DPR_HWORD not supported in this context
+[^:]*:168: Error: \$DPR_WORD not supported in this context
+[^:]*:169: Error: \$PCR_OFFSET not supported in this context
+[^:]*:170: Error: \$DSBT_INDEX not supported in this context
+[^:]*:171: Error: \$GOT not supported in this context
+[^:]*:172: Error: \$DPR_GOT not supported in this context
+[^:]*:173: Error: \$DPR_BYTE not supported in this context
+[^:]*:174: Error: \$DPR_HWORD not supported in this context
+[^:]*:175: Error: \$DPR_WORD not supported in this context
+[^:]*:176: Error: \$PCR_OFFSET not supported in this context
+[^:]*:177: Error: \$DPR_GOT not supported in this context
+[^:]*:178: Error: \$DPR_BYTE not supported in this context
+[^:]*:179: Error: \$DPR_HWORD not supported in this context
+[^:]*:180: Error: \$DPR_WORD not supported in this context
+[^:]*:181: Error: \$PCR_OFFSET not supported in this context
diff --git a/gas/testsuite/gas/tic6x/reloc-bad-2.s b/gas/testsuite/gas/tic6x/reloc-bad-2.s
index c0b4eb3..5a1774d 100644
--- a/gas/testsuite/gas/tic6x/reloc-bad-2.s
+++ b/gas/testsuite/gas/tic6x/reloc-bad-2.s
@@ -9,6 +9,7 @@ d:
.word $dpr_byte(b)
.word $dpr_hword(a)
.word $dpr_word(b)
+ .word $pcr_offset(b,f)
.text
.nocmp
.globl f
@@ -19,21 +20,25 @@ f:
addab .D1X b14,$DPR_BYTE(b),a5
addab .D1X b14,$DPR_HWORD(b),a5
addab .D1X b14,$DPR_WORD(b),a5
+ addab .D1X b14,$PCR_OFFSET(b,f),a5
addah .D1X b14,$dsbt_index(__c6xabi_DSBT_BASE),a5
addah .D1X b14,$GOT(b),a5
addah .D1X b14,$DPR_GOT(b),a5
addah .D1X b14,$DPR_BYTE(b),a5
addah .D1X b14,$DPR_HWORD(b),a5
addah .D1X b14,$DPR_WORD(b),a5
+ addah .D1X b14,$PCR_OFFSET(b,f),a5
addaw .D1X b14,$DPR_GOT(b),a5
addaw .D1X b14,$DPR_BYTE(b),a5
addaw .D1X b14,$DPR_HWORD(b),a5
addaw .D1X b14,$DPR_WORD(b),a5
+ addaw .D1X b14,$PCR_OFFSET(b,f),a5
addk .S1 $dsbt_index(__c6xabi_DSBT_BASE),a7
addk .S1 $got(b),a7
addk .S1 $dpr_got(b),a7
addk .S1 $dpr_hword(b),a7
addk .S1 $dpr_word(b),a7
+ addk .S1 $pcr_offset(b,f),a7
mvk .S1 $dsbt_index(__c6xabi_DSBT_BASE),a7
mvk .S1 $got(b),a7
mvk .S1 $dpr_got(b),a7
@@ -51,107 +56,126 @@ f:
addkpc .S2 $DPR_BYTE(b),b3,0
addkpc .S2 $DPR_HWORD(b),b3,0
addkpc .S2 $DPR_WORD(b),b3,0
+ addkpc .S2 $PCR_OFFSET(b,f),b3,0
b .S1 $dsbt_index(__c6xabi_DSBT_BASE)
b .S1 $GOT(b)
b .S1 $DPR_GOT(b)
b .S1 $DPR_BYTE(b)
b .S1 $DPR_HWORD(b)
b .S1 $DPR_WORD(b)
+ b .S1 $PCR_OFFSET(b,f)
call .S1 $dsbt_index(__c6xabi_DSBT_BASE)
call .S1 $GOT(b)
call .S1 $DPR_GOT(b)
call .S1 $DPR_BYTE(b)
call .S1 $DPR_HWORD(b)
call .S1 $DPR_WORD(b)
+ call .S1 $PCR_OFFSET(b,f)
bdec .S1 $dsbt_index(__c6xabi_DSBT_BASE),a1
bdec .S1 $GOT(b),a1
bdec .S1 $DPR_GOT(b),a1
bdec .S1 $DPR_BYTE(b),a1
bdec .S1 $DPR_HWORD(b),a1
bdec .S1 $DPR_WORD(b),a1
+ bdec .S1 $PCR_OFFSET(b,f),a1
bpos .S2 $dsbt_index(__c6xabi_DSBT_BASE),b1
bpos .S2 $GOT(b),b1
bpos .S2 $DPR_GOT(b),b1
bpos .S2 $DPR_BYTE(b),b1
bpos .S2 $DPR_HWORD(b),b1
bpos .S2 $DPR_WORD(b),b1
+ bpos .S2 $PCR_OFFSET(b,f),b1
bnop .S1 $dsbt_index(__c6xabi_DSBT_BASE),1
bnop .S1 $GOT(b),1
bnop .S1 $DPR_GOT(b),1
bnop .S1 $DPR_BYTE(b),1
bnop .S1 $DPR_HWORD(b),1
bnop .S1 $DPR_WORD(b),1
+ bnop .S1 $PCR_OFFSET(b,f),1
callnop $dsbt_index(__c6xabi_DSBT_BASE),1
callnop $GOT(b),1
callnop $DPR_GOT(b),1
callnop $DPR_BYTE(b),1
callnop $DPR_HWORD(b),1
callnop $DPR_WORD(b),1
+ callnop $PCR_OFFSET(b,f),1
callp .S1 $dsbt_index(__c6xabi_DSBT_BASE),a3
callp .S1 $GOT(b),a3
callp .S1 $DPR_GOT(b),a3
callp .S1 $DPR_BYTE(b),a3
callp .S1 $DPR_HWORD(b),a3
callp .S1 $DPR_WORD(b),a3
+ callp .S1 $PCR_OFFSET(b,f),a3
callret .S1 $dsbt_index(__c6xabi_DSBT_BASE)
callret .S1 $GOT(b)
callret .S1 $DPR_GOT(b)
callret .S1 $DPR_BYTE(b)
callret .S1 $DPR_HWORD(b)
callret .S1 $DPR_WORD(b)
+ callret .S1 $PCR_OFFSET(b,f)
ret .S1 $dsbt_index(__c6xabi_DSBT_BASE)
ret .S1 $GOT(b)
ret .S1 $DPR_GOT(b)
ret .S1 $DPR_BYTE(b)
ret .S1 $DPR_HWORD(b)
ret .S1 $DPR_WORD(b)
+ ret .S1 $PCR_OFFSET(b,f)
retp .S1 $dsbt_index(__c6xabi_DSBT_BASE),a3
retp .S1 $GOT(b),a3
retp .S1 $DPR_GOT(b),a3
retp .S1 $DPR_BYTE(b),a3
retp .S1 $DPR_HWORD(b),a3
retp .S1 $DPR_WORD(b),a3
+ retp .S1 $PCR_OFFSET(b,f),a3
ldb .D2T2 *+b14($dsbt_index(__c6xabi_DSBT_BASE)),b1
ldb .D2T2 *+b14($GOT(b)),b1
ldb .D2T2 *+b14($DPR_GOT(b)),b1
ldb .D2T2 *+b14($DPR_BYTE(b)),b1
ldb .D2T2 *+b14($DPR_HWORD(b)),b1
ldb .D2T2 *+b14($DPR_WORD(b)),b1
+ ldb .D2T2 *+b14($PCR_OFFSET(b,f)),b1
ldbu .D2T2 *+b14($dsbt_index(__c6xabi_DSBT_BASE)),b1
ldbu .D2T2 *+b14($GOT(b)),b1
ldbu .D2T2 *+b14($DPR_GOT(b)),b1
ldbu .D2T2 *+b14($DPR_BYTE(b)),b1
ldbu .D2T2 *+b14($DPR_HWORD(b)),b1
ldbu .D2T2 *+b14($DPR_WORD(b)),b1
+ ldbu .D2T2 *+b14($PCR_OFFSET(b,f)),b1
ldh .D2T2 *+b14($dsbt_index(__c6xabi_DSBT_BASE)),b1
ldh .D2T2 *+b14($GOT(b)),b1
ldh .D2T2 *+b14($DPR_GOT(b)),b1
ldh .D2T2 *+b14($DPR_BYTE(b)),b1
ldh .D2T2 *+b14($DPR_HWORD(b)),b1
ldh .D2T2 *+b14($DPR_WORD(b)),b1
+ ldh .D2T2 *+b14($PCR_OFFSET(b,f)),b1
ldhu .D2T2 *+b14($dsbt_index(__c6xabi_DSBT_BASE)),b1
ldhu .D2T2 *+b14($GOT(b)),b1
ldhu .D2T2 *+b14($DPR_GOT(b)),b1
ldhu .D2T2 *+b14($DPR_BYTE(b)),b1
ldhu .D2T2 *+b14($DPR_HWORD(b)),b1
ldhu .D2T2 *+b14($DPR_WORD(b)),b1
+ ldhu .D2T2 *+b14($PCR_OFFSET(b,f)),b1
ldw .D2T2 *+b14($DPR_GOT(b)),b1
ldw .D2T2 *+b14($DPR_BYTE(b)),b1
ldw .D2T2 *+b14($DPR_HWORD(b)),b1
ldw .D2T2 *+b14($DPR_WORD(b)),b1
+ ldw .D2T2 *+b14($PCR_OFFSET(b,f)),b1
stb .D2T2 b1,*+b14($dsbt_index(__c6xabi_DSBT_BASE))
stb .D2T2 b1,*+b14($GOT(b))
stb .D2T2 b1,*+b14($DPR_GOT(b))
stb .D2T2 b1,*+b14($DPR_BYTE(b))
stb .D2T2 b1,*+b14($DPR_HWORD(b))
stb .D2T2 b1,*+b14($DPR_WORD(b))
+ stb .D2T2 b1,*+b14($PCR_OFFSET(b,f))
sth .D2T2 b1,*+b14($dsbt_index(__c6xabi_DSBT_BASE))
sth .D2T2 b1,*+b14($GOT(b))
sth .D2T2 b1,*+b14($DPR_GOT(b))
sth .D2T2 b1,*+b14($DPR_BYTE(b))
sth .D2T2 b1,*+b14($DPR_HWORD(b))
sth .D2T2 b1,*+b14($DPR_WORD(b))
+ sth .D2T2 b1,*+b14($PCR_OFFSET(b,f))
stw .D2T2 b1,*+b14($DPR_GOT(b))
stw .D2T2 b1,*+b14($DPR_BYTE(b))
stw .D2T2 b1,*+b14($DPR_HWORD(b))
stw .D2T2 b1,*+b14($DPR_WORD(b))
+ stw .D2T2 b1,*+b14($PCR_OFFSET(b,f))
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 356151a..fb47469 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2011-05-20 Bernd Schmidt <bernds@codesourcery.com>
+
+ * ld-tic6x/pcr-reloc.d: New test.
+ * ld-tic6x/pcr-reloc.s: New test.
+
2011-05-18 Nick Clifton <nickc@redhat.com>
PR ld/12761
diff --git a/ld/testsuite/ld-tic6x/pcr-reloc.d b/ld/testsuite/ld-tic6x/pcr-reloc.d
new file mode 100644
index 0000000..8c35e04
--- /dev/null
+++ b/ld/testsuite/ld-tic6x/pcr-reloc.d
@@ -0,0 +1,39 @@
+#name: C6X PCR relocations
+#as: -mlittle-endian
+#ld: -melf32_tic6x_le -Tgeneric.ld
+#source: pcr-reloc.s
+#objdump: -dr
+
+.*: *file format elf32-tic6x-le
+
+
+Disassembly of section \.text:
+
+10000000 <[^>]*>:
+10000000:[ \t]+00800264[ \t]+ldw \.D1T1 \*\+a0\(0\),a1
+10000004:[ \t]+00800264[ \t]+ldw \.D1T1 \*\+a0\(0\),a1
+10000008:[ \t]+00800264[ \t]+ldw \.D1T1 \*\+a0\(0\),a1
+
+1000000c <[^>]*>:
+1000000c:[ \t]+004003e2[ \t]+mvc \.S2 pce1,b0
+10000010:[ \t]+01000264[ \t]+ldw \.D1T1 \*\+a0\(0\),a2
+10000014:[ \t]+01001a2a[ \t]+mvk \.S2 52,b2
+10000018:[ \t]+0100006a[ \t]+mvkh \.S2 0,b2
+1000001c:[ \t]+01000a2a[ \t]+mvk \.S2 20,b2
+10000020:[ \t]+0100006a[ \t]+mvkh \.S2 0,b2
+10000024:[ \t]+01001e2a[ \t]+mvk \.S2 60,b2
+10000028:[ \t]+0100006a[ \t]+mvkh \.S2 0,b2
+1000002c:[ \t]+01000e2a[ \t]+mvk \.S2 28,b2
+10000030:[ \t]+0100006a[ \t]+mvkh \.S2 0,b2
+
+10000034 <[^>]*>:
+10000034:[ \t]+00800264[ \t]+ldw \.D1T1 \*\+a0\(0\),a1
+
+10000038 <[^>]*>:
+10000038:[ \t]+004003e2[ \t]+mvc \.S2 pce1,b0
+
+1000003c <[^>]*>:
+1000003c:[ \t]+00800264[ \t]+ldw \.D1T1 \*\+a0\(0\),a1
+10000040:[ \t]+017ff02a[ \t]+mvk \.S2 -32,b2
+10000044:[ \t]+017fffea[ \t]+mvkh \.S2 4294901760,b2
+[ \t]*\.\.\.
diff --git a/ld/testsuite/ld-tic6x/pcr-reloc.s b/ld/testsuite/ld-tic6x/pcr-reloc.s
new file mode 100644
index 0000000..00362ff
--- /dev/null
+++ b/ld/testsuite/ld-tic6x/pcr-reloc.s
@@ -0,0 +1,28 @@
+ .text
+ .align 5
+_start:
+L0:
+ ldw .d1t1 *a0,a1
+ ldw .d1t1 *a0,a1
+ ldw .d1t1 *a0,a1
+L1:
+ MVC .s2 PCE1, b0
+ ldw .d1t1 *a0,a2
+ mvk .s2 $PCR_OFFSET (S0,L1), b2
+ mvkh .s2 $PCR_OFFSET (S0,L1), b2
+ mvk .s2 $PCR_OFFSET (S0,L2), b2
+ mvkh .s2 $PCR_OFFSET (S0,L2), b2
+ mvk .s2 $PCR_OFFSET (S1,L1), b2
+ mvkh .s2 $PCR_OFFSET (S1,L1), b2
+ mvk .s2 $PCR_OFFSET (S1,L2), b2
+ mvkh .s2 $PCR_OFFSET (S1,L2), b2
+
+S0:
+ ldw .d1t1 *a0,a1
+L2:
+ MVC .s2 PCE1, b0
+
+S1:
+ ldw .d1t1 *a0,a1
+ mvkl .s2 $PCR_OFFSET (L0,L2), b2
+ mvkh .s2 $PCR_OFFSET (L0,L2), b2