This is an archive of the discontinued LLVM Phabricator instance.

lld: add support for aarch64be -m flags
AbandonedPublic

Authored by nickdesaulniers on Feb 25 2019, 4:44 PM.

Details

Summary

The Linux kernel makes use of -maarch64elfb and -maarch64linuxb.
Link: https://github.com/ClangBuiltLinux/linux/issues/380

Event Timeline

  • add test for other added -m variant
ruiu added a comment.Feb 25 2019, 7:05 PM

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.

nickdesaulniers abandoned this revision.Feb 26 2019, 3:31 PM

arm and aarch64 BE support would be nice to have, but at this time there's no real requirement on our side.