[PATCH] D49673: [AArch64] Add Tiny Code Model for AArch64

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 24 08:28:27 PDT 2018


peter.smith added a comment.

I think that it is important to support position independent code in the tiny code model, there was a thread on llvm-dev in May where someone couldn't 4k align his position independent code on a bare-metal AArch64 platform (http://lists.llvm.org/pipermail/llvm-dev/2018-May/123465.html) A tiny code model that avoids ADRP could be a solution there. A PR was raised to implement it https://bugs.llvm.org/show_bug.cgi?id=37543 . If we can get position independent support added then it will be worth closing that PR. I guess it could be added in a follow up patch though.

Some other observations:

- It will be worth adding assembler support for adr with respect to a relocated literal, I don't think it does right now. Certainly worth adding a test.
- I seem to remember in the thread that supporting tiny in machO might be difficult due to lack of available relocations. May be worth making sure that selecting tiny code model on MachO is an error and then you can avoid testing for non-MachO in multiple places.
- TLS could also be altered in the tiny code model. AFAIK GNU ld supports relaxation of at least some of the tiny code model TLS implementations. The GCC version I had only seemed to alter its initial-exec implementation though. Again I think TLS support could be added in a follow up patch.

     



================
Comment at: lib/Target/AArch64/AArch64ISelLowering.cpp:3942
+  // This also catches the large code model case for Darwin, and tiny code
+  // model with git relocations.
+  if ((OpFlags & AArch64II::MO_GOT) != 0)
----------------
Typo: GOT relocations instead of git?


https://reviews.llvm.org/D49673





More information about the llvm-commits mailing list