[PATCH] sparc: define _GLOBAL_OFFSET_TABLE_ when referenced

Alan Modra amodra@gmail.com
Thu Feb 6 21:28:19 GMT 2025


On Thu, Feb 06, 2025 at 05:03:23AM -0300, Alexandre Oliva wrote:
> 	* elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Check for
> 	_GLOBAL_OFFSET_TABLE_ references early, then compare hashed
> 	symbols instead of strings.
> 	(_bfd_sparc_elf_relocate_section): Compare hashed symbols.

Looks good, except for

> @@ -1645,14 +1655,8 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
>  	  if (h != NULL)
>  	    h->non_got_ref = 1;
>  
> -	  if (h != NULL
> -	      && strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
> -	    {
> -	      if (!htab->elf.sgot
> -		  && !_bfd_elf_create_got_section (htab->elf.dynobj, info))
> -		return false;
> -	      break;
> -	    }
> +	  if (h != NULL && htab->elf.hgot)

	  if (h != NULL && h == htab->elf.hgot)

> +	    break;
>  	  /* Fall through.  */
>  
>  	case R_SPARC_DISP8:

-- 
Alan Modra


More information about the Binutils mailing list