From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id DC6623857C4F for ; Thu, 11 Jan 2024 11:26:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DC6623857C4F 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 DC6623857C4F 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=1704972398; cv=none; b=q3fmIQrAjWRrzoVLwa6zEgR+aeGIECNUk8i31omhLHJSSu6JTYY8hcUsLy9/5mZ/meOQHT9Yto+VTDcaiHJuPozeegLaN5zvd4MEMUZXgEafxY/+yD0UkRCgOSfZkNP+SJxA76/r4pJjGes4z4E1Df21IsfsBhs874VdCg1NBVI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704972398; c=relaxed/simple; bh=qaJMBX7HPHpfhpFB2AValyvbSAslC+H+uK+mpW38z9g=; h=Date:From:To:Subject:Message-ID:MIME-Version; b=QUAZR/5YyTAEiCMeb8o723vtfTCU224lZ619POXgMxKGXwY7Q6h/sLetVx2bihxpBDPkWEyigKhsFspiKmR4NRKMTixnwsJ+oyNYnPYTb+RFoYqQdX6iu/jR4J0Q2FKdECZSAdFuTvIzgkeKDfNj6Q4R93z+H8g2CyyDxjoQrE4= 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 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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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.