Notice: We have migrated to GitLab launching 2024-05-01 see here: https://gitlab.rtems.org/

#3250 closed defect (fixed)

Remove Use of bsp_specs

Reported by: Joel Sherrill Owned by: Sebastian Huber <sebastian.huber@…>
Priority: normal Milestone: 6.1
Component: build Version: 5
Severity: normal Keywords: qualification
Cc: Blocked By: #3818, #3937
Blocking:

Description

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.


Change History (8)

comment:1 Changed on 12/19/17 at 17:07:13 by Joel Sherrill <joel@…>

In [changeset:"b0b93c8a1b782a77529d2c35a05ab770aaddb4c2/rtems" b0b93c8a/rtems]:

gensh4: Simplify bsp_specs

Updates #3250.

comment:2 Changed on 02/05/18 at 23:37:24 by Chris Johns

Component: adminbuild

comment:3 Changed on 04/06/20 at 14:01:59 by Sebastian Huber

Blocked By: 3818, 3937 added

comment:4 Changed on 01/26/21 at 05:40:00 by Sebastian Huber

Milestone: Indefinite6.1

The bsp_specs are only used by the old build system and can be removed with along the old build system.

comment:5 Changed on 01/28/21 at 05:30:16 by Sebastian Huber <sebastian.huber@…>

In [changeset:"b361eabd93e35e2c72d3721583fa83fb14e39f4d/rtems" b361eabd/rtems]:

bsps: Replace bsp_specs with an empty file

This fixes an issue with the latest tool chain which adds the default
linker script in the endfile specification.

Update #3250.

comment:6 Changed on 06/18/21 at 09:24:45 by Sebastian Huber

Keywords: qualification added

comment:7 Changed on 09/21/21 at 08:25:58 by Sebastian Huber <sebastian.huber@…>

Owner: set to Sebastian Huber <sebastian.huber@…>
Resolution: fixed
Status: newclosed

In [changeset:"db8f598d56951cf43f22a5e325e0d23c8f7559f9/rtems" db8f598/rtems]:

build: Remove old build system

Close #3250.
Close #4081.

comment:8 Changed on 09/12/22 at 06:55:14 by Sebastian Huber <sebastian.huber@…>

In [changeset:"8f4543f202798095353afda44141ebb6b5b2e4e5/rtems-docs" 8f4543f/rtems-docs]:

user: Mention that the bsp_specs are gone

Update #3250.

Note: See TracTickets for help on using tickets.