]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Remove is_relocatable_executable from backend code
authorAlan Modra <amodra@gmail.com>
Tue, 20 Feb 2024 23:13:40 +0000 (09:43 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 21 Feb 2024 13:10:12 +0000 (23:40 +1030)
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.

bfd/elf32-arm.c
bfd/elf32-csky.c
bfd/elfnn-aarch64.c
bfd/elfnn-kvx.c
bfd/elfxx-mips.c

index 1913be50cfe5743374be16992e7b8a2b69f99f6d..779c7081c53698fc9e703e18377eb6619f92e97c 100644 (file)
@@ -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)
index 87c37259fa126bb08b3c58136d4dff3cefce94fa..6f8a787dae89c2a2fe223f358d39239f72f98556 100644 (file)
@@ -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
index 560983aaed6230454dda0693c550693a7c080e16..3c65ac1f01bd228b09f2ca02c9f05f7d03fa91f0 100644 (file)
@@ -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
index ae5ed6bf3f75eaa81421ea6c697d0fdb00f0dc8d..8591dea54327c8a68b16cc2e166f17a1146e5f3a 100644 (file)
@@ -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
index 479030692717c38b6f9e088472de829ca76018f5..89dd34e798b45c7d1ec674b4227133708868bbc3 100644 (file)
@@ -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;