aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorWalter Lee <walt@tilera.com>2012-08-28 02:43:22 +0000
committerWalter Lee <walt@tilera.com>2012-08-28 02:43:22 +0000
commite5b95258d9dd1ecc4a53baf56308ce78f19f4904 (patch)
tree3f98a860be8a85ea99ae0519037d37c5801c123f /gas
parentaedbcd6364b2c09c7d6a193d46b064b42013b857 (diff)
downloadgdb-e5b95258d9dd1ecc4a53baf56308ce78f19f4904.zip
gdb-e5b95258d9dd1ecc4a53baf56308ce78f19f4904.tar.gz
gdb-e5b95258d9dd1ecc4a53baf56308ce78f19f4904.tar.bz2
Add support for constructing pc-relative addresses to the plt, by
adding the necessary assembly operators and relocations. bfd: * reloc.c (Add BFD_RELOC_TILEGX_IMM16_X0_HW0_PLT_PCREL, BFD_RELOC_TILEGX_IMM16_X1_HW0_PLT_PCREL, BFD_RELOC_TILEGX_IMM16_X0_HW1_PLT_PCREL, BFD_RELOC_TILEGX_IMM16_X1_HW1_PLT_PCREL, BFD_RELOC_TILEGX_IMM16_X0_HW2_PLT_PCREL, BFD_RELOC_TILEGX_IMM16_X1_HW2_PLT_PCREL, BFD_RELOC_TILEGX_IMM16_X0_HW3_PLT_PCREL, BFD_RELOC_TILEGX_IMM16_X1_HW3_PLT_PCREL, BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL, BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL, BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL, BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL, BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL, BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL): new relocations. * elfxx-tilegx.c (tilegx_elf_howto_table): Handle new relocations. (tilegx_reloc_map): Ditto. (reloc_to_create_func): Ditto. (tilegx_elf_check_relocs): Ditto. (tilegx_elf_gc_sweep_hook): Ditto. (tilegx_elf_relocate_section): Ditto. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. gas: * tc-tilegx.c (O_hw0_plt): Define operator. (O_hw1_plt): Ditto. (O_hw1_last_plt): Ditto. (O_hw2_last_plt): Ditto. (md_begin): Handle new operators. (emit_tilegx_instruction): Ditto. (md_apply_fix): Ditto. * doc/c-tilegx.texi: Document new operators. include/elf: * tilegx.h (R_TILEGX_IMM16_X0_HW0_PLT_PCREL): New relocation. (R_TILEGX_IMM16_X1_HW0_PLT_PCREL): Ditto. (R_TILEGX_IMM16_X0_HW1_PLT_PCREL): Ditto. (R_TILEGX_IMM16_X1_HW1_PLT_PCREL): Ditto. (R_TILEGX_IMM16_X0_HW2_PLT_PCREL): Ditto. (R_TILEGX_IMM16_X1_HW2_PLT_PCREL): Ditto. (R_TILEGX_IMM16_X0_HW3_PLT_PCREL): Ditto. (R_TILEGX_IMM16_X1_HW3_PLT_PCREL): Ditto. (R_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL): Ditto. (R_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL): Ditto. (R_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL): Ditto. (R_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL): Ditto. (R_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL ): Ditto. (R_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL): Ditto.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog11
-rw-r--r--gas/config/tc-tilegx.c53
-rw-r--r--gas/doc/c-tilegx.texi20
3 files changed, 84 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 2e8b2ac..88e9110 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,14 @@
+2012-08-27 Walter Lee <walt@tilera.com>
+
+ * tc-tilegx.c (O_hw0_plt): Define operator.
+ (O_hw1_plt): Ditto.
+ (O_hw1_last_plt): Ditto.
+ (O_hw2_last_plt): Ditto.
+ (md_begin): Handle new operators.
+ (emit_tilegx_instruction): Ditto.
+ (md_apply_fix): Ditto.
+ * doc/c-tilegx.texi: Document new operators.
+
2012-08-24 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* config/tc-arm.c (ARM_ENC_TAB): Add sha1h and sha2op entries.
diff --git a/gas/config/tc-tilegx.c b/gas/config/tc-tilegx.c
index b2d9420..19a04c2 100644
--- a/gas/config/tc-tilegx.c
+++ b/gas/config/tc-tilegx.c
@@ -173,6 +173,10 @@ md_show_usage (FILE *stream)
#define O_tls_gd_add O_md22
#define O_tls_ie_load O_md23
#define O_tls_add O_md24
+#define O_hw0_plt O_md25
+#define O_hw1_plt O_md26
+#define O_hw1_last_plt O_md27
+#define O_hw2_last_plt O_md28
static struct hash_control *special_operator_hash;
@@ -300,6 +304,10 @@ md_begin (void)
INSERT_SPECIAL_OP (tls_gd_add);
INSERT_SPECIAL_OP (tls_ie_load);
INSERT_SPECIAL_OP (tls_add);
+ INSERT_SPECIAL_OP (hw0_plt);
+ INSERT_SPECIAL_OP (hw1_plt);
+ INSERT_SPECIAL_OP (hw1_last_plt);
+ INSERT_SPECIAL_OP (hw2_last_plt);
#undef INSERT_SPECIAL_OP
/* Initialize op_hash hash table. */
@@ -611,6 +619,22 @@ emit_tilegx_instruction (tilegx_bundle_bits bits,
require_symbol = 1;
break;
+ case O_hw0_plt:
+ HANDLE_OP16 (HW0_PLT_PCREL);
+ break;
+
+ case O_hw1_plt:
+ HANDLE_OP16 (HW1_PLT_PCREL);
+ break;
+
+ case O_hw1_last_plt:
+ HANDLE_OP16 (HW1_LAST_PLT_PCREL);
+ break;
+
+ case O_hw2_last_plt:
+ HANDLE_OP16 (HW2_LAST_PLT_PCREL);
+ break;
+
#undef HANDLE_OP16
case O_plt:
@@ -1475,6 +1499,13 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED)
fixP->fx_r_type = rtype; \
break
+#define FIX_PLT_PCREL(rtype) \
+ case rtype##_PLT_PCREL: \
+ if (!fixP->fx_pcrel) \
+ fixP->fx_r_type = rtype; \
+ \
+ break;
+
FIX_PCREL (BFD_RELOC_8);
FIX_PCREL (BFD_RELOC_16);
FIX_PCREL (BFD_RELOC_32);
@@ -1493,6 +1524,14 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED)
FIX_PCREL (BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST);
FIX_PCREL (BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST);
FIX_PCREL (BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST);
+ FIX_PLT_PCREL (BFD_RELOC_TILEGX_IMM16_X0_HW0);
+ FIX_PLT_PCREL (BFD_RELOC_TILEGX_IMM16_X1_HW0);
+ FIX_PLT_PCREL (BFD_RELOC_TILEGX_IMM16_X0_HW1);
+ FIX_PLT_PCREL (BFD_RELOC_TILEGX_IMM16_X1_HW1);
+ FIX_PLT_PCREL (BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST);
+ FIX_PLT_PCREL (BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST);
+ FIX_PLT_PCREL (BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST);
+ FIX_PLT_PCREL (BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST);
#undef FIX_PCREL
@@ -1560,6 +1599,8 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED)
case BFD_RELOC_TILEGX_IMM16_X1_HW0:
case BFD_RELOC_TILEGX_IMM16_X0_HW0_PCREL:
case BFD_RELOC_TILEGX_IMM16_X1_HW0_PCREL:
+ case BFD_RELOC_TILEGX_IMM16_X0_HW0_PLT_PCREL:
+ case BFD_RELOC_TILEGX_IMM16_X1_HW0_PLT_PCREL:
special = O_hw0;
break;
@@ -1568,6 +1609,8 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED)
case BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST:
case BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_PCREL:
case BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_PCREL:
+ case BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL:
+ case BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL:
special = O_hw0_last;
break;
@@ -1576,6 +1619,8 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED)
case BFD_RELOC_TILEGX_IMM16_X1_HW1:
case BFD_RELOC_TILEGX_IMM16_X0_HW1_PCREL:
case BFD_RELOC_TILEGX_IMM16_X1_HW1_PCREL:
+ case BFD_RELOC_TILEGX_IMM16_X0_HW1_PLT_PCREL:
+ case BFD_RELOC_TILEGX_IMM16_X1_HW1_PLT_PCREL:
special = O_hw1;
break;
@@ -1584,6 +1629,8 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED)
case BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST:
case BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_PCREL:
case BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_PCREL:
+ case BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL:
+ case BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL:
special = O_hw1_last;
break;
@@ -1592,6 +1639,8 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED)
case BFD_RELOC_TILEGX_IMM16_X1_HW2:
case BFD_RELOC_TILEGX_IMM16_X0_HW2_PCREL:
case BFD_RELOC_TILEGX_IMM16_X1_HW2_PCREL:
+ case BFD_RELOC_TILEGX_IMM16_X0_HW2_PLT_PCREL:
+ case BFD_RELOC_TILEGX_IMM16_X1_HW2_PLT_PCREL:
special = O_hw2;
break;
@@ -1600,6 +1649,8 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED)
case BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST:
case BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST_PCREL:
case BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_PCREL:
+ case BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL:
+ case BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL:
special = O_hw2_last;
break;
@@ -1608,6 +1659,8 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED)
case BFD_RELOC_TILEGX_IMM16_X1_HW3:
case BFD_RELOC_TILEGX_IMM16_X0_HW3_PCREL:
case BFD_RELOC_TILEGX_IMM16_X1_HW3_PCREL:
+ case BFD_RELOC_TILEGX_IMM16_X0_HW3_PLT_PCREL:
+ case BFD_RELOC_TILEGX_IMM16_X1_HW3_PLT_PCREL:
special = O_hw3;
break;
diff --git a/gas/doc/c-tilegx.texi b/gas/doc/c-tilegx.texi
index 268cc4f..0d8c038 100644
--- a/gas/doc/c-tilegx.texi
+++ b/gas/doc/c-tilegx.texi
@@ -242,6 +242,26 @@ called (at latest; depending environment variables). It is only safe
to leave the symbol unresolved this way if all references are function
calls.
+@item hw0_plt
+
+This modifier is used to load bits 0-15 of the pc-relative address of
+a plt entry.
+
+@item hw1_plt
+
+This modifier is used to load bits 16-31 of the pc-relative address of
+a plt entry.
+
+@item hw1_last_plt
+
+This modifier yields the same value as @code{hw1_plt}, but it also
+checks that the value does not overflow.
+
+@item hw2_last_plt
+
+This modifier is used to load bits 32-47 of the pc-relative address of
+a plt entry, and it also checks that the value does not overflow.
+
@item hw0_tls_gd
This modifier is used to load bits 0-15 of the offset of the GOT entry