diff options
author | Walter Lee <walt@tilera.com> | 2012-02-25 22:24:21 +0000 |
---|---|---|
committer | Walter Lee <walt@tilera.com> | 2012-02-25 22:24:21 +0000 |
commit | 6f7be9592d58646e9ff66e125068691f1e830cc0 (patch) | |
tree | b84ed277a3fbd00f83778567fa884f977874c62a /gas | |
parent | 5414dbefeaf875f00cc29488bb54d2c30bf50c3b (diff) | |
download | gdb-6f7be9592d58646e9ff66e125068691f1e830cc0.zip gdb-6f7be9592d58646e9ff66e125068691f1e830cc0.tar.gz gdb-6f7be9592d58646e9ff66e125068691f1e830cc0.tar.bz2 |
Improve TLS support on TILE-Gx/TILEPro:
- Add support for TLS LE references.
- Support linker optimization of TLS references.
- Delete relocations of GOT/tp relative offsets beyond 32-bits.
This brings binutils in line with the support expected in gcc 4.7, for
TILE-Gx/TILEPro.
bfd/
* reloc.c: Add BFD_RELOC_TILEPRO_TLS_GD_CALL,
BFD_RELOC_TILEPRO_IMM8_X0_TLS_GD_ADD,
BFD_RELOC_TILEPRO_IMM8_X1_TLS_GD_ADD,
BFD_RELOC_TILEPRO_IMM8_Y0_TLS_GD_ADD,
BFD_RELOC_TILEPRO_IMM8_Y1_TLS_GD_ADD,
BFD_RELOC_TILEPRO_TLS_IE_LOAD, BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE,
BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE,
BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE_LO,
BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE_LO,
BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE_HI,
BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE_HI,
BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE_HA,
BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE_HA,
BFD_RELOC_TILEGX_IMM16_X0_HW0_TLS_LE,
BFD_RELOC_TILEGX_IMM16_X1_HW0_TLS_LE,
BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_TLS_LE,
BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_TLS_LE,
BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_TLS_LE,
BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_TLS_LE,
BFD_RELOC_TILEGX_TLS_GD_CALL, BFD_RELOC_TILEGX_IMM8_X0_TLS_GD_ADD,
BFD_RELOC_TILEGX_IMM8_X1_TLS_GD_ADD,
BFD_RELOC_TILEGX_IMM8_Y0_TLS_GD_ADD,
BFD_RELOC_TILEGX_IMM8_Y1_TLS_GD_ADD, BFD_RELOC_TILEGX_TLS_IE_LOAD,
BFD_RELOC_TILEGX_IMM8_X0_TLS_ADD,
BFD_RELOC_TILEGX_IMM8_X1_TLS_ADD,
BFD_RELOC_TILEGX_IMM8_Y0_TLS_ADD, BFD_RELOC_TILEGX_IMM8_Y1_TLS_ADD.
Delete BFD_RELOC_TILEGX_IMM16_X0_HW1_GOT,
BFD_RELOC_TILEGX_IMM16_X1_HW1_GOT,
BFD_RELOC_TILEGX_IMM16_X0_HW2_GOT,
BFD_RELOC_TILEGX_IMM16_X1_HW2_GOT,
BFD_RELOC_TILEGX_IMM16_X0_HW3_GOT,
BFD_RELOC_TILEGX_IMM16_X1_HW3_GOT,
BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST_GOT,
BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_GOT,
BFD_RELOC_TILEGX_IMM16_X0_HW1_TLS_GD,
BFD_RELOC_TILEGX_IMM16_X1_HW1_TLS_GD,
BFD_RELOC_TILEGX_IMM16_X0_HW2_TLS_GD,
BFD_RELOC_TILEGX_IMM16_X1_HW2_TLS_GD,
BFD_RELOC_TILEGX_IMM16_X0_HW3_TLS_GD,
BFD_RELOC_TILEGX_IMM16_X1_HW3_TLS_GD,
BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST_TLS_GD,
BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_TLS_GD,
BFD_RELOC_TILEGX_IMM16_X0_HW1_TLS_IE,
BFD_RELOC_TILEGX_IMM16_X1_HW1_TLS_IE,
BFD_RELOC_TILEGX_IMM16_X0_HW2_TLS_IE,
BFD_RELOC_TILEGX_IMM16_X1_HW2_TLS_IE,
BFD_RELOC_TILEGX_IMM16_X0_HW3_TLS_IE,
BFD_RELOC_TILEGX_IMM16_X1_HW3_TLS_IE,
BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST_TLS_IE,
BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_TLS_IE.
* elf32-tilepro.c (tilepro_elf_howto_table): Update tilepro
relocations.
(tilepro_reloc_map): Ditto.
(tilepro_info_to_howto_rela): Ditto.
(reloc_to_create_func): Ditto.
(tilepro_tls_translate_to_le): New.
(tilepro_tls_translate_to_ie): New.
(tilepro_elf_tls_transition): New.
(tilepro_elf_check_relocs): Handle new tls relocations.
(tilepro_elf_gc_sweep_hook): Ditto.
(allocate_dynrelocs): Ditto.
(tilepro_elf_relocate_section): Ditto.
(tilepro_replace_insn): New.
(insn_mask_X1): New.
(insn_mask_X0_no_dest_no_srca): New
(insn_mask_X1_no_dest_no_srca): New
(insn_mask_Y0_no_dest_no_srca): New
(insn_mask_Y1_no_dest_no_srca): New
(srca_mask_X0): New
(srca_mask_X1): New
(insn_tls_le_move_X1): New
(insn_tls_le_move_zero_X0X1): New
(insn_tls_ie_lw_X1): New
(insn_tls_ie_add_X0X1): New
(insn_tls_ie_add_Y0Y1): New
(insn_tls_gd_add_X0X1): New
(insn_tls_gd_add_Y0Y1): New
* elfxx-tilegx.c (tilegx_elf_howto_table): Update tilegx
relocations.
(tilegx_reloc_map): Ditto.
(tilegx_info_to_howto_rela): Ditto.
(reloc_to_create_func): Ditto.
(tilegx_elf_link_hash_table): New field disable_le_transition.
(tilegx_tls_translate_to_le): New.
(tilegx_tls_translate_to_ie): New.
(tilegx_elf_tls_transition): New.
(tilegx_elf_check_relocs): Handle new tls relocations.
(tilegx_elf_gc_sweep_hook): Ditto.
(allocate_dynrelocs): Ditto.
(tilegx_elf_relocate_section): Ditto.
(tilegx_copy_bits): New.
(tilegx_replace_insn): New.
(insn_mask_X1): New.
(insn_mask_X0_no_dest_no_srca): New.
(insn_mask_X1_no_dest_no_srca): New.
(insn_mask_Y0_no_dest_no_srca): New.
(insn_mask_Y1_no_dest_no_srca): New.
(insn_mask_X0_no_operand): New.
(insn_mask_X1_no_operand): New.
(insn_mask_Y0_no_operand): New.
(insn_mask_Y1_no_operand): New.
(insn_tls_ie_ld_X1): New.
(insn_tls_ie_ld4s_X1): New.
(insn_tls_ie_add_X0X1): New.
(insn_tls_ie_add_Y0Y1): New.
(insn_tls_ie_addx_X0X1): New.
(insn_tls_ie_addx_Y0Y1): New.
(insn_tls_gd_add_X0X1): New.
(insn_tls_gd_add_Y0Y1): New.
(insn_move_X0X1): New.
(insn_move_Y0Y1): New.
(insn_add_X0X1): New.
(insn_add_Y0Y1): New.
(insn_addx_X0X1): New.
(insn_addx_Y0Y1): New.
* libbfd.h: Regenerate.
* bfd-in2.h: Regenerate.
gas/
* tc-tilepro.c (O_tls_le): Define operator.
(O_tls_le_lo16): Ditto.
(O_tls_le_hi16): Ditto.
(O_tls_le_ha16): Ditto.
(O_tls_gd_call): Ditto.
(O_tls_gd_add): Ditto.
(O_tls_ie_load): Ditto.
(md_begin): Delete old operators; handle new operators.
(emit_tilepro_instruction): Ditto.
(md_apply_fix): Ditto.
* tc-tilegx.c (O_hw1_got): Delete operator.
(O_hw2_got): Ditto.
(O_hw3_got): Ditto.
(O_hw2_last_got): Ditto.
(O_hw1_tls_gd): Ditto.
(O_hw2_tls_gd): Ditto.
(O_hw3_tls_gd): Ditto.
(O_hw2_last_tls_gd): Ditto.
(O_hw1_tls_ie): Ditto.
(O_hw2_tls_ie): Ditto.
(O_hw3_tls_ie): Ditto.
(O_hw2_last_tls_ie): Ditto.
(O_hw0_tls_le): Define operator.
(O_hw0_last_tls_le): Ditto.
(O_hw1_last_tls_le): Ditto.
(O_tls_gd_call): Ditto.
(O_tls_gd_add): Ditto.
(O_tls_ie_load): Ditto.
(O_tls_add): Ditto.
(md_begin): Delete old operators; handle new operators.
(emit_tilegx_instruction): Ditto.
(md_apply_fix): Ditto.
* doc/c-tilegx.texi: Delete old operators; document new operators.
* doc/c-tilepro.texi: Ditto.
include/elf/
* tilegx.h (R_TILEGX_IMM16_X0_HW1_GOT): Delete.
(R_TILEGX_IMM16_X1_HW1_GOT): Ditto.
(R_TILEGX_IMM16_X0_HW2_GOT): Ditto.
(R_TILEGX_IMM16_X1_HW2_GOT): Ditto.
(R_TILEGX_IMM16_X0_HW3_GOT): Ditto.
(R_TILEGX_IMM16_X1_HW3_GOT): Ditto.
(R_TILEGX_IMM16_X0_HW2_LAST_GOT): Ditto.
(R_TILEGX_IMM16_X1_HW2_LAST_GOT): Ditto.
(R_TILEGX_IMM16_X0_HW1_TLS_GD): Ditto.
(R_TILEGX_IMM16_X1_HW1_TLS_GD): Ditto.
(R_TILEGX_IMM16_X0_HW2_TLS_GD): Ditto.
(R_TILEGX_IMM16_X1_HW2_TLS_GD): Ditto.
(R_TILEGX_IMM16_X0_HW3_TLS_GD): Ditto.
(R_TILEGX_IMM16_X1_HW3_TLS_GD): Ditto.
(R_TILEGX_IMM16_X0_HW2_LAST_TLS_GD): Ditto.
(R_TILEGX_IMM16_X1_HW2_LAST_TLS_GD): Ditto.
(R_TILEGX_IMM16_X0_HW1_TLS_IE): Ditto.
(R_TILEGX_IMM16_X1_HW1_TLS_IE): Ditto.
(R_TILEGX_IMM16_X0_HW2_TLS_IE): Ditto.
(R_TILEGX_IMM16_X1_HW2_TLS_IE): Ditto.
(R_TILEGX_IMM16_X0_HW3_TLS_IE): Ditto.
(R_TILEGX_IMM16_X1_HW3_TLS_IE): Ditto.
(R_TILEGX_IMM16_X0_HW2_LAST_TLS_IE): Ditto.
(R_TILEGX_IMM16_X1_HW2_LAST_TLS_IE): Ditto.
(R_TILEGX_IMM16_X0_HW0_TLS_LE): New relocation.
(R_TILEGX_IMM16_X1_HW0_TLS_LE): Ditto.
(R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE): Ditto.
(R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE): Ditto.
(R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE): Ditto.
(R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE): Ditto.
(R_TILEGX_TLS_GD_CALL): Ditto.
(R_TILEGX_IMM8_X0_TLS_GD_ADD): Ditto.
(R_TILEGX_IMM8_X1_TLS_GD_ADD): Ditto.
(R_TILEGX_IMM8_Y0_TLS_GD_ADD): Ditto.
(R_TILEGX_IMM8_Y1_TLS_GD_ADD): Ditto.
(R_TILEGX_TLS_IE_LOAD): Ditto.
(R_TILEGX_IMM8_X0_TLS_ADD): Ditto.
(R_TILEGX_IMM8_X1_TLS_ADD): Ditto.
(R_TILEGX_IMM8_Y0_TLS_ADD): Ditto.
(R_TILEGX_IMM8_Y1_TLS_ADD): Ditto.
* tilepro.h (R_TILEPRO_TLS_GD_CALL): New relocation.
(R_TILEPRO_IMM8_X0_TLS_GD_ADD): Ditto.
(R_TILEPRO_IMM8_X1_TLS_GD_ADD): Ditto.
(R_TILEPRO_IMM8_Y0_TLS_GD_ADD): Ditto.
(R_TILEPRO_IMM8_Y1_TLS_GD_ADD): Ditto.
(R_TILEPRO_TLS_IE_LOAD): Ditto.
(R_TILEPRO_IMM16_X0_TLS_LE): Ditto.
(R_TILEPRO_IMM16_X1_TLS_LE): Ditto.
(R_TILEPRO_IMM16_X0_TLS_LE_LO): Ditto.
(R_TILEPRO_IMM16_X1_TLS_LE_LO): Ditto.
(R_TILEPRO_IMM16_X0_TLS_LE_HI): Ditto.
(R_TILEPRO_IMM16_X1_TLS_LE_HI): Ditto.
(R_TILEPRO_IMM16_X0_TLS_LE_HA): Ditto.
(R_TILEPRO_IMM16_X1_TLS_LE_HA): Ditto.
include/opcode/
* tilegx.h (tilegx_mnemonic): Add TILEGX_OPC_LD4S_TLS,
TILEGX_OPC_LD_TLS.
* tilepro.h (tilepro_mnemonic): Add TILEPRO_OPC_LW_TLS,
TILEPRO_OPC_LW_TLS_SN.
opcodes/
* tilegx-opc.c: Handle TILEGX_OPC_LD4S_TLS and TILEGX_OPC_LD_TLS.
* tilepro-opc.c: Handle TILEPRO_OPC_LW_TLS and
TILEPRO_OPC_LW_TLS_SN.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 37 | ||||
-rw-r--r-- | gas/config/tc-tilegx.c | 231 | ||||
-rw-r--r-- | gas/config/tc-tilepro.c | 121 | ||||
-rw-r--r-- | gas/doc/c-tilegx.texi | 101 | ||||
-rw-r--r-- | gas/doc/c-tilepro.texi | 35 |
5 files changed, 342 insertions, 183 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index b419ac0..5e5f50b 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,42 @@ 2012-02-25 Walter Lee <walt@tilera.com> + * tc-tilepro.c (O_tls_le): Define operator. + (O_tls_le_lo16): Ditto. + (O_tls_le_hi16): Ditto. + (O_tls_le_ha16): Ditto. + (O_tls_gd_call): Ditto. + (O_tls_gd_add): Ditto. + (O_tls_ie_load): Ditto. + (md_begin): Delete old operators; handle new operators. + (emit_tilepro_instruction): Ditto. + (md_apply_fix): Ditto. + * tc-tilegx.c (O_hw1_got): Delete operator. + (O_hw2_got): Ditto. + (O_hw3_got): Ditto. + (O_hw2_last_got): Ditto. + (O_hw1_tls_gd): Ditto. + (O_hw2_tls_gd): Ditto. + (O_hw3_tls_gd): Ditto. + (O_hw2_last_tls_gd): Ditto. + (O_hw1_tls_ie): Ditto. + (O_hw2_tls_ie): Ditto. + (O_hw3_tls_ie): Ditto. + (O_hw2_last_tls_ie): Ditto. + (O_hw0_tls_le): Define operator. + (O_hw0_last_tls_le): Ditto. + (O_hw1_last_tls_le): Ditto. + (O_tls_gd_call): Ditto. + (O_tls_gd_add): Ditto. + (O_tls_ie_load): Ditto. + (O_tls_add): Ditto. + (md_begin): Delete old operators; handle new operators. + (emit_tilegx_instruction): Ditto. + (md_apply_fix): Ditto. + * doc/c-tilegx.texi: Delete old operators; document new operators. + * doc/c-tilepro.texi: Ditto. + +2012-02-25 Walter Lee <walt@tilera.com> + * tc-tilepro.c (apply_special_operator): delete cases for got and tls operators. (md_apply_fix): Ditto. diff --git a/gas/config/tc-tilegx.c b/gas/config/tc-tilegx.c index 49bf093..eda36c0 100644 --- a/gas/config/tc-tilegx.c +++ b/gas/config/tc-tilegx.c @@ -157,27 +157,22 @@ md_show_usage (FILE *stream) #define O_hw1_last O_md6 #define O_hw2_last O_md7 #define O_hw0_got O_md8 -#define O_hw1_got O_md9 -#define O_hw2_got O_md10 -#define O_hw3_got O_md11 -#define O_hw0_last_got O_md12 -#define O_hw1_last_got O_md13 -#define O_hw2_last_got O_md14 -#define O_plt O_md15 -#define O_hw0_tls_gd O_md16 -#define O_hw1_tls_gd O_md17 -#define O_hw2_tls_gd O_md18 -#define O_hw3_tls_gd O_md19 -#define O_hw0_last_tls_gd O_md20 -#define O_hw1_last_tls_gd O_md21 -#define O_hw2_last_tls_gd O_md22 -#define O_hw0_tls_ie O_md23 -#define O_hw1_tls_ie O_md24 -#define O_hw2_tls_ie O_md25 -#define O_hw3_tls_ie O_md26 -#define O_hw0_last_tls_ie O_md27 -#define O_hw1_last_tls_ie O_md28 -#define O_hw2_last_tls_ie O_md29 +#define O_hw0_last_got O_md9 +#define O_hw1_last_got O_md10 +#define O_plt O_md11 +#define O_hw0_tls_gd O_md12 +#define O_hw0_last_tls_gd O_md13 +#define O_hw1_last_tls_gd O_md14 +#define O_hw0_tls_ie O_md15 +#define O_hw0_last_tls_ie O_md16 +#define O_hw1_last_tls_ie O_md17 +#define O_hw0_tls_le O_md18 +#define O_hw0_last_tls_le O_md19 +#define O_hw1_last_tls_le O_md20 +#define O_tls_gd_call O_md21 +#define O_tls_gd_add O_md22 +#define O_tls_ie_load O_md23 +#define O_tls_add O_md24 static struct hash_control *special_operator_hash; @@ -289,27 +284,22 @@ md_begin (void) /* hw3_last is a convenience alias for the equivalent hw3. */ hash_insert (special_operator_hash, "hw3_last", (void*)O_hw3); INSERT_SPECIAL_OP (hw0_got); - INSERT_SPECIAL_OP (hw1_got); - INSERT_SPECIAL_OP (hw2_got); - INSERT_SPECIAL_OP (hw3_got); INSERT_SPECIAL_OP (hw0_last_got); INSERT_SPECIAL_OP (hw1_last_got); - INSERT_SPECIAL_OP (hw2_last_got); INSERT_SPECIAL_OP(plt); INSERT_SPECIAL_OP (hw0_tls_gd); - INSERT_SPECIAL_OP (hw1_tls_gd); - INSERT_SPECIAL_OP (hw2_tls_gd); - INSERT_SPECIAL_OP (hw3_tls_gd); INSERT_SPECIAL_OP (hw0_last_tls_gd); INSERT_SPECIAL_OP (hw1_last_tls_gd); - INSERT_SPECIAL_OP (hw2_last_tls_gd); INSERT_SPECIAL_OP (hw0_tls_ie); - INSERT_SPECIAL_OP (hw1_tls_ie); - INSERT_SPECIAL_OP (hw2_tls_ie); - INSERT_SPECIAL_OP (hw3_tls_ie); INSERT_SPECIAL_OP (hw0_last_tls_ie); INSERT_SPECIAL_OP (hw1_last_tls_ie); - INSERT_SPECIAL_OP (hw2_last_tls_ie); + INSERT_SPECIAL_OP (hw0_tls_le); + INSERT_SPECIAL_OP (hw0_last_tls_le); + INSERT_SPECIAL_OP (hw1_last_tls_le); + INSERT_SPECIAL_OP (tls_gd_call); + INSERT_SPECIAL_OP (tls_gd_add); + INSERT_SPECIAL_OP (tls_ie_load); + INSERT_SPECIAL_OP (tls_add); #undef INSERT_SPECIAL_OP /* Initialize op_hash hash table. */ @@ -566,21 +556,6 @@ emit_tilegx_instruction (tilegx_bundle_bits bits, require_symbol = 1; break; - case O_hw1_got: - HANDLE_OP16 (HW1_GOT); - require_symbol = 1; - break; - - case O_hw2_got: - HANDLE_OP16 (HW2_GOT); - require_symbol = 1; - break; - - case O_hw3_got: - HANDLE_OP16 (HW3_GOT); - require_symbol = 1; - break; - case O_hw0_last_got: HANDLE_OP16 (HW0_LAST_GOT); require_symbol = 1; @@ -591,88 +566,132 @@ emit_tilegx_instruction (tilegx_bundle_bits bits, require_symbol = 1; break; - case O_hw2_last_got: - HANDLE_OP16 (HW2_LAST_GOT); - require_symbol = 1; - break; - case O_hw0_tls_gd: HANDLE_OP16 (HW0_TLS_GD); require_symbol = 1; break; - case O_hw1_tls_gd: - HANDLE_OP16 (HW1_TLS_GD); + case O_hw0_last_tls_gd: + HANDLE_OP16 (HW0_LAST_TLS_GD); require_symbol = 1; break; - case O_hw2_tls_gd: - HANDLE_OP16 (HW2_TLS_GD); + case O_hw1_last_tls_gd: + HANDLE_OP16 (HW1_LAST_TLS_GD); require_symbol = 1; break; - case O_hw3_tls_gd: - HANDLE_OP16 (HW3_TLS_GD); + case O_hw0_tls_ie: + HANDLE_OP16 (HW0_TLS_IE); require_symbol = 1; break; - case O_hw0_last_tls_gd: - HANDLE_OP16 (HW0_LAST_TLS_GD); + case O_hw0_last_tls_ie: + HANDLE_OP16 (HW0_LAST_TLS_IE); require_symbol = 1; break; - case O_hw1_last_tls_gd: - HANDLE_OP16 (HW1_LAST_TLS_GD); + case O_hw1_last_tls_ie: + HANDLE_OP16 (HW1_LAST_TLS_IE); require_symbol = 1; break; - case O_hw2_last_tls_gd: - HANDLE_OP16 (HW2_LAST_TLS_GD); + case O_hw0_tls_le: + HANDLE_OP16 (HW0_TLS_LE); require_symbol = 1; break; - case O_hw0_tls_ie: - HANDLE_OP16 (HW0_TLS_IE); + case O_hw0_last_tls_le: + HANDLE_OP16 (HW0_LAST_TLS_LE); require_symbol = 1; break; - case O_hw1_tls_ie: - HANDLE_OP16 (HW1_TLS_IE); + case O_hw1_last_tls_le: + HANDLE_OP16 (HW1_LAST_TLS_LE); require_symbol = 1; break; - case O_hw2_tls_ie: - HANDLE_OP16 (HW2_TLS_IE); - require_symbol = 1; - break; +#undef HANDLE_OP16 - case O_hw3_tls_ie: - HANDLE_OP16 (HW3_TLS_IE); + case O_plt: + switch (reloc) + { + case BFD_RELOC_TILEGX_JUMPOFF_X1: + reloc = BFD_RELOC_TILEGX_JUMPOFF_X1_PLT; + break; + default: + die = 1; + break; + } + use_subexp = 1; require_symbol = 1; break; - case O_hw0_last_tls_ie: - HANDLE_OP16 (HW0_LAST_TLS_IE); + case O_tls_gd_call: + switch (reloc) + { + case BFD_RELOC_TILEGX_JUMPOFF_X1: + reloc = BFD_RELOC_TILEGX_TLS_GD_CALL; + break; + default: + die = 1; + break; + } + use_subexp = 1; require_symbol = 1; break; - case O_hw1_last_tls_ie: - HANDLE_OP16 (HW1_LAST_TLS_IE); + case O_tls_gd_add: + switch (reloc) + { + case BFD_RELOC_TILEGX_IMM8_X0: + reloc = BFD_RELOC_TILEGX_IMM8_X0_TLS_GD_ADD; + break; + case BFD_RELOC_TILEGX_IMM8_X1: + reloc = BFD_RELOC_TILEGX_IMM8_X1_TLS_GD_ADD; + break; + case BFD_RELOC_TILEGX_IMM8_Y0: + reloc = BFD_RELOC_TILEGX_IMM8_Y0_TLS_GD_ADD; + break; + case BFD_RELOC_TILEGX_IMM8_Y1: + reloc = BFD_RELOC_TILEGX_IMM8_Y1_TLS_GD_ADD; + break; + default: + die = 1; + break; + } + use_subexp = 1; require_symbol = 1; break; - case O_hw2_last_tls_ie: - HANDLE_OP16 (HW2_LAST_TLS_IE); + case O_tls_ie_load: + switch (reloc) + { + case BFD_RELOC_TILEGX_IMM8_X1: + reloc = BFD_RELOC_TILEGX_TLS_IE_LOAD; + break; + default: + die = 1; + break; + } + use_subexp = 1; require_symbol = 1; break; -#undef HANDLE_OP16 - - case O_plt: + case O_tls_add: switch (reloc) { - case BFD_RELOC_TILEGX_JUMPOFF_X1: - reloc = BFD_RELOC_TILEGX_JUMPOFF_X1_PLT; + case BFD_RELOC_TILEGX_IMM8_X0: + reloc = BFD_RELOC_TILEGX_IMM8_X0_TLS_ADD; + break; + case BFD_RELOC_TILEGX_IMM8_X1: + reloc = BFD_RELOC_TILEGX_IMM8_X1_TLS_ADD; + break; + case BFD_RELOC_TILEGX_IMM8_Y0: + reloc = BFD_RELOC_TILEGX_IMM8_Y0_TLS_ADD; + break; + case BFD_RELOC_TILEGX_IMM8_Y1: + reloc = BFD_RELOC_TILEGX_IMM8_Y1_TLS_ADD; break; default: die = 1; @@ -1486,34 +1505,34 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED) #ifdef OBJ_ELF switch (fixP->fx_r_type) { + case BFD_RELOC_TILEGX_IMM8_X0_TLS_ADD: + case BFD_RELOC_TILEGX_IMM8_X1_TLS_ADD: + case BFD_RELOC_TILEGX_IMM8_Y0_TLS_ADD: + case BFD_RELOC_TILEGX_IMM8_Y1_TLS_ADD: + case BFD_RELOC_TILEGX_IMM8_X0_TLS_GD_ADD: + case BFD_RELOC_TILEGX_IMM8_X1_TLS_GD_ADD: + case BFD_RELOC_TILEGX_IMM8_Y0_TLS_GD_ADD: + case BFD_RELOC_TILEGX_IMM8_Y1_TLS_GD_ADD: case BFD_RELOC_TILEGX_IMM16_X0_HW0_TLS_GD: case BFD_RELOC_TILEGX_IMM16_X1_HW0_TLS_GD: - case BFD_RELOC_TILEGX_IMM16_X0_HW0_TLS_IE: - case BFD_RELOC_TILEGX_IMM16_X1_HW0_TLS_IE: case BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_TLS_GD: case BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_TLS_GD: - case BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_TLS_IE: - case BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_TLS_IE: - case BFD_RELOC_TILEGX_IMM16_X0_HW1_TLS_GD: - case BFD_RELOC_TILEGX_IMM16_X1_HW1_TLS_GD: - case BFD_RELOC_TILEGX_IMM16_X0_HW1_TLS_IE: - case BFD_RELOC_TILEGX_IMM16_X1_HW1_TLS_IE: case BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_TLS_GD: case BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_TLS_GD: + case BFD_RELOC_TILEGX_IMM16_X0_HW0_TLS_IE: + case BFD_RELOC_TILEGX_IMM16_X1_HW0_TLS_IE: + case BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_TLS_IE: + case BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_TLS_IE: case BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_TLS_IE: case BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_TLS_IE: - case BFD_RELOC_TILEGX_IMM16_X0_HW2_TLS_GD: - case BFD_RELOC_TILEGX_IMM16_X1_HW2_TLS_GD: - case BFD_RELOC_TILEGX_IMM16_X0_HW2_TLS_IE: - case BFD_RELOC_TILEGX_IMM16_X1_HW2_TLS_IE: - case BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST_TLS_GD: - case BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_TLS_GD: - case BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST_TLS_IE: - case BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_TLS_IE: - case BFD_RELOC_TILEGX_IMM16_X0_HW3_TLS_GD: - case BFD_RELOC_TILEGX_IMM16_X1_HW3_TLS_GD: - case BFD_RELOC_TILEGX_IMM16_X0_HW3_TLS_IE: - case BFD_RELOC_TILEGX_IMM16_X1_HW3_TLS_IE: + case BFD_RELOC_TILEGX_IMM16_X0_HW0_TLS_LE: + case BFD_RELOC_TILEGX_IMM16_X1_HW0_TLS_LE: + case BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_TLS_LE: + case BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_TLS_LE: + case BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_TLS_LE: + case BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_TLS_LE: + case BFD_RELOC_TILEGX_TLS_GD_CALL: + case BFD_RELOC_TILEGX_TLS_IE_LOAD: case BFD_RELOC_TILEGX_TLS_DTPMOD64: case BFD_RELOC_TILEGX_TLS_DTPOFF64: case BFD_RELOC_TILEGX_TLS_TPOFF64: diff --git a/gas/config/tc-tilepro.c b/gas/config/tc-tilepro.c index 581028d..0b378c2 100644 --- a/gas/config/tc-tilepro.c +++ b/gas/config/tc-tilepro.c @@ -103,14 +103,14 @@ md_show_usage (FILE *stream) /* Extra expression types. */ -#define O_lo16 O_md1 -#define O_hi16 O_md2 -#define O_ha16 O_md3 -#define O_got O_md4 +#define O_lo16 O_md1 +#define O_hi16 O_md2 +#define O_ha16 O_md3 +#define O_got O_md4 #define O_got_lo16 O_md5 #define O_got_hi16 O_md6 #define O_got_ha16 O_md7 -#define O_plt O_md8 +#define O_plt O_md8 #define O_tls_gd O_md9 #define O_tls_gd_lo16 O_md10 #define O_tls_gd_hi16 O_md11 @@ -119,6 +119,13 @@ md_show_usage (FILE *stream) #define O_tls_ie_lo16 O_md14 #define O_tls_ie_hi16 O_md15 #define O_tls_ie_ha16 O_md16 +#define O_tls_le O_md17 +#define O_tls_le_lo16 O_md18 +#define O_tls_le_hi16 O_md19 +#define O_tls_le_ha16 O_md20 +#define O_tls_gd_call O_md21 +#define O_tls_gd_add O_md22 +#define O_tls_ie_load O_md23 static struct hash_control *special_operator_hash; @@ -230,6 +237,13 @@ md_begin (void) INSERT_SPECIAL_OP(tls_ie_lo16); INSERT_SPECIAL_OP(tls_ie_hi16); INSERT_SPECIAL_OP(tls_ie_ha16); + INSERT_SPECIAL_OP(tls_le); + INSERT_SPECIAL_OP(tls_le_lo16); + INSERT_SPECIAL_OP(tls_le_hi16); + INSERT_SPECIAL_OP(tls_le_ha16); + INSERT_SPECIAL_OP(tls_gd_call); + INSERT_SPECIAL_OP(tls_gd_add); + INSERT_SPECIAL_OP(tls_ie_load); #undef INSERT_SPECIAL_OP /* Initialize op_hash hash table. */ @@ -516,6 +530,26 @@ emit_tilepro_instruction (tilepro_bundle_bits bits, require_symbol = 1; break; + case O_tls_le: + HANDLE_OP16 (TLS_LE); + require_symbol = 1; + break; + + case O_tls_le_lo16: + HANDLE_OP16 (TLS_LE_LO); + require_symbol = 1; + break; + + case O_tls_le_hi16: + HANDLE_OP16 (TLS_LE_HI); + require_symbol = 1; + break; + + case O_tls_le_ha16: + HANDLE_OP16 (TLS_LE_HA); + require_symbol = 1; + break; + #undef HANDLE_OP16 case O_plt: @@ -532,6 +566,57 @@ emit_tilepro_instruction (tilepro_bundle_bits bits, require_symbol = 1; break; + case O_tls_gd_call: + switch (reloc) + { + case BFD_RELOC_TILEPRO_JOFFLONG_X1: + reloc = BFD_RELOC_TILEPRO_TLS_GD_CALL; + break; + default: + die = 1; + break; + } + use_subexp = 1; + require_symbol = 1; + break; + + case O_tls_gd_add: + switch (reloc) + { + case BFD_RELOC_TILEPRO_IMM8_X0: + reloc = BFD_RELOC_TILEPRO_IMM8_X0_TLS_GD_ADD; + break; + case BFD_RELOC_TILEPRO_IMM8_X1: + reloc = BFD_RELOC_TILEPRO_IMM8_X1_TLS_GD_ADD; + break; + case BFD_RELOC_TILEPRO_IMM8_Y0: + reloc = BFD_RELOC_TILEPRO_IMM8_Y0_TLS_GD_ADD; + break; + case BFD_RELOC_TILEPRO_IMM8_Y1: + reloc = BFD_RELOC_TILEPRO_IMM8_Y1_TLS_GD_ADD; + break; + default: + die = 1; + break; + } + use_subexp = 1; + require_symbol = 1; + break; + + case O_tls_ie_load: + switch (reloc) + { + case BFD_RELOC_TILEPRO_IMM8_X1: + reloc = BFD_RELOC_TILEPRO_TLS_IE_LOAD; + break; + default: + die = 1; + break; + } + use_subexp = 1; + require_symbol = 1; + break; + default: /* Do nothing. */ break; @@ -1298,22 +1383,36 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg ATTRIBUTE_UNUSED) #ifdef OBJ_ELF switch (fixP->fx_r_type) { + case BFD_RELOC_TILEPRO_IMM8_X0_TLS_GD_ADD: + case BFD_RELOC_TILEPRO_IMM8_X1_TLS_GD_ADD: + case BFD_RELOC_TILEPRO_IMM8_Y0_TLS_GD_ADD: + case BFD_RELOC_TILEPRO_IMM8_Y1_TLS_GD_ADD: case BFD_RELOC_TILEPRO_IMM16_X0_TLS_GD: case BFD_RELOC_TILEPRO_IMM16_X1_TLS_GD: - case BFD_RELOC_TILEPRO_IMM16_X0_TLS_IE: - case BFD_RELOC_TILEPRO_IMM16_X1_TLS_IE: case BFD_RELOC_TILEPRO_IMM16_X0_TLS_GD_LO: case BFD_RELOC_TILEPRO_IMM16_X1_TLS_GD_LO: - case BFD_RELOC_TILEPRO_IMM16_X0_TLS_IE_LO: - case BFD_RELOC_TILEPRO_IMM16_X1_TLS_IE_LO: case BFD_RELOC_TILEPRO_IMM16_X0_TLS_GD_HI: case BFD_RELOC_TILEPRO_IMM16_X1_TLS_GD_HI: - case BFD_RELOC_TILEPRO_IMM16_X0_TLS_IE_HI: - case BFD_RELOC_TILEPRO_IMM16_X1_TLS_IE_HI: case BFD_RELOC_TILEPRO_IMM16_X0_TLS_GD_HA: case BFD_RELOC_TILEPRO_IMM16_X1_TLS_GD_HA: + case BFD_RELOC_TILEPRO_IMM16_X0_TLS_IE: + case BFD_RELOC_TILEPRO_IMM16_X1_TLS_IE: + case BFD_RELOC_TILEPRO_IMM16_X0_TLS_IE_LO: + case BFD_RELOC_TILEPRO_IMM16_X1_TLS_IE_LO: + case BFD_RELOC_TILEPRO_IMM16_X0_TLS_IE_HI: + case BFD_RELOC_TILEPRO_IMM16_X1_TLS_IE_HI: case BFD_RELOC_TILEPRO_IMM16_X0_TLS_IE_HA: case BFD_RELOC_TILEPRO_IMM16_X1_TLS_IE_HA: + case BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE: + case BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE: + case BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE_LO: + case BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE_LO: + case BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE_HI: + case BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE_HI: + case BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE_HA: + case BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE_HA: + case BFD_RELOC_TILEPRO_TLS_GD_CALL: + case BFD_RELOC_TILEPRO_TLS_IE_LOAD: case BFD_RELOC_TILEPRO_TLS_DTPMOD32: case BFD_RELOC_TILEPRO_TLS_DTPOFF32: case BFD_RELOC_TILEPRO_TLS_TPOFF32: diff --git a/gas/doc/c-tilegx.texi b/gas/doc/c-tilegx.texi index c2f5bc1..268cc4f 100644 --- a/gas/doc/c-tilegx.texi +++ b/gas/doc/c-tilegx.texi @@ -218,21 +218,6 @@ shl16insli r0, r0, hw0(sym) This modifier is used to load bits 0-15 of the symbol's offset in the GOT entry corresponding to the symbol. -@item hw1_got - -This modifier is used to load bits 16-31 of the symbol's offset in the -GOT entry corresponding to the symbol. - -@item hw2_got - -This modifier is used to load bits 32-47 of the symbol's offset in the -GOT entry corresponding to the symbol. - -@item hw3_got - -This modifier is used to load bits 48-63 of the symbol's offset in the -GOT entry corresponding to the symbol. - @item hw0_last_got This modifier yields the same value as @code{hw0_got}, but it also @@ -240,13 +225,9 @@ checks that the value does not overflow. @item hw1_last_got -This modifier yields the same value as @code{hw1_got}, but it also -checks that the value does not overflow. - -@item hw2_last_got - -This modifier yields the same value as @code{hw2_got}, but it also -checks that the value does not overflow. +This modifier is used to load bits 16-31 of the symbol's offset in the +GOT entry corresponding to the symbol, and it also checks that the +value does not overflow. @item plt @@ -267,24 +248,6 @@ This modifier is used to load bits 0-15 of the offset of the GOT entry of the symbol's TLS descriptor, to be used for general-dynamic TLS accesses. -@item hw1_tls_gd - -This modifier is used to load bits 16-31 of the offset of the GOT -entry of the symbol's TLS descriptor, to be used for general-dynamic -TLS accesses. - -@item hw2_tls_gd - -This modifier is used to load bits 32-47 of the offset of the GOT -entry of the symbol's TLS descriptor, to be used for general-dynamic -TLS accesses. - -@item hw3_tls_gd - -This modifier is used to load bits 48-63 of the offset of the GOT -entry of the symbol's TLS descriptor, to be used for general-dynamic -TLS accesses. - @item hw0_last_tls_gd This modifier yields the same value as @code{hw0_tls_gd}, but it also @@ -292,13 +255,9 @@ checks that the value does not overflow. @item hw1_last_tls_gd -This modifier yields the same value as @code{hw1_tls_gd}, but it also -checks that the value does not overflow. - -@item hw2_last_tls_gd - -This modifier yields the same value as @code{hw2_tls_gd}, but it also -checks that the value does not overflow. +This modifier is used to load bits 16-31 of the offset of the GOT +entry of the symbol's TLS descriptor, to be used for general-dynamic +TLS accesses. It also checks that the value does not overflow. @item hw0_tls_ie @@ -306,38 +265,48 @@ This modifier is used to load bits 0-15 of the offset of the GOT entry containing the offset of the symbol's address from the TCB, to be used for initial-exec TLS accesses. -@item hw1_tls_ie +@item hw0_last_tls_ie + +This modifier yields the same value as @code{hw0_tls_ie}, but it also +checks that the value does not overflow. + +@item hw1_last_tls_ie This modifier is used to load bits 16-31 of the offset of the GOT entry containing the offset of the symbol's address from the TCB, to -be used for initial-exec TLS accesses. +be used for initial-exec TLS accesses. It also checks that the value +does not overflow. -@item hw2_tls_ie +@item hw0_tls_le -This modifier is used to load bits 32-47 of the offset of the GOT entry -containing the offset of the symbol's address from the TCB, to be used -for initial-exec TLS accesses. +This modifier is used to load bits 0-15 of the offset of the symbol's +address from the TCB, to be used for local-exec TLS accesses. -@item hw3_tls_ie +@item hw0_last_tls_le -This modifier is used to load bits 48-63 of the offset of the GOT -entry containing the offset of the symbol's address from the TCB, to -be used for initial-exec TLS accesses. +This modifier yields the same value as @code{hw0_tls_le}, but it also +checks that the value does not overflow. -@item hw0_last_tls_ie +@item hw1_last_tls_le -This modifier yields the same value as @code{hw0_tls_ie}, but it also -checks that the value does not overflow. +This modifier is used to load bits 16-31 of the offset of the symbol's +address from the TCB, to be used for local-exec TLS accesses. It +also checks that the value does not overflow. -@item hw1_last_tls_ie +@item tls_gd_call -This modifier yields the same value as @code{hw1_tls_ie}, but it also -checks that the value does not overflow. +This modifier is used to tag an instrution as the ``call'' part of a +calling sequence for a TLS GD reference of its operand. -@item hw2_last_tls_ie +@item tls_gd_add -This modifier yields the same value as @code{hw2_tls_ie}, but it also -checks that the value does not overflow. +This modifier is used to tag an instruction as the ``add'' part of a +calling sequence for a TLS GD reference of its operand. + +@item tls_ie_load + +This modifier is used to tag an instruction as the ``load'' part of a +calling sequence for a TLS IE reference of its operand. @end table diff --git a/gas/doc/c-tilepro.texi b/gas/doc/c-tilepro.texi index bbccdfb..5d80c4f 100644 --- a/gas/doc/c-tilepro.texi +++ b/gas/doc/c-tilepro.texi @@ -261,6 +261,41 @@ to be used for initial-exec TLS accesses. This modifier is like @code{tls_ie_hi16}, but it adds one to the value if @code{tls_ie_lo16} of the input value is negative. +@item tls_le + +This modifier is used to load the offset of the symbol's address from +the TCB, to be used for local-exec TLS accesses. + +@item tls_le_lo16 + +This modifier is used to load the low 16 bits of the offset of the +symbol's address from the TCB, to be used for local-exec TLS accesses. + +@item tls_le_hi16 + +This modifier is used to load the high 16 bits of the offset of the +symbol's address from the TCB, to be used for local-exec TLS accesses. + +@item tls_le_ha16 + +This modifier is like @code{tls_le_hi16}, but it adds one to the value +if @code{tls_le_lo16} of the input value is negative. + +@item tls_gd_call + +This modifier is used to tag an instrution as the ``call'' part of a +calling sequence for a TLS GD reference of its operand. + +@item tls_gd_add + +This modifier is used to tag an instruction as the ``add'' part of a +calling sequence for a TLS GD reference of its operand. + +@item tls_ie_load + +This modifier is used to tag an instruction as the ``load'' part of a +calling sequence for a TLS IE reference of its operand. + @end table @node TILEPro Directives |