#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 (7)

comment:1 Changed on Dec 19, 2017 at 5:07:13 PM by Joel Sherrill <joel@…>

In b0b93c8a/rtems:

gensh4: Simplify bsp_specs

Updates #3250.

comment:2 Changed on Feb 5, 2018 at 11:37:24 PM by Chris Johns

Component: adminbuild

comment:3 Changed on Apr 6, 2020 at 2:01:59 PM by Sebastian Huber

Blocked By: 3818, 3937 added

comment:4 Changed on Jan 26, 2021 at 5:40:00 AM 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 Jan 28, 2021 at 5:30:16 AM by Sebastian Huber <sebastian.huber@…>

In 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 Jun 18, 2021 at 9:24:45 AM by Sebastian Huber

Keywords: qualification added

comment:7 Changed on Sep 21, 2021 at 8:25:58 AM by Sebastian Huber <sebastian.huber@…>

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

In db8f598/rtems:

build: Remove old build system

Close #3250.
Close #4081.

Note: See TracTickets for help on using tickets.