-B option when compiling

Joel Sherrill <joel@OARcorp.com> joel.sherrill at OARcorp.com
Wed Nov 24 14:27:36 UTC 2004


Ralf Corsepius wrote:
> 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.

One of the issues with getting rid of them is that it is often hard
to tell what is a real BSP specific required change versus some random
thing that has crept in.

Right now, my personal pet peeve one is that the PowerPC BSPs use
rtems_crti.S and only those BSPs which do the magic right in the
bsp_specs and the Makefile get C++ global ctors and dtors. This
should move to part of gcc proper.

Some bsp_specs specify the entry point.  I believe this could be
moved to the linkcmds and further reduce the special cases in the
bsp_specs.

Ralf has nibbled at reducing them but it is difficult to know
when all BSPs for a particular CPU do it the same way and thus
makes the logic general.

As I touch BSPs, I have begun to diff the bsp_specs against
other BSPs for that CPU and slowly trying to get the diffs down.

> 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
> 
> 


-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
    Support Available             (256) 722-9985




More information about the users mailing list