Hi !


I've stumpled across a trick used by Qt's qmake to reduce the size of library and executables. Qt's configure --help calls this
"-separate-debug-info .... Strip debug information into a separate .debug file."


This will (theoretically) lead to faster startup times, especially when using release builds with debug-symbols enabled (my default).
The basic trick is to use "objcopy" from GNU bintutils to separate the debug information and create a hint for the debugger where to look for them in case of emergency :-))


Short description:
1. Copy only debug symbols to <file>.debug
2. Strip only debug symbols from <file>
3. Add debug link to <file>.debug to <file>
4. Cleanup (make <file>.debug non-executable


I've attached a brute-force, hardcoded implementation of this algorithm.
It uses a new toolset feature <objcopy> to specify which objcopy shall be used (needed for cross-compilation).


This proof of concept works (for me), but now comes the hard part:
I've got no idea how to _really_ incorporate this into the current gcc toolchain. The way would be:
- introduce a new feature "separate-debug-info : off on ;"
- if this feature is "on", add a post link step which will execute steps 1-4 above.
- introduce a new feature "install-separate-debug-info" to the "install" rule (needed if you want to have everything ready for packaging etc.).


Ideas on how to implement this are welcome.


Yours,


Jürgen


--
* Dipl.-Math. Jürgen Hunold ! Ingenieurgesellschaft für
* voice: ++49 511 262926 57 ! Verkehrs- und Eisenbahnwesen mbH
* fax : ++49 511 262926 99 ! Lister Straße 15
* juergen.hunold@ivembh.de ! www.ivembh.de
*
* Geschäftsführer: ! Sitz des Unternehmens: Hannover
* Prof. Dr.-Ing. Thomas Siefer ! Amtsgericht Hannover, HRB 56965
* PD Dr.-Ing. Alfons Radtke !