This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

how to redefine _start ?


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]