Menu

Understanding gcc Makefiles for building RTS

Rolf Ebert
2016-02-10
2016-05-04
  • Rolf Ebert

    Rolf Ebert - 2016-02-10

    Hi,

    I am interested in better understanding the Makefile machinery in gcc
    for building the RTS for a cross compiler. I know that my question is
    not really related to Cortex, but I hope to find some knowledgeable
    people here.

    As the maintainer of AVR-Ada I completely cut parts of the Makefile in
    order to build the gnattools independently from building the RTS. The
    RTS is built and installed as part of installing AVR-Ada not as part of
    the building the compiler. I'd like, however, to build the RTS during
    the normal gcc build step.

    The Makefile in gcc/ada/gcc-interface/Makefile.in uses the three
    variables ADA_INCLUDE_SRCS, ADA_EXCLUDE_FILES, and LIBGNAT_TARGET_PAIRS.
    First, all files in ADA_INCLUDE_SRCS are linked (copied) into the rts/
    subdir, then the files in ADA_EXCLUDE_FILES are removed and finally the
    target specific files in LIBGNAT_TARGET_PAIRS are installed. See the
    rule for ../stamp-gnatlib1-$(RTSDIR). The Makefile has areas for setting
    some target specifics (lines 476 .. about 2333). I added an area for the
    AVR target. The AVR RTS is only a few files more than the Zero Footprint
    RTS. It's only about 20 files. Unfortunately I cannot specify
    ADA_INCLUDE_SRCS in the target specific area as it is overwritten
    further down in the Makefile again.

    Does anybody on this mailing list know how to build a Zero Footprint RTS
    using the standard gcc Makefile machinery?

    kind regards
    RE

     
  • Simon Wright

    Simon Wright - 2016-05-04

    My apologies for not noticing this sooner; I'd inadvertently suppressed e-mail notifications.

    The way I've built arm-eabi-gcc is to not include any RTS in the compiler build at all. The scripts I'm using are here (I really need to write a README), and the Ada compiler build script uses --disable-libada. Note also the actual make lines,

    make -w -j2
    make -w -C gcc cross-gnattools ada.all.cross
    

    In order for tools like gnatls, gprbuild to work you need to have something included with the compiler which they recognise as an RTS, even if it isn't usable, which is the reason for this dummy.

    The actual RTS gets built separately; see the Makefiles and build_runtime.gprs here. The ada_source_path file is because I've split the RTS files into common (in ../common) and target-specific (in adainclude) files. The runtime.xml file is automatically included in compilations invoked by gprbuild , so you don't need to include target-related compiler/linker/binder switches everywhere (e.g. -mcpu=cortex-m3).

     

    Last edit: Simon Wright 2016-05-04

Log in to post a comment.