From: richard clark <richard.xnu.clark@gmail.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: Xi Ruoyao <xry111@xry111.site>,
Mark Rutland <mark.rutland@arm.com>,
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
Date: Thu, 11 Jan 2024 09:42:40 +0800 [thread overview]
Message-ID: <CAJNi4rMw1rN64hGZbraoDwtOJOMOumVWL_8iLaCb=TYXAhD2Jg@mail.gmail.com> (raw)
In-Reply-To: <20240110141005.GL19790@gate.crashing.org>
On Wed, Jan 10, 2024 at 10:12 PM Segher Boessenkool
<segher@kernel.crashing.org> 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
next prev parent reply other threads:[~2024-01-11 1:42 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-02 3:29 richard clark
2024-01-02 8:53 ` richard clark
2024-01-04 18:18 ` Mark Rutland
2024-01-08 1:28 ` richard clark
2024-01-08 10:51 ` Mark Rutland
2024-01-08 10:56 ` Xi Ruoyao
2024-01-09 2:55 ` richard clark
2024-01-09 3:05 ` Xi Ruoyao
2024-01-09 6:04 ` richard clark
2024-01-09 7:48 ` Segher Boessenkool
2024-01-09 8:09 ` Xi Ruoyao
2024-01-09 8:26 ` Segher Boessenkool
2024-01-10 5:59 ` richard clark
2024-01-10 14:10 ` Segher Boessenkool
2024-01-11 1:42 ` richard clark [this message]
2024-01-11 11:26 ` Mark Rutland
2024-01-15 9:23 ` richard clark
2024-01-09 2:52 ` richard clark
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJNi4rMw1rN64hGZbraoDwtOJOMOumVWL_8iLaCb=TYXAhD2Jg@mail.gmail.com' \
--to=richard.xnu.clark@gmail.com \
--cc=gcc-help@gcc.gnu.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=segher@kernel.crashing.org \
--cc=xry111@xry111.site \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).