This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
STARTFILE_SPEC and calling a function.
- From: Kalamatee <kalamatee at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 5 Jun 2018 19:39:46 +0100
- Subject: STARTFILE_SPEC and calling a function.
Hi All,
First of all let me explain our situation. On the m68k port of gcc,
libgcc_s.a is used to provide floating point math functions. We also have
software math functions in our crt (stdc.library), however they both use
their own idea of what state the softfloat support is in (e.g. currently
set exceptions).
We would therefore like to include an object file when those functions are
used in a binary, to setup the glue between gcc's softfloat support (by
installing a suitable trap handler), and the crt's math functions.
We could just add the file to the STARTFILE_SPEC, of course, however it
would always be used in binaries then even if they do not use floating
point math - which is undesirable.
While looking into this, ive noticed the STARTFILE_SPEC can call a function
and have it return an addition to the SPEC. This seems like it is the
obvious route to implementing what we need, but a few things still aren't
clear, and I was wondering if anyone has enough knowledge on the matter to
give me some feedback or put me on the correct path.
My Questions are -:
Is there any existing implementation that uses the ability of the
STARTFILE_SPEC to call a function?
How/where should this function be provided?
We would like to use something like AROS_STDC_crtobjects as the function
name, and have it check the symbols in the compiled file to see if any of
the float functions from our crt are used - and if so add the necessary
object file to the STARTFILE_SPEC for inclusion in the final binary - is
this possible?
We propose creating our object files (e.g. crt.fenv.o) aswell as a file
containing the symbols to match against (e.g. crt.fenv.lst), and using this
list in the called function to query the symbols. If there is any match -
include the object file.
Any help or information would be greatly appreciated,
Yours
Nick Andrews.