[llvm] [AArch64,ELF] Restrict MOVZ/MOVK to non-PIC large code model (PR #70178)

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 25 07:38:06 PDT 2023


smithp35 wrote:

Doesn't this effectively make -mcmodel=large equivalent to -mcmodel=small when -fpie is used? I'm a bit nervous about this as it might lead people to believe that -mcmodel=large is working until their program breaks.

Personally I'd prefer an error message like GNU for now as it is marked as unsupported in the ABI https://github.com/ARM-software/abi-aa/blob/main/sysvabi64/sysvabi64.rst#implementation-of-code-models

One thought I had about code-models and PIC/PIE was to force all global data accesses through the GOT, this would mean that although the GOT would have to be within 4 GiB of the code, global data accessed via the GOT could be anywhere within the address space. Whether that should be called large-code model or something else I don't know. I'm not sure that making a PC-relative offset from a sequence of MOVW using (R_<CLS>_MOVW_PREL_G0) to the GOT really helps for most programs.



https://github.com/llvm/llvm-project/pull/70178


More information about the llvm-commits mailing list