Boost logo

Boost-Build :

From: Raoul Gough (raoulgough_at_[hidden])
Date: 2003-01-21 18:16:16


When building a .dll on windows using gcc, we should be supplying
the --enable-auto-image-base flag to the linker. Without this flag,
all the dll's end up with the same load address (0x10000000) which can
degrade program load performance (basically, if an executable requires
multiple DLLs that have the same load address, the linker/loaded has
to relocate all but one of them on startup and perform fixups). You
can verify this with:

objdump -p my.dll [...] | grep ImageBase

Currently, all boost DLLs end up at 0x10000000. It doesn't really cost
anything to supply this flag - the linker chooses a load address on
the basis of some kind of hash function which makes relocations at
startup far less likely.

The change is easy for mingw-tools.jam (just add the option to
IMPLIB_COMMAND), but I'm not sure about gcc-tools.jam, since I don't
know if the option is available on platforms other than Win32.

Regards,
Raoul Gough.

------ Patch for mingw-tools 1.9 -------
$ diff -cp mingw-tools_1_9.jam mingw-tools.jam
*** mingw-tools_1_9.jam Tue Jan 21 23:08:04 2003
--- mingw-tools.jam Tue Jan 21 23:07:45 2003
*************** rule Link-action
*** 36,42 ****
# This will appear before the import library name when building
a DLL, but
# will be "multiplied away" otherwise. The --exclude-symbols
directive
# proved to be neccessary with some versions of Cygwin.
! IMPLIB_COMMAND on $(<) =
"-Wl,--exclude-symbols,_bss_end__:_bss_start__:_data_end__:_data_start
__ -Wl,--out-implib," ;
mingw-Link-action $(<) : $(>) ;
# Workaround GCC's lack of command-files and NT's line-length
limitation.
if $(NT) {
--- 36,42 ----
# This will appear before the import library name when building
a DLL, but
# will be "multiplied away" otherwise. The --exclude-symbols
directive
# proved to be neccessary with some versions of Cygwin.
! IMPLIB_COMMAND on $(<) =
"-Wl,--exclude-symbols,_bss_end__:_bss_start__:_data_end__:_data_start
__ -Wl,--enable-auto-image-base -Wl,--out-implib," ;
mingw-Link-action $(<) : $(>) ;
# Workaround GCC's lack of command-files and NT's line-length
limitation.
if $(NT) {

 


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk