[gcc(refs/vendors/ARM/heads/morello)] Update aarch64_mov_operand_p for new indirection symbols
Matthew Malcomson
matmal01@gcc.gnu.org
Tue Sep 21 09:14:45 GMT 2021
https://gcc.gnu.org/g:9cb745fbe16848eb1b4a47dbc6d4f08ac325ef92
commit 9cb745fbe16848eb1b4a47dbc6d4f08ac325ef92
Author: Matthew Malcomson <matthew.malcomson@arm.com>
Date: Thu Sep 16 11:33:51 2021 +0100
Update aarch64_mov_operand_p for new indirection symbols
Indirection symbols in a function-local constant pool are valid
operands, but no other symbols are valid to use directly as an operand
for pure capability ABI.
They are only used as an operand in the movcadi_aarch64 pattern, which
uses `adr` to load it and that will load the symbol with PCC permissions
as with other symbols.
Diff:
---
gcc/config/aarch64/aarch64.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 53b479e8c9d..e19a99ad206 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -9598,10 +9598,27 @@ aarch64_classify_address (struct aarch64_address_info *info,
rtx sym, addend;
split_const (x, &sym, &addend);
- return ((GET_CODE (sym) == LABEL_REF
+ return (GET_CODE (sym) == LABEL_REF
|| (GET_CODE (sym) == SYMBOL_REF
&& CONSTANT_POOL_ADDRESS_P (sym)
- && aarch64_pcrelative_literal_loads)));
+ && aarch64_pcrelative_literal_loads
+ /* Disallow direct loading of symbols in pure capability
+ unless that symbol is already an indirection symbol.
+ Disallow other symbols since we always want to
+ enforce indirection.
+
+ Allow indirection symbols since while this function
+ is used in many places where such a direct symbol
+ could not be used for PureCap ABI, these are also
+ places a direct symbol could not be used in the
+ instruction for stock AArch64.
+
+ The only place we belive that this would end up
+ getting used is in the Usa alternative of
+ movcadi_aarch64 patterns, where we would use an `adr`
+ with it. We believe this is valid. */
+ && (!TARGET_CAPABILITY_PURE
+ || SYMBOL_REF_INDIRECTION_P (sym))));
}
return false;
@@ -18641,7 +18658,7 @@ aarch64_mov_operand_p (rtx x, machine_mode mode)
return aarch64_simd_valid_immediate (x, NULL);
}
- if (GET_CODE (x) == SYMBOL_REF && mode == DImode && CONSTANT_ADDRESS_P (x))
+ if (GET_CODE (x) == SYMBOL_REF && mode == Pmode && CONSTANT_ADDRESS_P (x))
return true;
if (TARGET_SVE && aarch64_sve_cnt_immediate_p (x))
More information about the Gcc-cvs
mailing list