Re: undefined reference to `__aarch64_cas4_sync' error on arm64 native build

From: Segher Boessenkool
Date: Tue Jan 09 2024 - 03:38:50 EST


On Tue, Jan 09, 2024 at 04:09:20PM +0800, Xi Ruoyao wrote:
> If GCC is configured with things like --with-arch=something, libgcc can
> contain (FP/vector) instructions unsafe to use in kernel w/o special
> handling.

No, it can not. Please file a bug (<https://gcc.gnu.org/bugs.html>) if
this happens to you. Thanks!

--with-arch= only sets the *default* options, the user can override this
always (with an -march= option, say).

> If libgcc is so vital GCC needs to provide a way to make it work for a
> set of compiler switches incompatible with any pre-built multilib. For
> example, installing the source of libgcc into /usr/lib/gcc and provide a
> tool to build a libgcc.a with the specified options.

That is how things are supposed to work, already. Either libgcc uses
only instructions that work everywhere, or libgcc is multilibbed, things
like that. In all normal cases this is completely transparent to the
compiler user.


Segher