Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1356512rdd; Wed, 10 Jan 2024 17:43:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IG1+Oc0A1HndnOLvqrhNolZ2r20Kk25FQ0/8wkF2732FZgCvZWvTzjElPbCRyyKO/OkmoOa X-Received: by 2002:a17:907:1118:b0:a26:88f4:3fae with SMTP id qu24-20020a170907111800b00a2688f43faemr176465ejb.67.1704937383042; Wed, 10 Jan 2024 17:43:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704937383; cv=none; d=google.com; s=arc-20160816; b=FYM8r1W+XjOhZzUt+y2LlmBRQtid58j+eBbodESg09hFHIbRlTgVgtV9X2AJhSS+hz 8RlPnMqjF8BjW9FghtPvsDuuzv8+I2yCZaZrN9vbwF0yNx9Jt5JbJ0kSEoTYyE9UGMRX kohkbrPASeoK6PsR4ZXCDSFt44uydk4ovrCLzC2Kx/IP0z/F0Zfr5xprZc18heJeBscQ re8zRU/ImK8h3ZtIS8YYUUBKB3rOke5QRcAUKAc7KkqadPBe1OX+kwRNskf4YdWhl2yb MRM+U1q0W0B+weCoGC2mvJ+4uwkBPUS8w+nsQmAYLBe4CBNmgh3D5GbxNiRYLY1vZdKs VaHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=573C8j1oW9pjIQTawxUe9zQgrGOkmk9aCSFBWOlk+GA=; fh=a/vmL6y1hAdZHDfAFxjnfhM0W5oIvmLCCNQgoFXVbZ4=; b=zkrG4KdpBrVOiztEM50D53yw8DkdcDpaef6S7r/BaRN4I6eEmEMnM3Znd92JuT50KJ 63NHk4+6AW85ORenkMZlartfdr9G61XEYHPX04mkKEPKjUR/IX8AvrAUMrs34IoC88y1 8oSNClJ2V6k/XhqJdeYGYDSPYGBpGQcDO6BNnZsUS5rK1RCBQhBFR/Q4khh0xNikC7wz dVEBsIE7wMoDZtZ1GNu8EK7YIIPg7ACrIwlWr/SttFrAH+tjr+xiRUtvxfSm6Z8vvsoT 4JX3OcXp/vI0eOLDOkRKgnQEppEqovIuVBpOLpSEMtCsAVgNQZaajZhj1u/2yIDOw72i ZmgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Uh0of29+; spf=pass (google.com: domain of linux-kernel+bounces-22932-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22932-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id lt11-20020a170906fa8b00b00a2b9bcf65bbsi6938ejb.984.2024.01.10.17.43.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 17:43:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22932-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Uh0of29+; spf=pass (google.com: domain of linux-kernel+bounces-22932-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22932-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 am.mirrors.kernel.org (Postfix) with ESMTPS id C90101F23DD2 for ; Thu, 11 Jan 2024 01:43:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E3C9B1866; Thu, 11 Jan 2024 01:42:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Uh0of29+" Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8563117C1 for ; Thu, 11 Jan 2024 01:42:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-337874b8164so79652f8f.2 for ; Wed, 10 Jan 2024 17:42:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704937371; x=1705542171; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=573C8j1oW9pjIQTawxUe9zQgrGOkmk9aCSFBWOlk+GA=; b=Uh0of29+/sBQ1ViJPMxO5QKddz+h4K0hWldINK+oSMOS7Hv8mF67nsFcZVne74VmvP SUz8N5qLJkdO+l4Erb04lqWkSdctn+DqvB3VD8yP0RcZoUwcDb4V2/1REH7BeqCGdTus 6vptcLGlcDHNcMs3FQV/gUkwcibInltenR9rtL8JdFi2cvBM1qU1uOH6NXLGA+oX45f3 jbvJaa72OKoTyyYvs4lJ8bc4XH+zyLYHNj0A1Yi/tWU3AmbV/gnh62kaydqvoor3/pH0 OfKKXE8QsYt3M5zcCHzi3iUYZyd91Zn1yKqVSrkCQQixNSTIjL2bPbMEAeJdAeIJ+U4P C6rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704937371; x=1705542171; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=573C8j1oW9pjIQTawxUe9zQgrGOkmk9aCSFBWOlk+GA=; b=BPHxtWa0wSl5rCosdvXKIxSKg2dz9NsNyRnNJjLxU9EYY7oxSkvzf3Z6m3Wo99dk3V jYaails/ALKfmTcgKmfSi9KBedUCOmpV5Q/eG9Ls0CO9rR/Y/PcbZ/EiXpCdBT7i3M70 r48zd+Bi7rCdOzucbCCv6JdafagVYhydb1V26/YgbizzwZwLWiIEjwGMDevjrV/uPEV3 /Lp7jYnpgfY8Vxynu2nb9h2md0SNwBmp6T2JMf2ZkPQUJ13Waem9eBElNjY7Vpe+c+mq nVoflxKbHUo7G+Jr9xDeMROCPCvWMwK+mr16JuUdekwwvk094eIyaZy2zquQHC/LSfAD v2Sw== X-Gm-Message-State: AOJu0YyZDW8UHChAH1z+uQaOQCX5Iq05FH6zFg5hElMMBZf2kKLr+JAv Q6ZsmX2HjI1gk/UDtIbSTIxcZBTzD0amynovYQY= X-Received: by 2002:a5d:6249:0:b0:336:6e22:672c with SMTP id m9-20020a5d6249000000b003366e22672cmr152305wrv.88.1704937371516; Wed, 10 Jan 2024 17:42:51 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <9aef98eed96ed32962ce90499291cb30ad5e3e14.camel@xry111.site> <20240109074843.GI19790@gate.crashing.org> <4ee8067e72028b070d92e10fa33ddde3a498cb48.camel@xry111.site> <20240109082647.GJ19790@gate.crashing.org> <20240110141005.GL19790@gate.crashing.org> In-Reply-To: <20240110141005.GL19790@gate.crashing.org> From: richard clark Date: Thu, 11 Jan 2024 09:42:40 +0800 Message-ID: Subject: Re: undefined reference to `__aarch64_cas4_sync' error on arm64 native build To: Segher Boessenkool Cc: Xi Ruoyao , Mark Rutland , gcc-help@gcc.gnu.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jan 10, 2024 at 10:12=E2=80=AFPM 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 cross-compiler 'aarch64-linux-gnu-gcc' doesn't complain > > '__aarch64_cas1_sync' undefined reference, but the native compiler > > will complain. As Mark mentioned, I double check that both cross and > > native compiler should have ''-moutline-atomics' option enabled, do > > you know the reason for that? > > Ah, so you are requesting external functions. > > I am no aarch64 expert, but apparently there were some problems in > GCC 11, maybe that is what you saw? Or with some distros, anyway. > > It also matters if you have ARMv8.1-A enabled, the LSE instructions. > > Open a GCC bug report if you have more details? Thanks, > > > Segher