]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
cris: dynobj mach
authorAlan Modra <amodra@gmail.com>
Sun, 10 May 2026 23:47:52 +0000 (09:17 +0930)
committerAlan Modra <amodra@gmail.com>
Thu, 14 May 2026 06:38:51 +0000 (16:08 +0930)
A comment in cris check_relocs bemoans not being able to access the
output bfd in adjust_dynamic_symbol.  A little over three years after
the comment was written, commit f13a99db51c0 gave that access.  So
let's make use of it and remove a restriction.

* elf32-cris.c (elf_cris_adjust_dynamic_symbol): Get mach from
output bfd, not dynobj.
(cris_elf_check_relocs): Remove dynobj mach check.

bfd/elf32-cris.c

index 8e5e82d2ce8a425c5afc6115782a8960e4793f5f..cc27a68ea2c3ddf177dd3008b9980381cf48b181 100644 (file)
@@ -2676,7 +2676,7 @@ elf_cris_adjust_dynamic_symbol (struct bfd_link_info *info,
                      && !h->def_regular)));
 
   plt_entry_size
-    = (bfd_get_mach (dynobj) == bfd_mach_cris_v32
+    = (bfd_get_mach (info->output_bfd) == bfd_mach_cris_v32
        ? PLT_ENTRY_SIZE_V32 : PLT_ENTRY_SIZE);
 
   /* If this is a function, put it in the procedure linkage table.  We
@@ -3033,22 +3033,7 @@ cris_elf_check_relocs (bfd *abfd,
        case R_CRIS_16_GOTPLT:
        case R_CRIS_32_GOTPLT:
          if (dynobj == NULL)
-           {
-             elf_hash_table (info)->dynobj = dynobj = abfd;
-
-             /* We could handle this if we can get a handle on the
-                output bfd in elf_cris_adjust_dynamic_symbol.  Failing
-                that, we must insist on dynobj being a specific mach.  */
-             if (bfd_get_mach (dynobj) == bfd_mach_cris_v10_v32)
-               {
-                 _bfd_error_handler
-                   /* xgettext:c-format */
-                   (_("%pB, section %pA: v10/v32 compatible object"
-                      " must not contain a PIC relocation"),
-                    abfd, sec);
-                 return false;
-               }
-           }
+           elf_hash_table (info)->dynobj = dynobj = abfd;
 
          if (sgot == NULL)
            {