problem with binutils 2.29 for microblaze

Michael Eager eager@eagerm.com
Tue Aug 8 13:58:00 GMT 2017


On 08/08/2017 02:29 AM, Alan Modra wrote:
> On Sun, Aug 06, 2017 at 10:21:27AM +0930, Alan Modra wrote:
>> On Sat, Aug 05, 2017 at 08:04:18PM +0200, Waldemar Brodkorb wrote:
>>> Hi,
>>>
>>> This issue was reported in Januar:
>>> https://sourceware.org/bugzilla/show_bug.cgi?id=21017
>>>
>>> I reported the musl build failure via IRC to Rich.
>>> He opened up the ticket and suggested a fix.
>>> The fix is included in Binutils 2.29.
>>>
>>> Unfortunately it breaks uClibc-ng shared library loader.
>>
>> Yes, the binutils patch is incorrect.  It causes got.refcount to be
>> incremented for a GOTOFF relocation, when such relocations should not
>> cause a GOT entry to be created.  Easily fixed.
> 
> I may as well commit the patch to fix the GOTOFF problem.  I've
> verified that it builds ld-uClibc-1.0.26.so without _NONE relocs.
> 
> 	PR 21017
> 	* elf32-microblaze.c (microblaze_elf_check_relocs): Don't bump
> 	got.refcount for GOTOFF relocs, just create .got section.
> 
> diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
> index 2657736..94ef09e 100644
> --- a/bfd/elf32-microblaze.c
> +++ b/bfd/elf32-microblaze.c
> @@ -2353,7 +2353,6 @@ microblaze_elf_check_relocs (bfd * abfd,
>           dogottls:
>             sec->has_tls_reloc = 1;
>   	  /* Fall through.  */
> -        case R_MICROBLAZE_GOTOFF_64:
>           case R_MICROBLAZE_GOT_64:
>             if (htab->elf.sgot == NULL)
>               {
> @@ -2374,6 +2373,17 @@ microblaze_elf_check_relocs (bfd * abfd,
>   	    }
>             break;
>   
> +	case R_MICROBLAZE_GOTOFF_64:
> +	case R_MICROBLAZE_GOTOFF_32:
> +	  if (htab->elf.sgot == NULL)
> +	    {
> +	      if (htab->elf.dynobj == NULL)
> +		htab->elf.dynobj = abfd;
> +	      if (!_bfd_elf_create_got_section (htab->elf.dynobj, info))
> +		return FALSE;
> +	    }
> +	  break;
> +
>           case R_MICROBLAZE_64:
>           case R_MICROBLAZE_64_PCREL:
>           case R_MICROBLAZE_32:
> 

OK with me.


-- 
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077



More information about the Binutils mailing list