Jeremy White wrote:
[snip]
> 3.   Intercept ctors processing
>       In this  case, best demostrated by Berthos, I believe, you
>       intercept the ctors process of your target library (say, MFC).
>       You stash a pointer to the ctors chain somewhere, and
>       then force the glibc processing code to return immediately.
>       Later, during 'normal' library initialization (invoked
>       after main()), you walk the rest of the ctors chain.
> 
>       This option would be more appealing to me if there was a
>       formal way to accomplish this with linker scripts, rather than
>       with a hack.

You can only do this trick with linker-scripts if it is possible to
direct the compiler to emit {con,de}structor code into another section
than .init and .fini. Otherwise, you would have no real "clean" way of
doing it (oh well, hacking .init and .fini is never clean). However, a
relatively harmless hack is to use an intermediate link-stage, where you
incrementally link the entire source, then rename the .init and .fini
section (with objcopy), and then link it with an extra object (that
contains the redirector code) and a special linker-script.

Greetings Bertho

Reply via email to