On 3/27/24 20:07, Joel Sherrill wrote:
On Wed, Mar 27, 2024 at 3:53 AM Christophe Lyon via Gcc <gcc@gcc.gnu.org
<mailto:gcc@gcc.gnu.org>> wrote:
Hi!
On 3/26/24 22:52, Joel Sherrill via Gcc wrote:
> Hi
>
> For RTEMS, we normally build a multilib'ed gcc+newlib, but I have
a case
> where the CPU model is something not covered by our multilibs and
not one
> we are keen to add. I've looked around but not found anything
that makes me
> feel confident.
>
> What's the magic for building a gcc+newlib with a single set of
libraries
> that are built for a specific CPU CFLAGS?
>
> I am trying --disable-multlibs on the gcc configure and adding
> CFLAGS_FOR_TARGET to make.
>
> Advice appreciated.
>
I would configure GCC with --disable-multilibs --with-cpu=XXX
--with-mode=XXX --with-float=XXX [maybe --with-fpu=XXX]
This way GCC defaults to what you want.
Thanks. Is there any documentation or even a good example? I found
--with-mode=[arm|thumb] but am having trouble mapping the others back
to GCC options.
I don't know of any good doc/example.
I look in gcc/config.gcc to check what is supported.
I have this for CFLAGS_FOR_TARGET
"-mcpu=cortex-m7 -mthumb -mlittle-endian -mfloat-abi=hard
-mfpu=fpv5-sp-d16 -march=armv7e-m+fpv5"
I think that means...
--with-mode=thumb for -mthumb
--with-cpu=cortex-m7 for -mcortex-m7
--with-float=hard for -mfloat-abi=hard
That leaves a few options I don't know how to map.
You can see that for arm:
supported_defaults="arch cpu float tune fpu abi mode tls"
so there's a --with-XXX for any of the above, meaning that there's no
--with-endian (default endianness on arm is derived from the target
triplet eg. armeb-* vs arm-*)
Also note that config.gcc checks that you don't provide both
--with-cpu and --with-arch
or --with-cpu and --with-tune
HTH,
Christophe
--joel
Thanks,
Christophe
> Thanks.
>
> --joel