diff --git a/gcc-tools.jam b/gcc-tools.jam index 023cb77f3..1440ca1ea 100644 --- a/gcc-tools.jam +++ b/gcc-tools.jam @@ -346,10 +346,19 @@ rule Link-action SOTAG on $(<) = ; ACTION_1 on $(<) = ; } + + # On Win32, choose different image bases for load-time efficiency + if $(NT) { + DLL_LINK_FLAGS = "-Wl,--enable-auto-image-base " ; + } + else { + DLL_LINK_FLAGS = "" ; + } + # 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,--export-all-symbols -Wl,--exclude-symbols,_bss_end__:_bss_start__:_data_end__:_data_start__ -Wl,--out-implib," ; + IMPLIB_COMMAND on $(<) = "$(DLL_LINK_FLAGS)-Wl,--export-all-symbols -Wl,--exclude-symbols,_bss_end__:_bss_start__:_data_end__:_data_start__ -Wl,--out-implib," ; DEPENDS $(<) : $(NEEDLIBS) $(NEEDIMPS) ; gRUN_LD_LIBRARY_PATH($(<)) += $(STDLIBPATH:T) ; diff --git a/v1/gcc-tools.jam b/v1/gcc-tools.jam index 023cb77f3..1440ca1ea 100644 --- a/v1/gcc-tools.jam +++ b/v1/gcc-tools.jam @@ -346,10 +346,19 @@ rule Link-action SOTAG on $(<) = ; ACTION_1 on $(<) = ; } + + # On Win32, choose different image bases for load-time efficiency + if $(NT) { + DLL_LINK_FLAGS = "-Wl,--enable-auto-image-base " ; + } + else { + DLL_LINK_FLAGS = "" ; + } + # 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,--export-all-symbols -Wl,--exclude-symbols,_bss_end__:_bss_start__:_data_end__:_data_start__ -Wl,--out-implib," ; + IMPLIB_COMMAND on $(<) = "$(DLL_LINK_FLAGS)-Wl,--export-all-symbols -Wl,--exclude-symbols,_bss_end__:_bss_start__:_data_end__:_data_start__ -Wl,--out-implib," ; DEPENDS $(<) : $(NEEDLIBS) $(NEEDIMPS) ; gRUN_LD_LIBRARY_PATH($(<)) += $(STDLIBPATH:T) ;