public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Wilco Dijkstra <wilco@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-4942] AArch64: Fix PR103085 Date: Fri, 5 Nov 2021 15:37:32 +0000 (GMT) [thread overview] Message-ID: <20211105153732.626643858D28@sourceware.org> (raw) https://gcc.gnu.org/g:b33b2678342c655ff8ddb9fab379b26f656adc03 commit r12-4942-gb33b2678342c655ff8ddb9fab379b26f656adc03 Author: Wilco Dijkstra <wdijkstr@arm.com> Date: Fri Nov 5 15:05:15 2021 +0000 AArch64: Fix PR103085 The stack protector implementation hides symbols in a const unspec, which means movdi/movsi patterns must always support const on symbol operands and explicitly strip away the unspec. Do this for the recently added GOT alternatives. Add a test to ensure stack-protector tests GOT accesses as well. 2021-11-05 Wilco Dijkstra <wdijkstr@arm.com> PR target/103085 * config/aarch64/aarch64.c (aarch64_mov_operand_p): Strip the salt first. * config/aarch64/constraints.md: Support const in Usw. gcc/testsuite/ PR target/103085 * gcc.target/aarch64/pr103085.c: New test Diff: --- gcc/config/aarch64/aarch64.c | 4 +++- gcc/config/aarch64/constraints.md | 3 ++- gcc/testsuite/gcc.target/aarch64/pr103085.c | 11 +++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 69f08052ce8..fdf05505846 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -20379,12 +20379,14 @@ aarch64_mov_operand_p (rtx x, machine_mode mode) return aarch64_simd_valid_immediate (x, NULL); } + /* Remove UNSPEC_SALT_ADDR before checking symbol reference. */ + x = strip_salt (x); + /* GOT accesses are valid moves. */ if (SYMBOL_REF_P (x) && aarch64_classify_symbolic_expression (x) == SYMBOL_SMALL_GOT_4G) return true; - x = strip_salt (x); if (SYMBOL_REF_P (x) && mode == DImode && CONSTANT_ADDRESS_P (x)) return true; diff --git a/gcc/config/aarch64/constraints.md b/gcc/config/aarch64/constraints.md index 87c0e5fe2a9..b197ec26060 100644 --- a/gcc/config/aarch64/constraints.md +++ b/gcc/config/aarch64/constraints.md @@ -152,10 +152,11 @@ (match_test "aarch64_symbolic_address_p (op)") (match_test "aarch64_mov_operand_p (op, GET_MODE (op))"))) +;; const is needed here to support UNSPEC_SALT_ADDR. (define_constraint "Usw" "@internal A constraint that matches a small GOT access." - (and (match_code "symbol_ref") + (and (match_code "const,symbol_ref") (match_test "aarch64_classify_symbolic_expression (op) == SYMBOL_SMALL_GOT_4G"))) diff --git a/gcc/testsuite/gcc.target/aarch64/pr103085.c b/gcc/testsuite/gcc.target/aarch64/pr103085.c new file mode 100644 index 00000000000..dbc9c15b71f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr103085.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fstack-protector-strong -fPIC" } */ + +void g(int*); +void +f (int x) +{ + int arr[10]; + g (arr); +} +
reply other threads:[~2021-11-05 15:37 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20211105153732.626643858D28@sourceware.org \ --to=wilco@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).