From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id 017473857C5B for ; Thu, 11 Jan 2024 01:42:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 017473857C5B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 017473857C5B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::42d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704937374; cv=none; b=PlLnF6BT+8XdNtuNc5KCRm6gIdYxaLR7rAStI+tWO/g8PpztZTu7KTgCjx+XnTcDL2/JQTmZC8BPLB25cLE0h7zZ75er6h1YfDrFp/sxI3PJNjkHyTMdmG/9g4gxM6Ex3D0Gp8P9wMqYsH8FaBsg0EapnpNSyJwbWISZDDH4fWA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704937374; c=relaxed/simple; bh=jKSju/ULz8tzV7f5g7u9BO0kOGWEsWH62xsU78cgj+o=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=skNJYclGTyYRv9iCaxUohgygNTpzwKUEE8FoAsVflqmCqkYEzKc0oBmW6kVQKXeZFKrAJ4yt+ns2YX9DySiEpAzBuB8Wtk7dRt0/YiP/I9GHw2h5p3JZWIkucF5xTo9XTZQTsOweM7JhltU4WyAJrqZcJdZ8sDZB4oHB0/wfhj0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-33765009941so3809206f8f.3 for ; Wed, 10 Jan 2024 17:42:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704937371; x=1705542171; darn=gcc.gnu.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=Hyjx+YDfIjVEHernbuT8paEApzbRrE0BsK12exAfSQoQVydDN9S28JsSzxE3Go5cvV Dd8rC3Z78IgqlTD+889DdwO3H6ERSk3qh7fE7cMdVVqTTHMZ9G+HS2NQHf0SZCXQj+Ra 4GABJKDuu6eK+WvE68cclfaIvI7jh3gyWupcs3MDxkhgORPut8pNGL7yIhDJWfWO2aLb odackzkaoBKPxPzRzPwzFmYHzouzFUjG2/b8as5q5L6i/b74P6bV7B0AWTJA7aPJ10Cn LWmAtrtu3MI3nwfuw9PYM2z3Uk2CpQWzV73ATqDD637GUW0gmea93b6+2NEljuDE6hBu uRwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704937372; x=1705542172; 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=I07qJxgaYqc7WVn6tInpq9r5dMKbPKgNm9VBliu9Z0CG6WIUJGFugOgT16NWrOkjjG jKowI7AZNttLIlSsWjC9tHle9KCG1FwRolgcHA5oKi3AcqMr08wVqqPTEFW6VdGcz6jX YMQWDPJfz+jCwbdbk0KffeQG6AP7qc8mVFHcKw+IKR8vUwR6HZFKlBjRYFqOhYiqRlj9 2+C5fbTeGhZU93Lu6hnLm44LTNZfbpz3HUorGJ6A7maqLZuvJFwlB/0ZBR/CFMkvXXuQ +EIdJGzza+faW5LVIBgx2sajTQGw51SWrpdhMYxL7plF69thEn/dh8ulWZRSY8iEUNjO mWGA== X-Gm-Message-State: AOJu0YyrXAlcxI4n8AUtW9cz/Hzwu1RevH5ondZdtYxZHq8yzL74zwcf smiAN4QemCn30dnNwykzbZxwkd8u3yOccQqE9Dk= X-Google-Smtp-Source: AGHT+IF1QQxMj+kJ7E5CkPp9//yJvfVwqEeCmFKFHCWTvnFQD7/ODwzXbyzBUE4kGeCpdOfe72f4HAr3EIT9SF4xZWk= 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) 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 X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 List-Id: 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