From patchwork Wed Oct 23 08:39:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Khrustalev X-Patchwork-Id: 99367 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 12AD1385842C for ; Wed, 23 Oct 2024 08:43:14 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 45E2B3858C35 for ; Wed, 23 Oct 2024 08:42:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 45E2B3858C35 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 45E2B3858C35 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=1729672948; cv=none; b=PACXlyFIZ6k1ejkyZLJPtfofAodZ9EKwiuhAsgnxgEMx5SXqtVctHrvfcpfrQLaJWnr0/59PDdQ4w1QJytPsIuNQmOoDGRHTlacxhY5xsSjXHBX4WXKeZYyeWoxLPbmGUxXr6yPvMT9JqJTQC3Y51X2SZznfyFf/AkQ2WAfI+Qo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729672948; c=relaxed/simple; bh=drjrkgcPtoTucmHisp6+M/HTlfkjgOi9EKNnAeY2aIg=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=VB6P2UFP/YtY7hutJFFrqKYutSHZcx32h3/ZmVauqQpujYRWHDnyBCvr7zoBSjT6UAdq6UUQsTgNDa2J+3QFflpSt8v96wlQeaFGWiz+lHQFuMTCkErYrqH/0J7x1LyUIMYNw7sstC9fkLyFyH+35BL2JzvkCLJADBuWyaJ0trw= 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 C1D0C1575; Wed, 23 Oct 2024 01:42:52 -0700 (PDT) Received: from udebian.localdomain (unknown [10.1.39.30]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 66C363F528; Wed, 23 Oct 2024 01:42:22 -0700 (PDT) From: Yury Khrustalev To: libc-alpha@sourceware.org Cc: fweimer@redhat.com, adhemerval.zanella@linaro.org, codonell@redhat.com, nsz@gcc.gnu.org Subject: [PATCH v3 08/23] aarch64: Mark swapcontext with indirect_return Date: Wed, 23 Oct 2024 09:39:05 +0100 Message-Id: <20241023083920.466015-9-yury.khrustalev@arm.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241023083920.466015-1-yury.khrustalev@arm.com> References: <20241023083920.466015-1-yury.khrustalev@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.0 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org From: Szabolcs Nagy --- sysdeps/aarch64/bits/indirect-return.h | 36 ++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 sysdeps/aarch64/bits/indirect-return.h diff --git a/sysdeps/aarch64/bits/indirect-return.h b/sysdeps/aarch64/bits/indirect-return.h new file mode 100644 index 0000000000..99905f21fa --- /dev/null +++ b/sysdeps/aarch64/bits/indirect-return.h @@ -0,0 +1,36 @@ +/* Definition of __INDIRECT_RETURN. AArch64 version. + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _UCONTEXT_H +# error "Never include directly; use instead." +#endif + +/* __INDIRECT_RETURN indicates that swapcontext may return via + an indirect branch. This happens when GCS is enabled, so + add the attribute if available, otherwise returns_twice has + a similar effect, but it prevents some code transformations + that can cause build failures in some rare cases so it is + only used when GCS is enabled. */ +#if __glibc_has_attribute (__indirect_return__) +# define __INDIRECT_RETURN __attribute__ ((__indirect_return__)) +#elif __glibc_has_attribute (__returns_twice__) \ + && defined __ARM_FEATURE_GCS_DEFAULT +# define __INDIRECT_RETURN __attribute__ ((__returns_twice__)) +#else +# define __INDIRECT_RETURN +#endif