#4080 closed enhancement (fixed)

build: Add start.o dependency to the executable link step

Reported by: Sebastian Huber Owned by: Sebastian Huber
Priority: normal Milestone: 6.1
Component: build Version: 6
Severity: normal Keywords: qualification
Cc: Blocked By:
Blocking:

Description (last modified by Sebastian Huber)

RTEMS is a real-time operating system and the applications using RTEMS end up in a single executable which contains also the full system initialization. The linker uses a start file to determine what should be linked into the executable. The start file is also built by the build system, however, it is only indirectly referenced via a linker script, for example:

https://git.rtems.org/rtems/tree/bsps/arm/shared/start/linkcmds.base#n28

So, every executable depends on the start file (start.o usually). If start.o changes, then the executable needs to be re-linked. Also the start file needs the name expected by the linker script, for example not start.S.17.o.

The start files are build with this commands:

https://git.rtems.org/rtems/tree/wscript#n535

https://git.rtems.org/rtems/tree/wscript#n244

Somehow we have to add a dependency on start.o to every executable.

To experiment with the build system use the following commands to set it up:

cd $HOME
mkdir rtems-sdk
mkdir rtems-sdk/src
cd rtems-sdk/src
git clone git://git.rtems.org/rtems.git
git clone git://git.rtems.org/rtems-source-builder.git rsb
cd rsb/rtems
../source-builder/sb-set-builder --prefix=$HOME/rtems-sdk/6 6/rtems-sparc
cd ../../rtems
echo "[sparc/leon3]" > config.ini
./waf configure --prefix=$HOME/rtems-sdk/6
./waf

The host must be capable to build GCC and needs the Python development support (header files) installed.

Change History (3)

comment:1 Changed on 09/16/20 at 07:04:51 by Sebastian Huber

Description: modified (diff)

comment:2 Changed on 09/17/20 at 06:58:03 by Sebastian Huber <sebastian.huber@…>

Resolution: fixed
Status: assignedclosed

In 4eea8d4/rtems:

build: Fix dependencies for start and asm files

Add a feature to enforce an explicit target file for assembler sources.
Add a build start file node list and use it as a test program
dependency.

The fix for #3846 and #4080 needs to be combined, because the fix
for #3846 requires the removal of 'before=cstlib?'. This patch fixes
two issues:

  1. The tracking of start file dependencies.
  1. Reflect that executables depend on the start files.

We need a start.o file in the right path so that the linker can find is
as specified by the linker script, and not for example a start.S.17.o
file in some path. This part is addressed by the "explicit_asm_target"
feature.

This build process extension

@after("apply_link")
@feature("cprogram", "cxxprogram")
def process_start_files(self):

if getattr(self, "start_files", False):

self.link_task.dep_nodes.extend(self.bld.start_files)

addresses 2.

Close #3846.
Close #4080.

comment:3 Changed on 06/23/21 at 07:07:55 by Sebastian Huber

Keywords: qualification added
Note: See TracTickets for help on using tickets.