[RTEMS Project] #3250: Remove Use of bsp_specs

RTEMS trac trac at rtems.org
Tue Nov 21 19:27:53 UTC 2017


#3250: Remove Use of bsp_specs
---------------------------+------------------------
 Reporter:  Joel Sherrill  |      Owner:  (none)
     Type:  defect         |     Status:  new
 Priority:  normal         |  Milestone:  Indefinite
Component:  admin          |    Version:  5
 Severity:  normal         |   Keywords:
---------------------------+------------------------
 The bsp_specs file in each BSP directory is GCC specific and a barrier to
 supporting other compilers including clang/llvm. The bsp_specs file is
 used in a variety of ways including some odd build system dependencies and
 this ticket is to track eliminating those uses and the direct use of
 bsp_specs themselves for extending GCC options.

 The primary use of the bsp_specs file is to extend GCC's notion of what to
 link with. The bsp_specs itself commonly specifies:

 * start.o file
 * program entry point
 * crt[in].o or crtbegin.o/crtend.o
 * linker script
 * Frequently, arguments which are implicitly passed to ld.

 This is typical and from a recently added BSP:

 {{{
 %rename endfile old_endfile
 %rename startfile old_startfile
 %rename link old_link

 *startfile:
 %{!qrtems: %(old_startfile)} \
 %{!nostdlib: %{qrtems: start.o%s crti.o%s crtbegin.o%s -e _start}}

 *link:
 %{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}

 *endfile:
 %{!qrtems: %(old_endfiles)} %{qrtems: crtend.o%s crtn.o%s }
 }}}

 Note that it has the implicit "-dc -dp -N" arguments which are passed to
 ld.
 The -dc and -dp options are equivalent and assign space to common symbols
 even with linking with -r. Why these two options are included is a mystery
 lost to time. Similarly the -N sets the .text and .data sections to be
 readable and writable and do NOT page align the data segment. This option
 is also a blast from the ancient past and likely should not be used.

 The "-qrtems" option is used with this pattern when compiling and linking
 RTEMS programs:

 {{{
 -B${PREFIX}/${BSP}/lib/ -specs bsp_specs -qrtems
 }}}

 The -B says that the following directory is a system directory. It is
 treated as a "lib" directory and is also assumed to have an include/
 subdirectory. They are added to the linker and include search paths,
 respectfully. The -specs option references the bsp_specs and adds the
 -qrtems options which are then tripped by specifying -qrtems. Every part
 of this must be eliminated and performed in a manner that is more amenable
 to using a compiler other than GCC.

 In order to eliminate the bsp_specs, the arguments used in each BSP's
 version will have to be reviewed, made common, and then eliminated. A
 similar effort was performed when the BSP specific make-exe rules were
 eliminated from the "make/custom" files and a common pattern was put in
 place.

 In addition to using the bsp_specs to specify details about linking and
 include files, the build system has quite a few odd dependencies on the
 presence of bsp_specs:

 * all BSP configure.ac use bsp_specs like this:

 {{{
 AC_CONFIG_SRCDIR([bsp_specs])
 }}}

 The idea was that this was a unique file to ensure the script was in the
 right directory. This can be changed to use a specfic make/custom/*.cfg
 file and not lose any integrity checking.

 * all BSP Makefile.am have this:

 {{{
 dist_project_lib_DATA = bsp_specs
 }}}

 That can just be removed when we don't use the file.

 * ./aclocal/check-bsps.m4 uses it to see if it is BSP directory

 * bootstrap uses it generate the list of BSP directories for the
 libbsp/*/acinclude.m4 files

 * Other references are either comments or obvious uses of it in
 some invocation of GCC.

--
Ticket URL: <http://devel.rtems.org/ticket/3250>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list