Jeremie Courreges-Anglas writes:

> On Fri, Dec 21 2018, Xiyue Deng <[email protected]> wrote:
>
> [...]
>
>>> Index: elf64-mips.c
>>> ===================================================================
>>> RCS file: /cvs/src/gnu/usr.bin/binutils-2.17/bfd/elf64-mips.c,v
>>> retrieving revision 1.1.1.1
>>> diff -u -p -p -u -r1.1.1.1 elf64-mips.c
>>> --- elf64-mips.c    24 Apr 2011 20:14:42 -0000      1.1.1.1
>>> +++ elf64-mips.c    19 Dec 2018 17:22:29 -0000
>>> @@ -2252,6 +2252,8 @@ mips_elf64_rtype_to_howto (unsigned int 
>>>         return &mips16_elf64_howto_table_rel[r_type - R_MIPS16_min];
>>>     }
>>>        BFD_ASSERT (r_type < (unsigned int) R_MIPS_max);
>>> +      if (!(r_type < (unsigned int) R_MIPS_max))
>>> +         fprintf(stderr, "BFD:%s: relocation type %u\n", __func__, r_type);
>>>        if (rela_p)
>>>     return &mips_elf64_howto_table_rela[r_type];
>>>        else
>>
>> With the patch from Jeremie applied, the error message shows exact type
>> of relocation:
>>
>>
>> --8<--
>> /usr/bin/ld: BFD 2.17 assertion fail 
>> /usr/src/gnu/usr.bin/binutils-2.17/bfd/elf64-mips.c:2254
>> BFD:mips_elf64_rtype_to_howto: relocation type 248
>> /usr/bin/ld: BFD 2.17 internal error, aborting at 
>> /usr/src/gnu/usr.bin/binutils-2.17/bfd/reloc.c line 445 in bfd_get_reloc_size
>>
>> /usr/bin/ld: Please report this bug.
>>
>> clang-6.0: error: linker command failed with exit code 1 (use -v to see 
>> invocation)
>> -->8--
>>
>> Hope this is helpful for MIPS people to properly fix this.
>
> This is consistent with visa@'s analysis.  He committed a fix, which
> should arrive on your local CVS mirror soonish:
>
> --8<--
> CVSROOT:        /cvs
> Module name:    src
> Changes by:     [email protected]    2018/12/22 03:31:01
>
> Modified files:
>         gnu/usr.bin/binutils-2.17/bfd: elf64-mips.c
>
> Log message:
> Add support for R_MIPS_PC32 relocation. It is needed for linking code
> that has been compiled using clang.
>
> The added code is based on old binutils code from year 2000.
>
> Prodded by and OK jca@, OK kettenis@ guenther@
> -->8--
>
> You could backport it to -stable, but better use -current. ;)

Fantastic! Will try on -stable first as I'm half-way through building
mu4e :D

BTW, has -current on loongson switched from gcc 4.x to clang as well?
If so will definitely try that out and hopefully help making 6.5 better
for loongson.

-- 
manphiz

Attachment: signature.asc
Description: PGP signature

Reply via email to