* gas/ChangeLog.or1k

2012-10-24  Stefan Kristiansson  <[email protected]>

        * config/tc-or1k.c (tc_gen_reloc): New function. Handle
        BFD_RELOC_OR1K_GOTPC_HI16 and BFD_RELOC_OR1K_GOTPC_LO16 relocations
        to _GLOBAL_OFFSET_TABLE_
        * config/tc-or1k.h (tc_gen_reloc): Remove define.
---
 gas/ChangeLog.or1k   |    7 +++++++
 gas/config/tc-or1k.c |   25 +++++++++++++++++++++++++
 gas/config/tc-or1k.h |    2 --
 3 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/gas/ChangeLog.or1k b/gas/ChangeLog.or1k
index 09c07b7..15e17ed 100644
--- a/gas/ChangeLog.or1k
+++ b/gas/ChangeLog.or1k
@@ -1,3 +1,10 @@
+2012-10-24  Stefan Kristiansson  <[email protected]>
+
+       * config/tc-or1k.c (tc_gen_reloc): New function. Handle
+       BFD_RELOC_OR1K_GOTPC_HI16 and BFD_RELOC_OR1K_GOTPC_LO16 relocations
+       to _GLOBAL_OFFSET_TABLE_
+       * config/tc-or1k.h (tc_gen_reloc): Remove define.
+
 2012-05-13  Peter Gavin  <[email protected]>
 
        * config/tc-or1k.h:
diff --git a/gas/config/tc-or1k.c b/gas/config/tc-or1k.c
index 4bf843a..e9d560e 100644
--- a/gas/config/tc-or1k.c
+++ b/gas/config/tc-or1k.c
@@ -302,6 +302,31 @@ or1k_fix_adjustable (fixS * fixP)
   return 1;
 }
 
+#define GOT_NAME "_GLOBAL_OFFSET_TABLE_"
+
+arelent *
+tc_gen_reloc (asection *sec, fixS *fx)
+{
+  bfd_reloc_code_real_type code = fx->fx_r_type;
+
+  if (fx->fx_addsy != NULL
+      && strcmp (S_GET_NAME (fx->fx_addsy), GOT_NAME) == 0
+      && (code == BFD_RELOC_OR1K_GOTPC_HI16
+         || code == BFD_RELOC_OR1K_GOTPC_LO16))
+    {
+      arelent * reloc;
+
+      reloc = xmalloc (sizeof (* reloc));
+      reloc->sym_ptr_ptr = xmalloc (sizeof (asymbol *));
+      *reloc->sym_ptr_ptr = symbol_get_bfdsym (fx->fx_addsy);
+      reloc->address = fx->fx_frag->fr_address + fx->fx_where;
+      reloc->howto = bfd_reloc_type_lookup (stdoutput, fx->fx_r_type);
+      reloc->addend = fx->fx_offset;
+      return reloc;
+    }
+
+  return gas_cgen_tc_gen_reloc (sec, fx);
+}
 void
 or1k_elf_final_processing (void)
 {
diff --git a/gas/config/tc-or1k.h b/gas/config/tc-or1k.h
index dbcaeae..421d360 100644
--- a/gas/config/tc-or1k.h
+++ b/gas/config/tc-or1k.h
@@ -50,8 +50,6 @@ extern const char or1k_comment_chars [];
 extern bfd_boolean or1k_fix_adjustable (struct fix *);
 #define tc_fix_adjustable(FIX) or1k_fix_adjustable (FIX)
 
-#define tc_gen_reloc gas_cgen_tc_gen_reloc
-
 /* Call md_pcrel_from_section(), not md_pcrel_from().  */
 extern long md_pcrel_from_section (struct fix *, segT);
 #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)
-- 
1.7.9.5

_______________________________________________
OpenRISC mailing list
[email protected]
http://lists.openrisc.net/listinfo/openrisc

Reply via email to