The Linux kernel makes use of -maarch64elfb and -maarch64linuxb.
Link: https://github.com/ClangBuiltLinux/linux/issues/380
Details
- Reviewers
psmith ruiu grimar • espindola
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 28519 Build 28518: arc lint + arc unit
Event Timeline
I don't think we support big-endian AArch64. https://github.com/llvm-project/lld/blob/master/ELF/Arch/AArch64.cpp seems to assume little-endian.
My understanding is that even though AArch64 is bi-endian, everybody uses it in the little-endian mode, but I may be missing something.
I believe Peter Smith knows more about that than me.
Rui is correct, neither AArch64 or Arm support big endian at the moment. The output of the linker would certainly be broken. AArch64 and ARM make some demands of the linker that mean some additional complexity is needed:
- AArch64 instructions are little-endian, data is big-endian. Input objects have little-endian instructions.
- ARM v6+ in be-8 mode (default), instructions are little-endian, data is big-endian. Input objects have big-endian instructions and a linker must endian reverse the instructions.
- ARM prior to v6 and v6/v7 in be-32 mode (backwards compatibility only) have big-endian instructions and data.
My understanding is that big-endian is used in some networking and embedded systems as they have native big-endian data, however these tend not to make it to consumer hardware.
I would like to add support for big-endian, but I've not had it as high priority. If it is needed then I can work on it. I'd suggest AArch64 first, with potentially support for ARM v6+ be-8 mode. I don't think support for be-32 is needed.
arm and aarch64 BE support would be nice to have, but at this time there's no real requirement on our side.