public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Remove is_relocatable_executable from backend code
@ 2024-02-21  6:06 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2024-02-21  6:06 UTC (permalink / raw)
  To: binutils

With the removal of symbian support, most targets no longer or never
did set is_relocatable_executable.  Remove the backend support that is
no longer relevant.

	* elf32-arm.c (record_arm_to_thumb_glue, elf32_arm_create_thumb_stub),
	(elf32_arm_final_link_relocate, elf32_arm_check_relocs),
	(elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs_for_symbol),
	(elf32_arm_output_arch_local_syms): Remove is_relocatable_executable
	code and comments.
	* elf32-csky.c (csky_elf_adjust_dynamic_symbol): Likewise.
	* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise.
	* elfnn-kvx.c (elfNN_kvx_final_link_relocate): Likewise.
	* elfxx-mips.c (count_section_dynsyms): Likewise.

diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 1913be50cfe..779c7081c53 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -7351,7 +7351,6 @@ record_arm_to_thumb_glue (struct bfd_link_info * link_info,
   free (tmp_name);
 
   if (bfd_link_pic (link_info)
-      || globals->root.is_relocatable_executable
       || globals->pic_veneer)
     size = ARM2THUMB_PIC_GLUE_SIZE;
   else if (globals->use_blx)
@@ -9259,7 +9258,6 @@ elf32_arm_create_thumb_stub (struct bfd_link_info * info,
       myh->root.u.def.value = my_offset;
 
       if (bfd_link_pic (info)
-	  || globals->root.is_relocatable_executable
 	  || globals->pic_veneer)
 	{
 	  /* For relocatable objects we can't use absolute addresses,
@@ -10507,11 +10505,9 @@ elf32_arm_final_link_relocate (reloc_howto_type *	    howto,
 					   rel->r_addend);
 	}
 
-      /* When generating a shared object or relocatable executable, these
-	 relocations are copied into the output file to be resolved at
-	 run time.  */
+      /* When generating a shared library or PIE, these relocations
+	 are copied into the output file to be resolved at run time.  */
       if ((bfd_link_pic (info)
-	   || globals->root.is_relocatable_executable
 	   || globals->fdpic_p)
 	  && (input_section->flags & SEC_ALLOC)
 	  && !(globals->root.target_os == is_vxworks
@@ -15321,15 +15317,6 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
 
   sreloc = NULL;
 
-  /* Create dynamic sections for relocatable executables so that we can
-     copy relocations.  */
-  if (htab->root.is_relocatable_executable
-      && ! htab->root.dynamic_sections_created)
-    {
-      if (! _bfd_elf_link_create_dynamic_sections (abfd, info))
-	return false;
-    }
-
   if (htab->root.dynobj == NULL)
     htab->root.dynobj = abfd;
   if (!create_ifunc_sections (info))
@@ -15601,7 +15588,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
 	  case R_ARM_THM_MOVT_PREL:
 
 	    /* Should the interworking branches be listed here?  */
-	    if ((bfd_link_pic (info) || htab->root.is_relocatable_executable
+	    if ((bfd_link_pic (info)
 		 || htab->fdpic_p)
 		&& (sec->flags & SEC_ALLOC) != 0)
 	      {
@@ -16213,10 +16200,8 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info,
   /* If we are creating a shared library, we must presume that the
      only references to the symbol are via the global offset table.
      For such cases we need not do anything here; the relocations will
-     be handled correctly by relocate_section.  Relocatable executables
-     can reference data in shared objects directly, so we don't need to
-     do anything here.  */
-  if (bfd_link_pic (info) || globals->root.is_relocatable_executable)
+     be handled correctly by relocate_section.  */
+  if (bfd_link_pic (info))
     return true;
 
   /* We must allocate the symbol in our .dynbss section, which will
@@ -16615,7 +16600,6 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf)
      visibility changes.  */
 
   if (bfd_link_pic (info)
-      || htab->root.is_relocatable_executable
       || htab->fdpic_p)
     {
       /* Relocs that use pc_count are PC-relative forms, which will appear
@@ -16670,17 +16654,6 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf)
 		return false;
 	    }
 	}
-
-      else if (htab->root.is_relocatable_executable && h->dynindx == -1
-	       && h->root.type == bfd_link_hash_new)
-	{
-	  /* Output absolute symbols so that we can create relocations
-	     against them.  For normal symbols we output a relocation
-	     against the section that contains them.  */
-	  if (! bfd_elf_link_record_dynamic_symbol (info, h))
-	    return false;
-	}
-
     }
   else
     {
@@ -18213,7 +18186,7 @@ elf32_arm_output_arch_local_syms (bfd *output_bfd,
 
       osi.sec_shndx = _bfd_elf_section_from_bfd_section
 	  (output_bfd, osi.sec->output_section);
-      if (bfd_link_pic (info) || htab->root.is_relocatable_executable
+      if (bfd_link_pic (info)
 	  || htab->pic_veneer)
 	size = ARM2THUMB_PIC_GLUE_SIZE;
       else if (htab->use_blx)
diff --git a/bfd/elf32-csky.c b/bfd/elf32-csky.c
index 87c37259fa1..6f8a787dae8 100644
--- a/bfd/elf32-csky.c
+++ b/bfd/elf32-csky.c
@@ -1614,7 +1614,7 @@ csky_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
      only references to the symbol are via the global offset table.
      For such cases we need not do anything here; the relocations will
      be handled correctly by relocate_section.  */
-  if (bfd_link_pic (info) || htab->elf.is_relocatable_executable)
+  if (bfd_link_pic (info))
     return true;
 
   /* We must allocate the symbol in our .dynbss section, which will
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 560983aaed6..3c65ac1f01b 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -5910,11 +5910,9 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
 
     case BFD_RELOC_AARCH64_NN:
 
-      /* When generating a shared object or relocatable executable, these
-	 relocations are copied into the output file to be resolved at
-	 run time.  */
-      if (((bfd_link_pic (info)
-	    || globals->root.is_relocatable_executable)
+      /* When generating a shared library or PIE, these relocations
+	 are copied into the output file to be resolved at run time.  */
+      if ((bfd_link_pic (info)
 	   && (input_section->flags & SEC_ALLOC)
 	   && (h == NULL
 	       || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
diff --git a/bfd/elfnn-kvx.c b/bfd/elfnn-kvx.c
index ae5ed6bf3f7..8591dea5432 100644
--- a/bfd/elfnn-kvx.c
+++ b/bfd/elfnn-kvx.c
@@ -2052,11 +2052,9 @@ elfNN_kvx_final_link_relocate (reloc_howto_type *howto,
     case BFD_RELOC_KVX_S64_LO10:
     case BFD_RELOC_KVX_S64_UP27:
     case BFD_RELOC_KVX_S64_EX27:
-      /* When generating a shared object or relocatable executable, these
-	 relocations are copied into the output file to be resolved at
-	 run time.  */
-      if (((bfd_link_pic (info) == true)
-	   || globals->root.is_relocatable_executable)
+      /* When generating a shared library or PIE, these relocations
+	 are copied into the output file to be resolved at run time.  */
+      if (bfd_link_pic (info)
 	  && (input_section->flags & SEC_ALLOC)
 	  && (h == NULL
 	      || (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 47903069271..89dd34e798b 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -3928,8 +3928,7 @@ count_section_dynsyms (bfd *output_bfd, struct bfd_link_info *info)
   bfd_size_type count;
 
   count = 0;
-  if (bfd_link_pic (info)
-      || elf_hash_table (info)->is_relocatable_executable)
+  if (bfd_link_pic (info))
     {
       asection *p;
       const struct elf_backend_data *bed;

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-21  6:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-21  6:06 Remove is_relocatable_executable from backend code Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).