This is the mail archive of the binutils@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]

PATCH: Remove duplicated is_indirect_symbol


Hi,

I am checking in this patch to remove duplicated is_indirect_symbol
and rename it to _bfd_elf_is_ifunc_symbol since indirect symbol has
another meaning in BFD.


H.J.
----
2009-05-26  H.J. Lu  <hongjiu.lu@intel.com>

	* elf-bfd.h (_bfd_elf_is_ifunc_symbol): New.

	* elf32-i386.c (is_indirect_symbol): Renamed to ...
	* elflink.c (_bfd_elf_is_ifunc_symbol): This.

	* elf32-i386.c (allocate_dynrelocs): Updated.
	(elf_i386_relocate_section): Likewise.
	* elf64-x86-64.c (allocate_dynrelocs): Updated.
	(elf64_x86_64_relocate_section): Likewise.

	* elf64-x86-64.c (is_indirect_symbol): Removed.

Index: elflink.c
===================================================================
--- elflink.c	(revision 5935)
+++ elflink.c	(working copy)
@@ -12561,3 +12561,22 @@ _bfd_elf_make_ifunc_reloc_section (bfd *
 
   return reloc_sec;
 }
+
+/* Returns true if the hash entry refers to a symbol marked for
+   indirect handling during reloc processing.  */
+
+bfd_boolean
+_bfd_elf_is_ifunc_symbol (bfd *abfd, struct elf_link_hash_entry *h)
+{
+  const struct elf_backend_data * bed;
+
+  if (abfd == NULL || h == NULL)
+    return FALSE;
+
+  bed = get_elf_backend_data (abfd);
+
+  /* GNU/Linux is still using the default value ELFOSABI_NONE.  */
+  return (h->type == STT_GNU_IFUNC
+	  && (bed->elf_osabi == ELFOSABI_LINUX
+	      || bed->elf_osabi == ELFOSABI_NONE));
+}
Index: elf-bfd.h
===================================================================
--- elf-bfd.h	(revision 5933)
+++ elf-bfd.h	(working copy)
@@ -2155,6 +2155,9 @@ extern asection * _bfd_elf_make_ifunc_re
 /* Large common section.  */
 extern asection _bfd_elf_large_com_section;
 
+extern bfd_boolean _bfd_elf_is_ifunc_symbol
+  (bfd *, struct elf_link_hash_entry *);
+
 /* This is the condition under which finish_dynamic_symbol will be called.
    If our finish_dynamic_symbol isn't called, we'll need to do something
    about initializing any .plt and .got entries in relocate_section.  */
Index: elf64-x86-64.c
===================================================================
--- elf64-x86-64.c	(revision 5937)
+++ elf64-x86-64.c	(working copy)
@@ -987,25 +987,6 @@ elf64_x86_64_tls_transition (struct bfd_
   return TRUE;
 }
 
-/* Returns true if the hash entry refers to a symbol
-   marked for indirect handling during reloc processing.  */
-
-static bfd_boolean
-is_indirect_symbol (bfd * abfd, struct elf_link_hash_entry * h)
-{
-  const struct elf_backend_data * bed;
-
-  if (abfd == NULL || h == NULL)
-    return FALSE;
-
-  bed = get_elf_backend_data (abfd);
-
-  return h->type == STT_GNU_IFUNC
-    && (bed->elf_osabi == ELFOSABI_LINUX
-	/* GNU/Linux is still using the default value 0.  */
-	|| bed->elf_osabi == ELFOSABI_NONE);
-}
-
 /* Look through the relocs for a section during the first phase, and
    calculate needed space in the global offset table, procedure
    linkage table, and dynamic reloc sections.  */
@@ -1864,7 +1845,7 @@ allocate_dynrelocs (struct elf_link_hash
 	    return FALSE;
 	}
     }
-  else if (is_indirect_symbol (info->output_bfd, h)
+  else if (_bfd_elf_is_ifunc_symbol (info->output_bfd, h)
 	   && h->dynindx == -1
 	   && ! h->forced_local)
     {
@@ -2722,7 +2703,7 @@ elf64_x86_64_relocate_section (bfd *outp
 		  && h->dynindx != -1
 		  && ! h->forced_local
 		  && ((struct elf64_x86_64_link_hash_entry *) h)->dyn_relocs != NULL
-		  && is_indirect_symbol (output_bfd, h))
+		  && _bfd_elf_is_ifunc_symbol (output_bfd, h))
 	      || (ELIMINATE_COPY_RELOCS
 		  && !info->shared
 		  && h != NULL
@@ -2818,7 +2799,7 @@ elf64_x86_64_relocate_section (bfd *outp
 		  && h != NULL
 		  && h->dynindx != -1
 		  && ! h->forced_local
-		  && is_indirect_symbol (output_bfd, h)
+		  && _bfd_elf_is_ifunc_symbol (output_bfd, h)
 		  && elf_section_data (input_section)->indirect_relocs != NULL
 		  && elf_section_data (input_section)->indirect_relocs->contents != NULL)
 		sreloc = elf_section_data (input_section)->indirect_relocs;
Index: elf32-i386.c
===================================================================
--- elf32-i386.c	(revision 5937)
+++ elf32-i386.c	(working copy)
@@ -1203,25 +1203,6 @@ elf_i386_tls_transition (struct bfd_link
   return TRUE;
 }
 
-/* Returns true if the hash entry refers to a symbol
-   marked for indirect handling during reloc processing.  */
-
-static bfd_boolean
-is_indirect_symbol (bfd * abfd, struct elf_link_hash_entry * h)
-{
-  const struct elf_backend_data * bed;
-
-  if (abfd == NULL || h == NULL)
-    return FALSE;
-
-  bed = get_elf_backend_data (abfd);
-
-  return h->type == STT_GNU_IFUNC
-    && (bed->elf_osabi == ELFOSABI_LINUX
-	/* GNU/Linux is still using the default value 0.  */
-	|| bed->elf_osabi == ELFOSABI_NONE);
-}
-
 /* Look through the relocs for a section during the first phase, and
    calculate needed space in the global offset table, procedure linkage
    table, and dynamic reloc sections.  */
@@ -2069,7 +2050,7 @@ allocate_dynrelocs (struct elf_link_hash
 	    }
 	}
     }
-  else if (is_indirect_symbol (info->output_bfd, h)
+  else if (_bfd_elf_is_ifunc_symbol (info->output_bfd, h)
 	   && h->dynindx == -1
 	   && ! h->forced_local)
     {
@@ -2928,7 +2909,7 @@ elf_i386_relocate_section (bfd *output_b
 		  && h->dynindx != -1
 		  && ! h->forced_local
 		  && ((struct elf_i386_link_hash_entry *) h)->dyn_relocs != NULL
-		  && is_indirect_symbol (output_bfd, h))
+		  && _bfd_elf_is_ifunc_symbol (output_bfd, h))
 	      || (ELIMINATE_COPY_RELOCS
 		  && !info->shared
 		  && h != NULL
@@ -2981,7 +2962,7 @@ elf_i386_relocate_section (bfd *output_b
 		  && h != NULL
 		  && h->dynindx != -1
 		  && ! h->forced_local
-		  && is_indirect_symbol (output_bfd, h)
+		  && _bfd_elf_is_ifunc_symbol (output_bfd, h)
 		  && elf_section_data (input_section)->indirect_relocs != NULL
 		  && elf_section_data (input_section)->indirect_relocs->contents != NULL)
 		sreloc = elf_section_data (input_section)->indirect_relocs;


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