Line 117... |
Line 117... |
#define O_tls_gd_ha16 O_md12
|
#define O_tls_gd_ha16 O_md12
|
#define O_tls_ie O_md13
|
#define O_tls_ie O_md13
|
#define O_tls_ie_lo16 O_md14
|
#define O_tls_ie_lo16 O_md14
|
#define O_tls_ie_hi16 O_md15
|
#define O_tls_ie_hi16 O_md15
|
#define O_tls_ie_ha16 O_md16
|
#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;
|
static struct hash_control *special_operator_hash;
|
|
|
/* Hash tables for instruction mnemonic lookup. */
|
/* Hash tables for instruction mnemonic lookup. */
|
static struct hash_control *op_hash;
|
static struct hash_control *op_hash;
|
Line 228... |
Line 235... |
INSERT_SPECIAL_OP(tls_gd_ha16);
|
INSERT_SPECIAL_OP(tls_gd_ha16);
|
INSERT_SPECIAL_OP(tls_ie);
|
INSERT_SPECIAL_OP(tls_ie);
|
INSERT_SPECIAL_OP(tls_ie_lo16);
|
INSERT_SPECIAL_OP(tls_ie_lo16);
|
INSERT_SPECIAL_OP(tls_ie_hi16);
|
INSERT_SPECIAL_OP(tls_ie_hi16);
|
INSERT_SPECIAL_OP(tls_ie_ha16);
|
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
|
#undef INSERT_SPECIAL_OP
|
|
|
/* Initialize op_hash hash table. */
|
/* Initialize op_hash hash table. */
|
op_hash = hash_new ();
|
op_hash = hash_new ();
|
for (op = &tilepro_opcodes[0]; op->name != NULL; op++)
|
for (op = &tilepro_opcodes[0]; op->name != NULL; op++)
|
Line 379... |
Line 393... |
apply_special_operator (operatorT op, int num)
|
apply_special_operator (operatorT op, int num)
|
{
|
{
|
switch (op)
|
switch (op)
|
{
|
{
|
case O_lo16:
|
case O_lo16:
|
case O_got:
|
|
case O_got_lo16:
|
|
case O_tls_gd:
|
|
case O_tls_gd_lo16:
|
|
case O_tls_ie:
|
|
case O_tls_ie_lo16:
|
|
return (signed short)num;
|
return (signed short)num;
|
|
|
case O_hi16:
|
case O_hi16:
|
case O_got_hi16:
|
|
case O_tls_gd_hi16:
|
|
case O_tls_ie_hi16:
|
|
return (signed short)(num >> 16);
|
return (signed short)(num >> 16);
|
|
|
case O_ha16:
|
case O_ha16:
|
case O_got_ha16:
|
|
case O_tls_gd_ha16:
|
|
case O_tls_ie_ha16:
|
|
return (signed short)((num + 0x8000) >> 16);
|
return (signed short)((num + 0x8000) >> 16);
|
|
|
default:
|
default:
|
abort ();
|
abort ();
|
}
|
}
|
Line 526... |
Line 528... |
case O_tls_ie_ha16:
|
case O_tls_ie_ha16:
|
HANDLE_OP16 (TLS_IE_HA);
|
HANDLE_OP16 (TLS_IE_HA);
|
require_symbol = 1;
|
require_symbol = 1;
|
break;
|
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
|
#undef HANDLE_OP16
|
|
|
case O_plt:
|
case O_plt:
|
switch (reloc)
|
switch (reloc)
|
{
|
{
|
Line 542... |
Line 564... |
}
|
}
|
use_subexp = 1;
|
use_subexp = 1;
|
require_symbol = 1;
|
require_symbol = 1;
|
break;
|
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:
|
default:
|
/* Do nothing. */
|
/* Do nothing. */
|
break;
|
break;
|
}
|
}
|
|
|
Line 556... |
Line 629... |
else if (use_subexp)
|
else if (use_subexp)
|
{
|
{
|
/* Now that we've changed the reloc, change ha16(x) into x,
|
/* Now that we've changed the reloc, change ha16(x) into x,
|
etc. */
|
etc. */
|
|
|
if (operand_exp->X_add_symbol->sy_value.X_md)
|
if (!operand_exp->X_add_symbol->sy_flags.sy_local_symbol
|
|
&& operand_exp->X_add_symbol->sy_value.X_md)
|
{
|
{
|
/* HACK: We used X_md to mark this symbol as a fake wrapper
|
/* HACK: We used X_md to mark this symbol as a fake wrapper
|
around a real expression. To unwrap it, we just grab its
|
around a real expression. To unwrap it, we just grab its
|
value here. */
|
value here. */
|
operand_exp = &operand_exp->X_add_symbol->sy_value;
|
operand_exp = &operand_exp->X_add_symbol->sy_value;
|
Line 1308... |
Line 1382... |
if (fixP->fx_addsy != NULL)
|
if (fixP->fx_addsy != NULL)
|
{
|
{
|
#ifdef OBJ_ELF
|
#ifdef OBJ_ELF
|
switch (fixP->fx_r_type)
|
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_X0_TLS_GD:
|
case BFD_RELOC_TILEPRO_IMM16_X1_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_X0_TLS_GD_LO:
|
case BFD_RELOC_TILEPRO_IMM16_X1_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_X0_TLS_GD_HI:
|
case BFD_RELOC_TILEPRO_IMM16_X1_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_X0_TLS_GD_HA:
|
case BFD_RELOC_TILEPRO_IMM16_X1_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_X0_TLS_IE_HA:
|
case BFD_RELOC_TILEPRO_IMM16_X1_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_DTPMOD32:
|
case BFD_RELOC_TILEPRO_TLS_DTPOFF32:
|
case BFD_RELOC_TILEPRO_TLS_DTPOFF32:
|
case BFD_RELOC_TILEPRO_TLS_TPOFF32:
|
case BFD_RELOC_TILEPRO_TLS_TPOFF32:
|
S_SET_THREAD_LOCAL (fixP->fx_addsy);
|
S_SET_THREAD_LOCAL (fixP->fx_addsy);
|
break;
|
break;
|
Line 1341... |
Line 1429... |
}
|
}
|
|
|
/* Apply lo16, hi16, ha16, etc. munging. */
|
/* Apply lo16, hi16, ha16, etc. munging. */
|
switch (fixP->fx_r_type)
|
switch (fixP->fx_r_type)
|
{
|
{
|
case BFD_RELOC_TILEPRO_IMM16_X0_GOT:
|
|
case BFD_RELOC_TILEPRO_IMM16_X1_GOT:
|
|
*valP = value = apply_special_operator (O_got, value);
|
|
break;
|
|
|
|
case BFD_RELOC_TILEPRO_IMM16_X0_GOT_LO:
|
|
case BFD_RELOC_TILEPRO_IMM16_X1_GOT_LO:
|
|
*valP = value = apply_special_operator (O_got_lo16, value);
|
|
break;
|
|
|
|
case BFD_RELOC_TILEPRO_IMM16_X0_GOT_HI:
|
|
case BFD_RELOC_TILEPRO_IMM16_X1_GOT_HI:
|
|
*valP = value = apply_special_operator (O_got_hi16, value);
|
|
break;
|
|
|
|
case BFD_RELOC_TILEPRO_IMM16_X0_GOT_HA:
|
|
case BFD_RELOC_TILEPRO_IMM16_X1_GOT_HA:
|
|
*valP = value = apply_special_operator (O_got_ha16, value);
|
|
break;
|
|
|
|
case BFD_RELOC_TILEPRO_IMM16_X0_TLS_GD:
|
|
case BFD_RELOC_TILEPRO_IMM16_X1_TLS_GD:
|
|
*valP = value = apply_special_operator (O_tls_gd, value);
|
|
break;
|
|
|
|
case BFD_RELOC_TILEPRO_IMM16_X0_TLS_IE:
|
|
case BFD_RELOC_TILEPRO_IMM16_X1_TLS_IE:
|
|
*valP = value = apply_special_operator (O_tls_ie, value);
|
|
break;
|
|
|
|
case BFD_RELOC_LO16:
|
case BFD_RELOC_LO16:
|
case BFD_RELOC_TILEPRO_IMM16_X0_LO:
|
case BFD_RELOC_TILEPRO_IMM16_X0_LO:
|
case BFD_RELOC_TILEPRO_IMM16_X1_LO:
|
case BFD_RELOC_TILEPRO_IMM16_X1_LO:
|
case BFD_RELOC_TILEPRO_IMM16_X0_LO_PCREL:
|
case BFD_RELOC_TILEPRO_IMM16_X0_LO_PCREL:
|
case BFD_RELOC_TILEPRO_IMM16_X1_LO_PCREL:
|
case BFD_RELOC_TILEPRO_IMM16_X1_LO_PCREL:
|
*valP = value = apply_special_operator (O_lo16, value);
|
*valP = value = apply_special_operator (O_lo16, value);
|
break;
|
break;
|
|
|
case BFD_RELOC_TILEPRO_IMM16_X0_TLS_GD_LO:
|
|
case BFD_RELOC_TILEPRO_IMM16_X1_TLS_GD_LO:
|
|
*valP = value = apply_special_operator (O_tls_gd_lo16, value);
|
|
break;
|
|
|
|
case BFD_RELOC_TILEPRO_IMM16_X0_TLS_IE_LO:
|
|
case BFD_RELOC_TILEPRO_IMM16_X1_TLS_IE_LO:
|
|
*valP = value = apply_special_operator (O_tls_ie_lo16, value);
|
|
break;
|
|
|
|
case BFD_RELOC_HI16:
|
case BFD_RELOC_HI16:
|
case BFD_RELOC_TILEPRO_IMM16_X0_HI:
|
case BFD_RELOC_TILEPRO_IMM16_X0_HI:
|
case BFD_RELOC_TILEPRO_IMM16_X1_HI:
|
case BFD_RELOC_TILEPRO_IMM16_X1_HI:
|
case BFD_RELOC_TILEPRO_IMM16_X0_HI_PCREL:
|
case BFD_RELOC_TILEPRO_IMM16_X0_HI_PCREL:
|
case BFD_RELOC_TILEPRO_IMM16_X1_HI_PCREL:
|
case BFD_RELOC_TILEPRO_IMM16_X1_HI_PCREL:
|
*valP = value = apply_special_operator (O_hi16, value);
|
*valP = value = apply_special_operator (O_hi16, value);
|
break;
|
break;
|
|
|
case BFD_RELOC_TILEPRO_IMM16_X0_TLS_GD_HI:
|
|
case BFD_RELOC_TILEPRO_IMM16_X1_TLS_GD_HI:
|
|
*valP = value = apply_special_operator (O_tls_gd_hi16, value);
|
|
break;
|
|
|
|
case BFD_RELOC_TILEPRO_IMM16_X0_TLS_IE_HI:
|
|
case BFD_RELOC_TILEPRO_IMM16_X1_TLS_IE_HI:
|
|
*valP = value = apply_special_operator (O_tls_ie_hi16, value);
|
|
break;
|
|
|
|
case BFD_RELOC_HI16_S:
|
case BFD_RELOC_HI16_S:
|
case BFD_RELOC_TILEPRO_IMM16_X0_HA:
|
case BFD_RELOC_TILEPRO_IMM16_X0_HA:
|
case BFD_RELOC_TILEPRO_IMM16_X1_HA:
|
case BFD_RELOC_TILEPRO_IMM16_X1_HA:
|
case BFD_RELOC_TILEPRO_IMM16_X0_HA_PCREL:
|
case BFD_RELOC_TILEPRO_IMM16_X0_HA_PCREL:
|
case BFD_RELOC_TILEPRO_IMM16_X1_HA_PCREL:
|
case BFD_RELOC_TILEPRO_IMM16_X1_HA_PCREL:
|
*valP = value = apply_special_operator (O_ha16, value);
|
*valP = value = apply_special_operator (O_ha16, value);
|
break;
|
break;
|
|
|
case BFD_RELOC_TILEPRO_IMM16_X0_TLS_GD_HA:
|
|
case BFD_RELOC_TILEPRO_IMM16_X1_TLS_GD_HA:
|
|
*valP = value = apply_special_operator (O_tls_gd_ha16, value);
|
|
break;
|
|
|
|
case BFD_RELOC_TILEPRO_IMM16_X0_TLS_IE_HA:
|
|
case BFD_RELOC_TILEPRO_IMM16_X1_TLS_IE_HA:
|
|
*valP = value = apply_special_operator (O_tls_ie_ha16, value);
|
|
break;
|
|
|
|
default:
|
default:
|
/* Do nothing */
|
/* Do nothing */
|
break;
|
break;
|
}
|
}
|
|
|