off = 0;
}
+ frag_now->tc_frag_data.code64 = flag_code == CODE_64BIT;
+
/* 1 possible extra opcode + 4 byte displacement go in var part.
Pass reloc in fr_var. */
frag_var (rs_machine_dependent, 5, i.reloc[0], subtype, sym, off, p);
}
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
- if (size == 4
- && jump_reloc == NO_RELOC
+ if (flag_code == CODE_64BIT && size == 4
+ && jump_reloc == NO_RELOC && i.op[0].disps->X_add_number == 0
&& need_plt32_p (i.op[0].disps->X_add_symbol))
jump_reloc = BFD_RELOC_X86_64_PLT32;
#endif
else if (size == 2)
reloc_type = BFD_RELOC_16_PCREL;
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
- else if (need_plt32_p (fragP->fr_symbol))
+ else if (fragP->tc_frag_data.code64 && fragP->fr_offset == 0
+ && need_plt32_p (fragP->fr_symbol))
reloc_type = BFD_RELOC_X86_64_PLT32;
#endif
else
unsigned int mf_type : 3;
unsigned int classified : 1;
unsigned int branch_type : 3;
+ unsigned int code64 : 1; /* Only set by output_branch for now. */
};
/* We need to emit the right NOP pattern in .align frags. This is