There are even patches on gentoo-dev to add this support, although you can still use $LDFLAGS and $ASFLAGS without this patch, just by setting them in /etc/make.conf.
http://marc.theaimsgroup.com/?l=gentoo- ... 425320&w=2
$ASFLAGS is not particularly useful, it will probably be supported only for completeness. $LDFLAGS, however, could be useful and I have been experimenting recently to see what exactly can be done with them.
First of all, you can benchmark dynamic linking using the $LD_DEBUG variable, for example:
Code: Select all
taviso@insomniac:~$ LD_DEBUG=statistics sh -c true
12937:
12937: runtime linker statistics:
12937: total startup time in dynamic loader: 1108348 clock cycles
12937: time needed for relocation: 572272 clock cycles (51.6%)
12937: number of relocations: 132
12937: number of relocations from cache: 5
12937: time needed to load objects: 335136 clock cycles (30.2%)
12937:
12937: runtime linker statistics:
12937: final number of relocations: 204
12937: final number of relocations from cache: 5These are some of the ld options that look interesting:
- -O level
If level is a numeric values greater than zero ld optimizes the output. - --sort-common
This is to prevent gaps between symbols due to alignment constraints, presumably increasing efficiency layout. - --no-keep-memory
This option tells ld to optimize for memory usage rather than speed, by rereading the symbol tables as necessary instead of caching it in memory. - -z now
Lazy binding is really clever, rather than loading all shared code into memory at runtime, the dynamic loader locates them, and just keeps track of it, when a reference is made to the shared code, then it is loaded memory. This saves some memory, and speeds up startup. Using -z now disables lazy binding, which means slower startup, possibly more memory usage, but better runtime performance.
You can test how this will effect a particular application by setting $LD_BIND_NOW, and testing responsiveness or timing some task, for example:Code: Select all
taviso@insomniac:~$ LD_BIND_NOW=1 mozilla
Code: Select all
LDFLAGS="-Wl,-O1 -Wl,--sort-common -s"- ld(1) manpage
- ld.so(8 ) manpage
- http://www.caldera.com/developers/gabi/ ... namic.html
latest ELF draft, Dynamic linking section - http://sources.redhat.com/binutils/docs ... ml#Scripts
linker scripts description - proc(5) manpage







