/* GAS interface for targets using CGEN: Cpu tools GENerator.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2006, 2007, 2009 Free Software Foundation, Inc.
+ Copyright (C) 1996-2014 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
along with GAS; see the file COPYING. If not, write to the Free Software
Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
-#include <setjmp.h>
#include "as.h"
+#include <setjmp.h>
#include "symcat.h"
#include "cgen-desc.h"
#include "subsegs.h"
if (operand && (operand->hw_type == HW_H_SINT))
signed_p = 1;
- if (stmp->bsym && (stmp->bsym->section == expr_section))
+ if (stmp->bsym && (stmp->bsym->section == expr_section)
+ && ! S_IS_LOCAL (stmp))
{
if (signed_p)
stmp->bsym->flags |= BSF_SRELC;
bfd_reloc_code_real_type reloc_type;
CGEN_FIELDS *fields = alloca (CGEN_CPU_SIZEOF_FIELDS (cd));
const CGEN_INSN *insn = fixP->fx_cgen.insn;
+#ifdef OBJ_COMPLEX_RELC
int start;
int length;
int signed_p = 0;
values will be signed relocs, but it's possible. */
if (operand && (operand->hw_type == HW_H_SINT))
signed_p = 1;
+#endif
/* If the reloc has been fully resolved finish the operand here. */
/* FIXME: This duplicates the capabilities of code in BFD. */
fixP->fx_addnumber = value;
}
+bfd_reloc_code_real_type
+gas_cgen_pcrel_r_type (bfd_reloc_code_real_type r)
+{
+ switch (r)
+ {
+ case BFD_RELOC_8: r = BFD_RELOC_8_PCREL; break;
+ case BFD_RELOC_16: r = BFD_RELOC_16_PCREL; break;
+ case BFD_RELOC_24: r = BFD_RELOC_24_PCREL; break;
+ case BFD_RELOC_32: r = BFD_RELOC_32_PCREL; break;
+ case BFD_RELOC_64: r = BFD_RELOC_64_PCREL; break;
+ default:
+ break;
+ }
+ return r;
+}
+
/* Translate internal representation of relocation info to BFD target format.
FIXME: To what extent can we get all relevant targets to use this? */
asection * section ATTRIBUTE_UNUSED;
fixS * fixP;
{
+ bfd_reloc_code_real_type r_type = fixP->fx_r_type;
arelent *reloc;
+
reloc = (arelent *) xmalloc (sizeof (arelent));
- reloc->howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type);
+#ifdef GAS_CGEN_PCREL_R_TYPE
+ if (fixP->fx_pcrel)
+ r_type = GAS_CGEN_PCREL_R_TYPE (r_type);
+#endif
+ reloc->howto = bfd_reloc_type_lookup (stdoutput, r_type);
+
if (reloc->howto == (reloc_howto_type *) NULL)
{
as_bad_where (fixP->fx_file, fixP->fx_line,