aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2011-09-08 16:07:11 +0000
committerNick Clifton <nickc@redhat.com>2011-09-08 16:07:11 +0000
commit32425e36f373b8a861fd90851ab76700bd5b6f92 (patch)
treec8e0ae8fb069e559d4e394ae79f064a797963efa /gas
parent103ae312ba3c0b864851454b34a2104eff3370ad (diff)
downloadgdb-32425e36f373b8a861fd90851ab76700bd5b6f92.zip
gdb-32425e36f373b8a861fd90851ab76700bd5b6f92.tar.gz
gdb-32425e36f373b8a861fd90851ab76700bd5b6f92.tar.bz2
* cgen.c (gas_cgen_pcrel_r_type): New function.
(gas_cgen_tc_gen_reloc): Check for GAS_CGEN_PCREL_R_TYPE. * cgen.h (gas_cgen_pcrel_r_type): Declare.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog6
-rw-r--r--gas/cgen.c27
-rw-r--r--gas/cgen.h13
3 files changed, 39 insertions, 7 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 383bae3..cdea19e 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2011-09-08 Joern Rennecke <joern.rennecke@embecosm.com>
+
+ * cgen.c (gas_cgen_pcrel_r_type): New function.
+ (gas_cgen_tc_gen_reloc): Check for GAS_CGEN_PCREL_R_TYPE.
+ * cgen.h (gas_cgen_pcrel_r_type): Declare.
+
2011-09-08 Richard Sandiford <rdsandiford@googlemail.com>
PR gas/13167
diff --git a/gas/cgen.c b/gas/cgen.c
index 109b086..d3976d1 100644
--- a/gas/cgen.c
+++ b/gas/cgen.c
@@ -1,6 +1,6 @@
/* GAS interface for targets using CGEN: Cpu tools GENerator.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+ 2006, 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -1018,6 +1018,22 @@ gas_cgen_md_apply_fix (fixP, valP, seg)
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? */
@@ -1027,10 +1043,17 @@ gas_cgen_tc_gen_reloc (section, fixP)
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,
diff --git a/gas/cgen.h b/gas/cgen.h
index 1787615..847e042 100644
--- a/gas/cgen.h
+++ b/gas/cgen.h
@@ -1,5 +1,5 @@
/* GAS cgen support.
- Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2007
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2007, 2011
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -32,8 +32,9 @@ extern CGEN_CPU_DESC gas_cgen_cpu_desc;
#endif
/* Struct defining result of gas_cgen_finish_insn. */
-typedef struct {
- /* frag containing the insn */
+typedef struct
+{
+ /* Frag containing the insn */
fragS * frag;
/* Address of insn in frag. */
char * addr;
@@ -80,10 +81,12 @@ extern fixS * gas_cgen_record_fixup_exp (fragS *, int, const CGEN_INSN *,
int, const CGEN_OPERAND *, int,
expressionS *);
-/* md_apply_fix handler */
+extern bfd_reloc_code_real_type gas_cgen_pcrel_r_type (bfd_reloc_code_real_type);
+
+/* md_apply_fix handler. */
extern void gas_cgen_md_apply_fix (fixS *, valueT *, segT);
-/* tc_gen_reloc handler */
+/* tc_gen_reloc handler. */
extern arelent *gas_cgen_tc_gen_reloc (asection *, fixS *);
/* Target supplied routine to lookup a reloc. */