[LLVMdev] llvm-mc and endianess.

Kuba Ober kuba at mareimbrium.org
Thu Mar 6 06:16:17 PST 2014


> As a first step to port the LLVM chain on an in-house big-endian processor, I’m integrating the native assembler as a new ‘-assemble –arch=’ in llvm-mc.
> All work quite well, I have a correct output ELF format except that generated code is little-endian.
> I’ve understood that the endianess of the LLVM chain is controlled by the DataLayout class, but it appear to me that llvm-mc does not make use of  such class.
> I’ve seen a backend (CPU0, http://jonathan2251.github.io/lbd/genobj.html) that defines two different targets and performs the byte swapping as part of the ‘EmitInstruction’. Is it the right way?
> Could somebody confirm my understanding and give me some tips about endianess in llvm-mc?

I have the same problem for big-endian Z8, I’ve postponed the assembler for the moment because of this.

Cheers, Kuba



More information about the llvm-dev mailing list