[binutils-gdb] cris: dynobj mach

Alan Modra via Binutils-cvs <[email protected]>
Newsgroups gmane.comp.gnu.binutils.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=89193eb62f86784772bc5fc2e2cdc649c1bae2df

commit 89193eb62f86784772bc5fc2e2cdc649c1bae2df
Author: Alan Modra <[email protected]>
Date:   Mon May 11 09:17:52 2026 +0930

    cris: dynobj mach
    
    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.

Diff:
---
 bfd/elf32-cris.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index 8e5e82d2ce8..cc27a68ea2c 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -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)
 	    {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.