Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1574465rdd; Thu, 11 Jan 2024 03:26:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IH6WumFEE4G+sJdDG0W4CqKRRVGxUrVaeg1RqZnCujYGdvN1gnxvUVF7hg2Nh/YbkcmEeob X-Received: by 2002:a05:6a20:9193:b0:19a:509c:cebc with SMTP id v19-20020a056a20919300b0019a509ccebcmr637493pzd.51.1704972406351; Thu, 11 Jan 2024 03:26:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704972406; cv=none; d=google.com; s=arc-20160816; b=gMf0nlesGRIFa7npAkwnD0Ctn0M07NN9F96m0fJMGD33Nvzr+zMslzjB41a7Wn+cTD VI5div/Tr5ha9+BcH9X4DYLourGxmgv2qf7APFmSn5iwlDF7Mt87r1X4Fkg0YjuxsxS7 qZadWt2qONF0f09JXus1CdiGefXj1f/9L9WNbEvoWA1xRLr0//UV7njLlCY2QXR9ygj5 O5b0h98r4q5f87/VVNYg6UHui2tZykiP3I0eHPBQR6ZVS0McSA35X7eWPnzH/UtBmjGG cbhQJjMm7rXEIq8koksnDrJVRqY+gDURapgOsVfYftqaoyUCEGU/WEJnZi4kpeVyJb3c QWNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date; bh=mihCD67sW6IX5F+Xv79ihN8FZkEu+HusiaqPraJ8UnM=; fh=FaJHR4CrKYY/0ZGra1uQF5RhmB8bDUmlo3rF84XFbpQ=; b=HsCqMI8ANDlpidBHP0lV/JCo2s9yi8JKmZOwHhtzLxFTENL7MG9wrBig3NbiFXE9Ys Id9EJ1ACK7qbjZjsc1KTDb8qY2if/Y4+6+88v72PE2i9AFmg41rpB3yC9M7IEQ3bUg8Q IwVGIcCSAxNzJ8CRHXEsaAmjbTZHI4EOU8C3Hk3Exwj+vBfcF9xsnZPCv1G53FuDEi6i V9zJ88KOrUewHC2cUpT0McOxUrJEdFEKk85zdOiUsf6XfZl70Md5pDBqiEROhJFEs3C7 O8n35jWcT1jSZmy+wRf+UyHE2wn5CtOSVFkxC6RSC0mhyWnCFoI2k98T5sA6hR8r+Am4 PcCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-23481-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23481-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id o21-20020a17090aac1500b0028ca62c1ba5si3434052pjq.181.2024.01.11.03.26.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 03:26:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23481-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-23481-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23481-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 06FED2892E5 for ; Thu, 11 Jan 2024 11:26:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D261915482; Thu, 11 Jan 2024 11:26:40 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3B72514F94 for ; Thu, 11 Jan 2024 11:26:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 467342F4; Thu, 11 Jan 2024 03:27:22 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.90.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 667C03F64C; Thu, 11 Jan 2024 03:26:35 -0800 (PST) Date: Thu, 11 Jan 2024 11:26:32 +0000 From: Mark Rutland To: richard clark Cc: Segher Boessenkool , Xi Ruoyao , gcc-help@gcc.gnu.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: undefined reference to `__aarch64_cas4_sync' error on arm64 native build Message-ID: References: <9aef98eed96ed32962ce90499291cb30ad5e3e14.camel@xry111.site> <20240109074843.GI19790@gate.crashing.org> <4ee8067e72028b070d92e10fa33ddde3a498cb48.camel@xry111.site> <20240109082647.GJ19790@gate.crashing.org> <20240110141005.GL19790@gate.crashing.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Thu, Jan 11, 2024 at 09:42:40AM +0800, richard clark wrote: > On Wed, Jan 10, 2024 at 10:12 PM Segher Boessenkool > wrote: > > > > On Wed, Jan 10, 2024 at 01:59:53PM +0800, richard clark wrote: > > > A ported driver in linux kernel calls '__sync_val_compare_and_swap', > > > > That is a builtin function. It does not necessarily expand to an actual > > function call. aarch64 will typically expand it to inline code. > > > native gcc version: > gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 > cross-compiler gcc version: > aarch64-linux-gnu-gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 > > Interesting, the same '__sync_val_compare_and_swap' in the .c file > will be 'U __aarch64_cas4_sync' in the .o file compiled by native, > will be 't __cmpxchg_case_mb_32' in the .o file compiled by > aarch64-linux-gnu-gcc... don't know what the reason is The __cmpxchg_case_mb_32() function is kernel code from arch/arm64/include/asm/cmpxchg.h, so I do not believe that's being generated by the compiler from __sync_val_compare_and_swap(). Are you certain that's being built from the exact same C file? Are you able to share the code in question? Where has it come from in the first place? Thanks, Mark.