[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJNi4rOKQ9DZHEJw=bMFEGUqqGDb_58Y6mxDMRbCPk2Kzwtx1Q@mail.gmail.com>
Date: Mon, 15 Jan 2024 17:23:05 +0800
From: richard clark <richard.xnu.clark@...il.com>
To: Mark Rutland <mark.rutland@....com>
Cc: Segher Boessenkool <segher@...nel.crashing.org>, Xi Ruoyao <xry111@...111.site>, gcc-help@....gnu.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Subject: Re: undefined reference to `__aarch64_cas4_sync' error on arm64
native build
Hi Mark,
On Thu, Jan 11, 2024 at 7:26 PM Mark Rutland <mark.rutland@....com> wrote:
>
> On Thu, Jan 11, 2024 at 09:42:40AM +0800, richard clark wrote:
> > On Wed, Jan 10, 2024 at 10:12 PM Segher Boessenkool
> > <segher@...nel.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 __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?
>
Ah, double check and the misleading info about the native and cross
compiler, the native gcc(Ubuntu 11.4.0-1ubuntu1~22.04) and the
cross-compiler - aarch64-linux-gnu-gcc(Ubuntu 11.4.0-1ubuntu1~22.04)
will generate the same link error, but the cross-compiler -
aarch64-buildroot-linux-gnu-gcc.
(aarch64-buildroot-linux-gnu-gcc.br_real (Buildroot 2020.08) 9.3.0)
will not generate the link error, I believe it should be as you said,
the aarch64-buildroot-linux-gnu-gcc doesn't enable '-moutline-atomics'
by default.
>
> Thanks,
> Mark.
Powered by blists - more mailing lists