[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Adding '-nostartfiles' at link stage

From: Yannick Perret
Subject: Adding '-nostartfiles' at link stage
Date: Fri, 26 Apr 2002 10:12:24 +0200


I'm working on a profiler (fnccheck on sourceforge) and I have a

I build a library to be linked with the profiled programs, and this
library furnish a symbol called '_init'. This symbol is called
BEFORE any program execution, allowing me to perform
initializations (and the default _init is weak, so my own replaces
the default one).

My problem is to tell automake/autoconf and more precisly libtool
to link the library without giving this symbol...

When doing this "by the hand", you just have to use 'ld' to link,
and all is right (I'm under Linux Debian/gcc2.95+).
It was not possible to explain clearly to libtool to use 'ld' instead
of 'gcc' for link stage.

The other way is to use 'gcc', with option '-nostartfiles' to prevent it

to add the default '_init' symbol. The problem was that options
was discarded by libtool when linking.

The only (ugly) way I found was to do this:
/bin/sh ../libtool --mode=link "gcc -nostartfiles" ...
to force libtool to include the '-nostartfiles' option.

But recently, libtool seams to have been updated and it do not look
at all at the "gcc -nostartfiles" (I can put whatever I want here,
it is 'gcc' which is used in practice).

How to deal with that ?
As my 'hack' was not very nice, I'm looking for a proper way to
control the way linking stage is performed...

Thank you for any help.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]