[PATCH] D21779: [LTO] Infer EKind/EMachine from Bitcode files

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 7 06:23:11 PDT 2016


> > From: Rui Ueyama [ruiu at google.com]
> > Sent: 06 July 2016 18:24
> > To: reviews+D21779+public+dea87c23f5e22381 at reviews.llvm.org
> > Cc: Davide Italiano; Rafael Ávila de Espíndola; Daniel Sanders; George Rimar; Sean Silva; Peter Collingbourne; llvm-commits; Tim Amini Golling
> > Subject: Re: [PATCH] D21779: [LTO] Infer EKind/EMachine from Bitcode files
> > 
> > On Tue, Jul 5, 2016 at 6:33 AM, Daniel Sanders <daniel.sanders at imgtec.com<mailto:daniel.sanders at imgtec.com>> wrote:
> > dsanders added a subscriber: dsanders.
> > 
> > ================
> > Comment at: lld/trunk/ELF/InputFiles.cpp:559-562
> > @@ +558,6 @@
> > +  Triple TheTriple(TripleStr);
> > +  bool Is64Bits = TheTriple.isArch64Bit();
> > +  if (TheTriple.isLittleEndian())
> > +    return Is64Bits ? ELF64LEKind : ELF32LEKind;
> > +  return Is64Bits ? ELF64BEKind : ELF32BEKind;
> > +}
> > ----------------
> > Sorry for the late comment but Triple::isArch64Bit() doesn't correspond to ELF64 or ELF32 on MIPS. In particular, the triple used for the
> > N32 ABI will return true for isArch64Bit() but this ABI uses ELF32 objects. If lld doesn't support the N32 ABI yet then the current code is
> > ok for the remaining two ABI's (O32 and N64).
> 
> Ah, interesting. So N32 is a 32-bit ABI on 64-bit MIPS just like x32 ABI is on x86-64. Do you know how to determine whether it is ELF32 or ELF64 for such triple?

In some ways, yes, but N32 has full support for 64-bit arithmetic. It was created to be similar to N64 but avoid the portability problems and bloat associated with 64-bit pointers.

It's not possible to distinguish N32 from N64 using the triple alone but I have patches under review to make this possible (D21465, D21467, D21069 for LLVM along with D21070, D21072 for clang). They're currently being discussed on llvm-dev in the 'Representing MIPS ABI information in the triple as ARM/X86 do for EABI/EABIHF/X32' thread. Assuming these patches are accepted, you'll be able to distinguish them using Triple::getEnvironment().


More information about the llvm-commits mailing list