From patchwork Wed Jun 5 16:07:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Andre Vieira (lists)" X-Patchwork-Id: 1943929 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VvXS64cbdz20WK for ; Thu, 6 Jun 2024 02:08:05 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EDAA1399DB22 for ; Wed, 5 Jun 2024 16:08:02 +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 D69C4398A7CF for ; Wed, 5 Jun 2024 16:07:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D69C4398A7CF 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 D69C4398A7CF 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=1717603660; cv=none; b=XPbg/RBVzd31IKh6NkxWazExPTtD+PZA6dlxxbyE1GZPwnUQP2RF2rSw+Rg8U/obcyS8ybWB86LyUhpATpU41gQ79wcJNnw6Dw2Dcbx5DACD3beu+saHEDAKXi9IqFOW4STayOM9PIGJkBmKc22AhYhT0Hh3a/zhe7gF676dkq0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717603660; c=relaxed/simple; bh=24H8smoETOWEbfHuXvzfMU54kAQcQkCVB+aFDLqsYtE=; h=Message-ID:Date:MIME-Version:To:From:Subject; b=HtrfTSr2Px/oZ9NZxwhhOEg7fliKc2eu51UTmwZuhk1frPHUMF8bcsFCKwZ120b39afe2tAwXI19j8j3jh83cL2JEHjxsVMuME8xIsgBuR45x3wHQ9OGPVJk7Ek/UqKS96aisnV1L/YGCkI8GByVRAAcEebzKW1MeZ5LQwKQvOs= 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 AEAC0339; Wed, 5 Jun 2024 09:08:02 -0700 (PDT) Received: from [10.57.69.194] (unknown [10.57.69.194]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E8F983F64C; Wed, 5 Jun 2024 09:07:37 -0700 (PDT) Message-ID: <741d8c16-702c-45cd-ba73-a7c8fc4869e2@arm.com> Date: Wed, 5 Jun 2024 17:07:36 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: "gcc-patches@gcc.gnu.org" Cc: Richard Earnshaw From: "Andre Vieira (lists)" Subject: arm: Add .type and .size to __gnu_cmse_nonsecure_call [PR115360] X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Hi, This patch adds missing assembly directives to the CMSE library wrapper to call functions with attribute cmse_nonsecure_call. Without the .type directive the linker will fail to produce the correct veneer if a call to this wrapper function is to far from the wrapper itself. The .size was added for completeness, though we don't necessarily have a usecase for it. I did not add a testcase as I couldn't get dejagnu to disassemble the linked binary to check we used an appropriate branch instruction, I did however test it locally and with this change the GNU linker now generates an appropriate veneer and call to that veneer when __gnu_cmse_nonsecure_call is too far. OK for trunk and backport to any release branches still in support (after waiting a week or so)? libgcc/ChangeLog: PR target/115360 * config/arm/cmse_nonsecure_call.S: Add .type and .size directives. diff --git a/libgcc/config/arm/cmse_nonsecure_call.S b/libgcc/config/arm/cmse_nonsecure_call.S index f93ce6bb4f9f679020c9684c56f5916f1c0bf73c..fef37b955af673fb975dd64229d5e0647afe0d00 100644 --- a/libgcc/config/arm/cmse_nonsecure_call.S +++ b/libgcc/config/arm/cmse_nonsecure_call.S @@ -33,6 +33,7 @@ #endif .thumb +.type __gnu_cmse_nonsecure_call, %function .global __gnu_cmse_nonsecure_call __gnu_cmse_nonsecure_call: #if defined(__ARM_ARCH_8M_MAIN__) @@ -142,3 +143,4 @@ pop {r5-r7, pc} #else #error "This should only be used for armv8-m base- and mainline." #endif +.size __gnu_cmse_nonsecure_call, .-__gnu_cmse_nonsecure_call