This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Using __sync_* builtins within libgcc code
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Paolo Carlini <paolo dot carlini at oracle dot com>
- Cc: Luke Dalessandro <luked at cs dot rochester dot edu>, gcc at gcc dot gnu dot org
- Date: Tue, 10 Jun 2008 12:00:26 +0000 (UTC)
- Subject: Re: Using __sync_* builtins within libgcc code
- References: <484DF34C.5040005@cs.rochester.edu> <484E21D5.4020201@oracle.com>
On Tue, 10 Jun 2008, Paolo Carlini wrote:
> Luke Dalessandro wrote:
> > I'm making some modifications to exception handling inside of
> > unwind-dw2-fde.c that I'd like to use __sync_bool_compare_and_swap for,
> > unfortunately I can't seem to figure out how to correctly use builtins in
> > the context of libgcc.
> >
> > I've tried a bunch of different things, but I consistently get the error
> >
> > bin/../lib/gcc/i686-pc-linux-gnu/4.3.1/../../../libgcc_s.so: undefined
> > reference to `__sync_bool_compare_and_swap_4'
> >
> > so clearly I'm not getting this symbol included correctly when I build. Any
> > advice would be appreciated.
> Isn't this the well know, annoying, issue that the default sub-architecture is
> i386 and the builtins are only available on i486 and later?
I hold that it is a bug that i686-* tools default to -march=i386 instead
of -march=i686 (whereas e.g. sparcv9-* tools default to -mcpu=sparcv9, and
-mcpu means -march for SPARC). My --with-arch-32 etc. patch
<http://gcc.gnu.org/ml/gcc-patches/2008-06/msg00124.html> (config/i386
part pending review) would facilitate fixing this bug by making i686-*
imply --with-arch-32=i686 instead of --with-cpu-32=i686, while leaving the
64-bit defaults (for which mode -march=i686 is invalid) unaffected.
--
Joseph S. Myers
joseph@codesourcery.com