From patchwork Wed Oct 23 11:05:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Khrustalev X-Patchwork-Id: 99426 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 90F583857BA5 for ; Wed, 23 Oct 2024 11:11:53 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id AF4C23857C6A; Wed, 23 Oct 2024 11:09:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AF4C23857C6A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org AF4C23857C6A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729681755; cv=none; b=ZM5fzc1ygCT98iS7fCmyD5XE4DumtBo3U2UbQJnXuxhK9HvJR+XK2/5dAMA6k83t5pFitD9wMPDsvvutk8p6SHQCpMuL3k9Paom0p1Rj3FtqGP5qraBfM/5E7D7O/zUBKtJbiMyk4jJM79ZDIAk0tZzHi/gS4NxiAJOy1WfKqGY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729681755; c=relaxed/simple; bh=+MmeyNrxOyE2Vp+k+iVYy41VmM8wxZFbSIXownj0CUY=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=xZz+QHUYpyW7Y7CP/i9fvpRnOxNDK8fdlXMD4FF9FTudjlivX6+KnufbkD73Iz4CQbcoY/moVX0C06aGHRxXSOk+OpAKN+Iu2KSIPdKA1KcZ+1ZctfUVZe0JyuRlwrNaA9crGud0CRdptgWrAZ5wYPY5VP0FLIkTClQzg7Yc3z8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 37DF0497; Wed, 23 Oct 2024 04:09:39 -0700 (PDT) Received: from udebian.localdomain (unknown [10.1.39.30]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D1BE23F528; Wed, 23 Oct 2024 04:09:08 -0700 (PDT) From: Yury Khrustalev To: gcc-patches@gcc.gnu.org Cc: nsz@gcc.gnu.org, richard.earnshaw@arm.com, matthieu.longo@arm.com, richard.ball@arm.com Subject: [PATCH 21/22] aarch64: Fix tests incompatible with GCS Date: Wed, 23 Oct 2024 12:05:27 +0100 Message-Id: <20241023110528.487830-22-yury.khrustalev@arm.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241023110528.487830-1-yury.khrustalev@arm.com> References: <20241023110528.487830-1-yury.khrustalev@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org From: Matthieu Longo gcc/testsuite/ChangeLog: * g++.target/aarch64/return_address_sign_ab_exception.C: Update. * gcc.target/aarch64/eh_return.c: Update. --- .../return_address_sign_ab_exception.C | 19 +++++++++++++------ gcc/testsuite/gcc.target/aarch64/eh_return.c | 13 +++++++++++++ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/gcc/testsuite/g++.target/aarch64/return_address_sign_ab_exception.C b/gcc/testsuite/g++.target/aarch64/return_address_sign_ab_exception.C index ead11de7b15..6c79ebf03eb 100644 --- a/gcc/testsuite/g++.target/aarch64/return_address_sign_ab_exception.C +++ b/gcc/testsuite/g++.target/aarch64/return_address_sign_ab_exception.C @@ -1,16 +1,28 @@ /* { dg-do run } */ /* { dg-options "--save-temps" } */ /* { dg-require-effective-target arm_v8_3a_bkey_directive } */ +/* { dg-final { check-function-bodies "**" "" } } */ +/* +** _Z5foo_av: +** hint 25 // paciasp +** ... +*/ __attribute__((target("branch-protection=pac-ret+leaf"))) int foo_a () { throw 22; } +/* +** _Z5foo_bv: +** hint 27 // pacibsp +** ... +*/ __attribute__((target("branch-protection=pac-ret+leaf+b-key"))) int foo_b () { throw 22; } +/* { dg-final { scan-assembler-times ".cfi_b_key_frame" 1 } } */ int main (int argc, char** argv) { try { @@ -23,9 +35,4 @@ int main (int argc, char** argv) { } } return 1; -} - -/* { dg-final { scan-assembler-times "paciasp" 1 } } */ -/* { dg-final { scan-assembler-times "pacibsp" 1 } } */ -/* { dg-final { scan-assembler-times ".cfi_b_key_frame" 1 } } */ - +} \ No newline at end of file diff --git a/gcc/testsuite/gcc.target/aarch64/eh_return.c b/gcc/testsuite/gcc.target/aarch64/eh_return.c index 32179488085..51b20f784b3 100644 --- a/gcc/testsuite/gcc.target/aarch64/eh_return.c +++ b/gcc/testsuite/gcc.target/aarch64/eh_return.c @@ -1,6 +1,19 @@ /* { dg-do run } */ /* { dg-options "-O2 -fno-inline" } */ +/* With BTI enabled, this test would crash with SIGILL, Illegal instruction. + The 2nd argument of __builtin_eh_return is expected to be an EH handler + within a function, rather than a separate function. + The current implementation of __builtin_eh_return in AArch64 backend emits a + jump instead of branching with LR. + The prologue of the handler (i.e. continuation) starts with "bti c" (vs. + "bti jc") which is a landing pad type prohibiting jumps, hence the exception + at runtime. + The current behavior of __builtin_eh_return is considered correct. + Consequently, the default option -mbranch-protection=standard needs to be + overridden to remove BTI. */ +/* { dg-additional-options "-mbranch-protection=pac-ret+leaf+gcs" { target { default_branch_protection } } } */ + #include #include