This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] [ARC] Generate DT_RELACOUNT.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0f7f3789ca97ecaf0c4169c6d82e205f69fa0580

commit 0f7f3789ca97ecaf0c4169c6d82e205f69fa0580
Author: Cupertino Miranda <cmiranda@synopsys.com>
Date:   Tue May 17 12:15:41 2016 +0200

    [ARC] Generate DT_RELACOUNT.
    
    bfd/
    2016-06-13  Cupertino Miranda  <cmiranda@synospsy.com>
    
    	* elf32-arc.c (elf32_arc_reloc_type_class): Defined function to
    	enable support for "-z combreloc" and DT_RELACOUNT.
    	(elf_backend_reloc_type_class): Likewise

Diff:
---
 bfd/ChangeLog   |  6 ++++++
 bfd/elf32-arc.c | 28 ++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b9c3a73..9eb30ef 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2016-06-13  Cupertino Miranda  <cmiranda@synospsy.com>
+
+	* elf32-arc.c (elf32_arc_reloc_type_class): Defined function to
+	enable support for "-z combreloc" and DT_RELACOUNT.
+	(elf_backend_reloc_type_class): Likewise
+
 2016-06-11  H.J. Lu  <hongjiu.lu@intel.com>
 
 	PR ld/20244
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index 08949c7..82b7687 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -2699,6 +2699,32 @@ elf_arc_size_dynamic_sections (bfd * output_bfd,
   return TRUE;
 }
 
+
+/* Classify dynamic relocs such that -z combreloc can reorder and combine
+   them.  */
+static enum elf_reloc_type_class
+elf32_arc_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+			    const asection *rel_sec ATTRIBUTE_UNUSED,
+			    const Elf_Internal_Rela *rela)
+{
+  switch ((int) ELF32_R_TYPE (rela->r_info))
+    {
+    case R_ARC_RELATIVE:
+      return reloc_class_relative;
+    case R_ARC_JMP_SLOT:
+      return reloc_class_plt;
+    case R_ARC_COPY:
+      return reloc_class_copy;
+    /* TODO: Needed in future to support ifunc.  */
+    /*
+    case R_ARC_IRELATIVE:
+      return reloc_class_ifunc;
+    */
+    default:
+      return reloc_class_normal;
+    }
+}
+
 const struct elf_size_info arc_elf32_size_info =
 {
   sizeof (Elf32_External_Ehdr),
@@ -2801,6 +2827,8 @@ elf_arc_add_symbol_hook (bfd * abfd,
 #define elf_backend_check_relocs	     elf_arc_check_relocs
 #define elf_backend_create_dynamic_sections  _bfd_elf_create_dynamic_sections
 
+#define elf_backend_reloc_type_class		elf32_arc_reloc_type_class
+
 #define elf_backend_adjust_dynamic_symbol    elf_arc_adjust_dynamic_symbol
 #define elf_backend_finish_dynamic_symbol    elf_arc_finish_dynamic_symbol


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]