-B option when compiling

Ralf Corsepius ralf_corsepius at rtems.org
Wed Nov 24 03:31:32 UTC 2004


On Tue, 2004-11-23 at 19:24 -0500, Smith, Gene wrote:
> Smith, Gene wrote, On 11/23/2004 7:12 PM:
> 
> > When I build netdemo with make -d and look at where init.c and test.c 
> > are compiled, it appears the -B option to powerpc-rtems-gcc is pointing 
> >    to the rtems library rather than the gcc library. -B is supposed to 
> > specify to gcc the location of executables and libraries of the compiler 
> > itself. However, netdemo works ok for me so maybe I am confused or this 
> > does not matter...?
Well, it may matter, it may not matter.

It basically depends on your BSP and on which parameters you are passing
to the compiler during compilation. There are BSPs which can be built
more or less without bsp_specs.

> Never mind. It must tell it where to get the
> "-specs bsp_specs -qrtems"
> since bsp_specs file is in dir pointed to by -B<path>.
More accurately: -B<directory>/

Note the trailing '/'. This is essential.

> Can anyone explain what bsp_specs file is for and/or how it is used.
GCC internally uses a file containing rules specifying how to process
certain arguments etc. at certain stages during compilation.

This file is called "specs"-files.

Depending on the version of GCC you are using, the default specs file
typically can be found in (GCC < 3.4.0)
<prefix>/lib/gcc-lib/<target>/<gcc-version>/specs
or (GCC >= 3.4.0)
<prefix>/lib/gcc/<target>/<gcc-version>/specs
e.g.
/opt/rtems-4.6/lib/gcc-lib/sparc-rtems/3.2.3/specs

bsp_specs is a GCC specs-file shipped with a BSP, which is supposed to
augment/override GCC's default settings from the default "specs" to hide
away BSP specific GCC settings a BSP might require.

As you already noticed, RTEMS meanwhile has reached a point, where using
bsp_specs in some cases almost has become more tedious than not using
them, and gradually start to qualify as historic artifact.

However, due to their flexibility, at least for the moment, there are no
plans to abandon them.

> Does this always need to be on the gcc command line when a application 
> file is compiled or assembled?
Strictly speaking, no. 

Alternatively, you could explicitly pass equivalent arguments/parameters
to gcc.

Furthermore, you don't need bsp_specs for building BSP-independent
libraries (E.g. building cpukit doesn't need it).

Ralf





More information about the users mailing list