diff options
author | Walter Lee <walt@tilera.com> | 2012-08-28 02:43:22 +0000 |
---|---|---|
committer | Walter Lee <walt@tilera.com> | 2012-08-28 02:43:22 +0000 |
commit | e5b95258d9dd1ecc4a53baf56308ce78f19f4904 (patch) | |
tree | 3f98a860be8a85ea99ae0519037d37c5801c123f /bfd/elfxx-tilegx.c | |
parent | aedbcd6364b2c09c7d6a193d46b064b42013b857 (diff) | |
download | gdb-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 'bfd/elfxx-tilegx.c')
-rw-r--r-- | bfd/elfxx-tilegx.c | 117 |
1 files changed, 87 insertions, 30 deletions
diff --git a/bfd/elfxx-tilegx.c b/bfd/elfxx-tilegx.c index 6f748ec..1f5c458 100644 --- a/bfd/elfxx-tilegx.c +++ b/bfd/elfxx-tilegx.c @@ -490,21 +490,21 @@ static reloc_howto_type tilegx_elf_howto_table [] = TILEGX_IMM16_HOWTO (R_TILEGX_IMM16_X0_HW0_GOT, 0), TILEGX_IMM16_HOWTO (R_TILEGX_IMM16_X1_HW0_GOT, 0), - /* These relocs are currently not defined. */ - EMPTY_HOWTO (66), - EMPTY_HOWTO (67), - EMPTY_HOWTO (68), - EMPTY_HOWTO (69), - EMPTY_HOWTO (70), - EMPTY_HOWTO (71), + + TILEGX_IMM16_HOWTO_PCREL (R_TILEGX_IMM16_X0_HW0_PLT_PCREL, 0), + TILEGX_IMM16_HOWTO_PCREL (R_TILEGX_IMM16_X1_HW0_PLT_PCREL, 0), + TILEGX_IMM16_HOWTO_PCREL (R_TILEGX_IMM16_X0_HW1_PLT_PCREL, 16), + TILEGX_IMM16_HOWTO_PCREL (R_TILEGX_IMM16_X1_HW1_PLT_PCREL, 16), + TILEGX_IMM16_HOWTO_PCREL (R_TILEGX_IMM16_X0_HW2_PLT_PCREL, 32), + TILEGX_IMM16_HOWTO_PCREL (R_TILEGX_IMM16_X1_HW2_PLT_PCREL, 32), TILEGX_IMM16_HOWTO_LAST (R_TILEGX_IMM16_X0_HW0_LAST_GOT, 0), TILEGX_IMM16_HOWTO_LAST (R_TILEGX_IMM16_X1_HW0_LAST_GOT, 0), TILEGX_IMM16_HOWTO_LAST (R_TILEGX_IMM16_X0_HW1_LAST_GOT, 16), TILEGX_IMM16_HOWTO_LAST (R_TILEGX_IMM16_X1_HW1_LAST_GOT, 16), - /* These relocs are currently not defined. */ - EMPTY_HOWTO (76), - EMPTY_HOWTO (77), + + TILEGX_IMM16_HOWTO_PCREL (R_TILEGX_IMM16_X0_HW3_PLT_PCREL, 48), + TILEGX_IMM16_HOWTO_PCREL (R_TILEGX_IMM16_X1_HW3_PLT_PCREL, 48), TILEGX_IMM16_HOWTO (R_TILEGX_IMM16_X0_HW0_TLS_GD, 0), TILEGX_IMM16_HOWTO (R_TILEGX_IMM16_X1_HW0_TLS_GD, 0), @@ -530,12 +530,13 @@ static reloc_howto_type tilegx_elf_howto_table [] = TILEGX_IMM16_HOWTO_TLS_IE (R_TILEGX_IMM16_X0_HW0_TLS_IE, 0), TILEGX_IMM16_HOWTO_TLS_IE (R_TILEGX_IMM16_X1_HW0_TLS_IE, 0), - EMPTY_HOWTO (94), - EMPTY_HOWTO (95), - EMPTY_HOWTO (96), - EMPTY_HOWTO (97), - EMPTY_HOWTO (98), - EMPTY_HOWTO (99), + + TILEGX_IMM16_HOWTO_LAST_PCREL (R_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL, 0), + TILEGX_IMM16_HOWTO_LAST_PCREL (R_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL, 0), + TILEGX_IMM16_HOWTO_LAST_PCREL (R_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL, 16), + TILEGX_IMM16_HOWTO_LAST_PCREL (R_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL, 16), + TILEGX_IMM16_HOWTO_LAST_PCREL (R_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL, 32), + TILEGX_IMM16_HOWTO_LAST_PCREL (R_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL, 32), #define TILEGX_IMM16_HOWTO_LAST_TLS_IE(name, rshift) \ HOWTO (name, rshift, 1, 16, FALSE, 0, \ @@ -713,10 +714,18 @@ static const reloc_map tilegx_reloc_map [] = SIMPLE_REMAP (TILEGX_IMM16_X1_HW2_LAST_PCREL) SIMPLE_REMAP (TILEGX_IMM16_X0_HW0_GOT) SIMPLE_REMAP (TILEGX_IMM16_X1_HW0_GOT) + SIMPLE_REMAP (TILEGX_IMM16_X0_HW0_PLT_PCREL) + SIMPLE_REMAP (TILEGX_IMM16_X1_HW0_PLT_PCREL) + SIMPLE_REMAP (TILEGX_IMM16_X0_HW1_PLT_PCREL) + SIMPLE_REMAP (TILEGX_IMM16_X1_HW1_PLT_PCREL) + SIMPLE_REMAP (TILEGX_IMM16_X0_HW2_PLT_PCREL) + SIMPLE_REMAP (TILEGX_IMM16_X1_HW2_PLT_PCREL) SIMPLE_REMAP (TILEGX_IMM16_X0_HW0_LAST_GOT) SIMPLE_REMAP (TILEGX_IMM16_X1_HW0_LAST_GOT) SIMPLE_REMAP (TILEGX_IMM16_X0_HW1_LAST_GOT) SIMPLE_REMAP (TILEGX_IMM16_X1_HW1_LAST_GOT) + SIMPLE_REMAP (TILEGX_IMM16_X0_HW3_PLT_PCREL) + SIMPLE_REMAP (TILEGX_IMM16_X1_HW3_PLT_PCREL) SIMPLE_REMAP (TILEGX_IMM16_X0_HW0_TLS_GD) SIMPLE_REMAP (TILEGX_IMM16_X1_HW0_TLS_GD) SIMPLE_REMAP (TILEGX_IMM16_X0_HW0_TLS_LE) @@ -731,6 +740,12 @@ static const reloc_map tilegx_reloc_map [] = SIMPLE_REMAP (TILEGX_IMM16_X1_HW1_LAST_TLS_GD) SIMPLE_REMAP (TILEGX_IMM16_X0_HW0_TLS_IE) SIMPLE_REMAP (TILEGX_IMM16_X1_HW0_TLS_IE) + SIMPLE_REMAP (TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL) + SIMPLE_REMAP (TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL) + SIMPLE_REMAP (TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL) + SIMPLE_REMAP (TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL) + SIMPLE_REMAP (TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL) + SIMPLE_REMAP (TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL) SIMPLE_REMAP (TILEGX_IMM16_X0_HW0_LAST_TLS_IE) SIMPLE_REMAP (TILEGX_IMM16_X1_HW0_LAST_TLS_IE) SIMPLE_REMAP (TILEGX_IMM16_X0_HW1_LAST_TLS_IE) @@ -1027,18 +1042,10 @@ static const tilegx_create_func reloc_to_create_func[] = create_Imm16_X1, create_Imm16_X0, create_Imm16_X1, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, create_Imm16_X0, create_Imm16_X1, create_Imm16_X0, create_Imm16_X1, - NULL, - NULL, create_Imm16_X0, create_Imm16_X1, create_Imm16_X0, @@ -1051,16 +1058,24 @@ static const tilegx_create_func reloc_to_create_func[] = create_Imm16_X1, create_Imm16_X0, create_Imm16_X1, - NULL, - NULL, + create_Imm16_X0, + create_Imm16_X1, + create_Imm16_X0, + create_Imm16_X1, + create_Imm16_X0, + create_Imm16_X1, create_Imm16_X0, create_Imm16_X1, NULL, NULL, - NULL, - NULL, - NULL, - NULL, + create_Imm16_X0, + create_Imm16_X1, + create_Imm16_X0, + create_Imm16_X1, + create_Imm16_X0, + create_Imm16_X1, + create_Imm16_X0, + create_Imm16_X1, create_Imm16_X0, create_Imm16_X1, create_Imm16_X0, @@ -1855,6 +1870,20 @@ tilegx_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, /* Fall through */ case R_TILEGX_JUMPOFF_X1_PLT: + case R_TILEGX_IMM16_X0_HW0_PLT_PCREL: + case R_TILEGX_IMM16_X1_HW0_PLT_PCREL: + case R_TILEGX_IMM16_X0_HW1_PLT_PCREL: + case R_TILEGX_IMM16_X1_HW1_PLT_PCREL: + case R_TILEGX_IMM16_X0_HW2_PLT_PCREL: + case R_TILEGX_IMM16_X1_HW2_PLT_PCREL: + case R_TILEGX_IMM16_X0_HW3_PLT_PCREL: + case R_TILEGX_IMM16_X1_HW3_PLT_PCREL: + case R_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL: + case R_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL: + case R_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL: + case R_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL: + case R_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL: + case R_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL: /* This symbol requires a procedure linkage table entry. We actually build the entry in adjust_dynamic_symbol, because this might be a case of linking PIC code without @@ -2248,6 +2277,20 @@ tilegx_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info, /* Fall through. */ case R_TILEGX_JUMPOFF_X1_PLT: + case R_TILEGX_IMM16_X0_HW0_PLT_PCREL: + case R_TILEGX_IMM16_X1_HW0_PLT_PCREL: + case R_TILEGX_IMM16_X0_HW1_PLT_PCREL: + case R_TILEGX_IMM16_X1_HW1_PLT_PCREL: + case R_TILEGX_IMM16_X0_HW2_PLT_PCREL: + case R_TILEGX_IMM16_X1_HW2_PLT_PCREL: + case R_TILEGX_IMM16_X0_HW3_PLT_PCREL: + case R_TILEGX_IMM16_X1_HW3_PLT_PCREL: + case R_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL: + case R_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL: + case R_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL: + case R_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL: + case R_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL: + case R_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL: if (h != NULL) { if (h->plt.refcount > 0) @@ -3440,6 +3483,20 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, break; case R_TILEGX_JUMPOFF_X1_PLT: + case R_TILEGX_IMM16_X0_HW0_PLT_PCREL: + case R_TILEGX_IMM16_X1_HW0_PLT_PCREL: + case R_TILEGX_IMM16_X0_HW1_PLT_PCREL: + case R_TILEGX_IMM16_X1_HW1_PLT_PCREL: + case R_TILEGX_IMM16_X0_HW2_PLT_PCREL: + case R_TILEGX_IMM16_X1_HW2_PLT_PCREL: + case R_TILEGX_IMM16_X0_HW3_PLT_PCREL: + case R_TILEGX_IMM16_X1_HW3_PLT_PCREL: + case R_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL: + case R_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL: + case R_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL: + case R_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL: + case R_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL: + case R_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL: /* Relocation is to the entry for this symbol in the procedure linkage table. */ BFD_ASSERT (h != NULL); |