[lld] r287799 - Fix this on 32 bit hosts.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 23 20:54:05 PST 2016


On Wed, Nov 23, 2016 at 8:07 PM, Sean Silva <chisophugis at gmail.com> wrote:
>
>
> On Wed, Nov 23, 2016 at 11:56 AM, Davide Italiano via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
>>
>> On Wed, Nov 23, 2016 at 11:53 AM, Rui Ueyama via llvm-commits
>> <llvm-commits at lists.llvm.org> wrote:
>> > On Wed, Nov 23, 2016 at 11:16 AM, Rafael Espindola via llvm-commits
>> > <llvm-commits at lists.llvm.org> wrote:
>> >>
>> >> Author: rafael
>> >> Date: Wed Nov 23 13:16:20 2016
>> >> New Revision: 287799
>> >>
>> >> URL: http://llvm.org/viewvc/llvm-project?rev=287799&view=rev
>> >> Log:
>> >> Fix this on 32 bit hosts.
>> >>
>> >> Looks like we have no 32 bit bot that builds with mips support.
>> >>
>> >> Modified:
>> >>     lld/trunk/ELF/SyntheticSections.cpp
>> >>
>> >> Modified: lld/trunk/ELF/SyntheticSections.cpp
>> >> URL:
>> >>
>> >> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=287799&r1=287798&r2=287799&view=diff
>> >>
>> >>
>> >> ==============================================================================
>> >> --- lld/trunk/ELF/SyntheticSections.cpp (original)
>> >> +++ lld/trunk/ELF/SyntheticSections.cpp Wed Nov 23 13:16:20 2016
>> >> @@ -178,7 +178,7 @@ template <class ELFT> void MipsOptionsSe
>> >>
>> >>    if (!Config->Relocatable)
>> >>      Reginfo.ri_gp_value = In<ELFT>::MipsGot->getVA() + MipsGPOffset;
>> >> -  memcpy(Buf + sizeof(Options), &Reginfo, sizeof(Reginfo));
>> >> +  memcpy(Buf + sizeof(typename ELFT::uint), &Reginfo,
>> >> sizeof(Reginfo));
>> >
>> >
>> > Probably sizeof(*Options) is better.
>> >
>>
>> -1. I personally prefer to be explicit.
>
>
> I think Rui is right in this case. We are trying to skip over a
> Elf_Mips_Options object. sizeof(*Options) guarantees that is correct
> (*Options is literally the object being skipped over, so it better be
> right!).
> At the very least, this should be changed to sizeof(Elf_Mips_Options) I
> think. I don't see how ELFT::uint makes sense here.
>

Yes, sizeof(Elf_Mips_Options) will be better.

> -- Sean Silva
>
>>
>>
>> --
>> Davide
>>
>> "There are no solved problems; there are only problems that are more
>> or less solved" -- Henri Poincare
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>



-- 
Davide

"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare


More information about the llvm-commits mailing list