This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
how to redefine _start ?
- From: Yannick PERRET <yperret at bat710 dot univ-lyon1 dot fr>
- To: binutils at sources dot redhat dot com
- Date: Tue, 08 Jan 2002 18:47:53 +0100
- Subject: how to redefine _start ?
- Organization: UFR Info - Universite Claude Bernard Lyon1
Hi,
I'm working on a profiler based on the 'instrument-functions'
gcc feature (functioncheck on sourceforge).
For performance reasons, I want to make some inits
before any program execution (before main). In addition
I want to perform these inits before static constructors in
C++ program (which start before main).
I tried to give my own _start, _init and _fini functions by
removing the crt1 ones (-nostartlibs). The problem is
that I cannot figure what _start is supposed to do before
calling main() (return value, args...). The problem is the
same for _fini function.
I checked the gcc source, but crt1 seems to only be ASM
code.
Is it possible to write _start and stuff in C properly ?
If yes, where to find some documentation/exemples ?
If no, anybody got an idea to perform "before-main" treatments
(and of course "after-main") ?
Thank you for any help.
Regards
--
Yannick