6f7be9592d
- 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.
145 lines
5.7 KiB
C
145 lines
5.7 KiB
C
/* TILEPro ELF support for BFD.
|
|
Copyright 2011 Free Software Foundation, Inc.
|
|
|
|
This file is part of BFD, the Binary File Descriptor library.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
|
MA 02110-1301, USA. */
|
|
|
|
#ifndef _ELF_TILEPRO_H
|
|
#define _ELF_TILEPRO_H
|
|
|
|
#include "elf/reloc-macros.h"
|
|
|
|
/* Relocations. */
|
|
START_RELOC_NUMBERS (elf_tilepro_reloc_type)
|
|
RELOC_NUMBER (R_TILEPRO_NONE, 0)
|
|
|
|
/* Standard relocations */
|
|
RELOC_NUMBER (R_TILEPRO_32, 1)
|
|
RELOC_NUMBER (R_TILEPRO_16, 2)
|
|
RELOC_NUMBER (R_TILEPRO_8, 3)
|
|
RELOC_NUMBER (R_TILEPRO_32_PCREL, 4)
|
|
RELOC_NUMBER (R_TILEPRO_16_PCREL, 5)
|
|
RELOC_NUMBER (R_TILEPRO_8_PCREL, 6)
|
|
|
|
RELOC_NUMBER (R_TILEPRO_LO16, 7)
|
|
RELOC_NUMBER (R_TILEPRO_HI16, 8)
|
|
RELOC_NUMBER (R_TILEPRO_HA16, 9)
|
|
|
|
RELOC_NUMBER (R_TILEPRO_COPY, 10)
|
|
RELOC_NUMBER (R_TILEPRO_GLOB_DAT, 11)
|
|
RELOC_NUMBER (R_TILEPRO_JMP_SLOT, 12)
|
|
RELOC_NUMBER (R_TILEPRO_RELATIVE, 13)
|
|
|
|
/* Branch/jump offsets */
|
|
RELOC_NUMBER (R_TILEPRO_BROFF_X1, 14)
|
|
RELOC_NUMBER (R_TILEPRO_JOFFLONG_X1, 15)
|
|
RELOC_NUMBER (R_TILEPRO_JOFFLONG_X1_PLT, 16)
|
|
|
|
/* Immediate operands. */
|
|
RELOC_NUMBER (R_TILEPRO_IMM8_X0, 17)
|
|
RELOC_NUMBER (R_TILEPRO_IMM8_Y0, 18)
|
|
RELOC_NUMBER (R_TILEPRO_IMM8_X1, 19)
|
|
RELOC_NUMBER (R_TILEPRO_IMM8_Y1, 20)
|
|
RELOC_NUMBER (R_TILEPRO_MT_IMM15_X1, 21)
|
|
RELOC_NUMBER (R_TILEPRO_MF_IMM15_X1, 22)
|
|
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X0, 23)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X1, 24)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X0_LO, 25)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X1_LO, 26)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X0_HI, 27)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X1_HI, 28)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X0_HA, 29)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X1_HA, 30)
|
|
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X0_PCREL, 31)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X1_PCREL, 32)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X0_LO_PCREL, 33)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X1_LO_PCREL, 34)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X0_HI_PCREL, 35)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X1_HI_PCREL, 36)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X0_HA_PCREL, 37)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X1_HA_PCREL, 38)
|
|
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X0_GOT, 39)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X1_GOT, 40)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X0_GOT_LO, 41)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X1_GOT_LO, 42)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X0_GOT_HI, 43)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X1_GOT_HI, 44)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X0_GOT_HA, 45)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X1_GOT_HA, 46)
|
|
|
|
RELOC_NUMBER (R_TILEPRO_MMSTART_X0, 47)
|
|
RELOC_NUMBER (R_TILEPRO_MMEND_X0, 48)
|
|
RELOC_NUMBER (R_TILEPRO_MMSTART_X1, 49)
|
|
RELOC_NUMBER (R_TILEPRO_MMEND_X1, 50)
|
|
|
|
RELOC_NUMBER (R_TILEPRO_SHAMT_X0, 51)
|
|
RELOC_NUMBER (R_TILEPRO_SHAMT_X1, 52)
|
|
RELOC_NUMBER (R_TILEPRO_SHAMT_Y0, 53)
|
|
RELOC_NUMBER (R_TILEPRO_SHAMT_Y1, 54)
|
|
|
|
RELOC_NUMBER (R_TILEPRO_DEST_IMM8_X1, 55)
|
|
|
|
/* Relocs 56-59 are currently not defined. */
|
|
|
|
RELOC_NUMBER (R_TILEPRO_TLS_GD_CALL, 60)
|
|
RELOC_NUMBER (R_TILEPRO_IMM8_X0_TLS_GD_ADD, 61)
|
|
RELOC_NUMBER (R_TILEPRO_IMM8_X1_TLS_GD_ADD, 62)
|
|
RELOC_NUMBER (R_TILEPRO_IMM8_Y0_TLS_GD_ADD, 63)
|
|
RELOC_NUMBER (R_TILEPRO_IMM8_Y1_TLS_GD_ADD, 64)
|
|
RELOC_NUMBER (R_TILEPRO_TLS_IE_LOAD, 65)
|
|
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X0_TLS_GD, 66)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X1_TLS_GD, 67)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X0_TLS_GD_LO, 68)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X1_TLS_GD_LO, 69)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X0_TLS_GD_HI, 70)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X1_TLS_GD_HI, 71)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X0_TLS_GD_HA, 72)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X1_TLS_GD_HA, 73)
|
|
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X0_TLS_IE, 74)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X1_TLS_IE, 75)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X0_TLS_IE_LO, 76)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X1_TLS_IE_LO, 77)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X0_TLS_IE_HI, 78)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X1_TLS_IE_HI, 79)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X0_TLS_IE_HA, 80)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X1_TLS_IE_HA, 81)
|
|
|
|
RELOC_NUMBER (R_TILEPRO_TLS_DTPMOD32, 82)
|
|
RELOC_NUMBER (R_TILEPRO_TLS_DTPOFF32, 83)
|
|
RELOC_NUMBER (R_TILEPRO_TLS_TPOFF32, 84)
|
|
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X0_TLS_LE, 85)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X1_TLS_LE, 86)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X0_TLS_LE_LO, 87)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X1_TLS_LE_LO, 88)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X0_TLS_LE_HI, 89)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X1_TLS_LE_HI, 90)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X0_TLS_LE_HA, 91)
|
|
RELOC_NUMBER (R_TILEPRO_IMM16_X1_TLS_LE_HA, 92)
|
|
|
|
/* These are GNU extensions to enable C++ vtable garbage collection. */
|
|
RELOC_NUMBER (R_TILEPRO_GNU_VTINHERIT, 128)
|
|
RELOC_NUMBER (R_TILEPRO_GNU_VTENTRY, 129)
|
|
END_RELOC_NUMBERS (R_TILEPRO_max)
|
|
|
|
#endif /* _ELF_TILEPRO_H */
|