[all-commits] [llvm/llvm-project] a62b86: [AArch64, ELF] Restrict MOVZ/MOVK to non-PIC large ...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Wed Nov 1 12:10:58 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a62b86a3e66f6e328adc88bbd3a0c8b1991d35bb
https://github.com/llvm/llvm-project/commit/a62b86a3e66f6e328adc88bbd3a0c8b1991d35bb
Author: Fangrui Song <i at maskray.me>
Date: 2023-11-01 (Wed, 01 Nov 2023)
Changed paths:
M llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
M llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
M llvm/test/CodeGen/AArch64/GlobalISel/select-blockaddress.mir
M llvm/test/CodeGen/AArch64/GlobalISel/select-gv-cmodel-large.mir
M llvm/test/CodeGen/AArch64/GlobalISel/select-gv-with-offset.mir
M llvm/test/CodeGen/AArch64/blockaddress.ll
R llvm/test/CodeGen/AArch64/code-model-large-abs.ll
A llvm/test/CodeGen/AArch64/code-model-large.ll
M llvm/test/CodeGen/AArch64/jump-table.ll
Log Message:
-----------
[AArch64,ELF] Restrict MOVZ/MOVK to non-PIC large code model (#70178)
There is no PIC support for -mcmodel=large
(https://github.com/ARM-software/abi-aa/blob/main/sysvabi64/sysvabi64.rst)
and Clang recently rejects -mcmodel= with PIC (#70262).
The current backend code assumes that the large code model is non-PIC.
This patch adds `!getTargetMachine().isPositionIndependent()` conditions
to clarify that the support is non-PIC only. In addition, add some tests
as change detectors in case PIC large code model is supported in the
future.
If other front-ends/JITs use the large code model with PIC, they will
get small code model code sequence, instead of potentially-incorrect
MOVZ/MOVK sequence, which is only suitable for non-PIC. The sequence
will cause text relocations using ELF linkers.
(The small code model code sequence is usually sufficient as ADRP+ADD or
ADRP+LDR targets [-2**32,2**32), which has a doubled range of x86-64
R_X86_64_REX_GOTPCRELX/R_X86_64_PC32 [-2**32,2**32).)
More information about the All-commits
mailing list