« Return to Thread: [Boost][build] Bjam ordering source $(>) list

Re: [Boost][build] Bjam ordering source $(>) list

by Juergen Hunold-2 :: Rate this Message:

Reply to Author | View in Thread

Hi !

On Friday 26 June 2009 01:13:26 K. Noel Belcourt wrote:
> All these sources (and the sources in these dependencies) get lumped  
> into the $(>) variable that is passed into the link action.

Yes, that is what I found out, too.

> I guess what I'm wondering is why are all the exe (and dependent)  
> sources (object and libraries) lumped into $(>)?  Perhaps the follow-
> on question is: given that the objects and libraries in the exe rule  
> sources are all in $(>), can we apply a stable sort to $(>) so that  
> the objects precede the libraries while retaining the original  
> relative ordering.  This will help us on systems where we don't have  
> a multi-pass linker nor options like start / end group.
>
> Does that make any sense?

At least for me, yes.

I've encountered a similar problem while implementing response file support
for gcc on windows. I ended up extrating the libs from $(>) and passing them
to the build rule. Unfortunately, I have historical circular dependencies.
I attach the relevant part of my gcc.jam patch for completeness.

I would like to know more about building the sources of $(>), too.


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@...        ! www.ivembh.de
*
* Geschäftsführer:                ! Sitz des Unternehmens: Hannover
* Prof. Dr.-Ing. Thomas Siefer    ! Amtsgericht Hannover, HRB 56965
* PD Dr.-Ing. Alfons Radtke       !

[short.diff]

Index: tools/build/v2/tools/gcc.jam
===================================================================
--- tools/build/v2/tools/gcc.jam (revision 54371)
+++ tools/build/v2/tools/gcc.jam (working copy)
@@ -789,12 +790,17 @@
     # parallel is just slower. For now, serialize only gcc links, it might be a
     # good idea to serialize all links.
     JAM_SEMAPHORE on $(targets) = <s>gcc-link-semaphore ;
+
+    LIBS = [ MATCH "<p(.*\\.lib)" : $(sources) ] ;
+    EXTRA_LIBS on $(targets) = [ regex.replace-list $(LIBS) : ">" : "\\" ] ;
 }
 
 actions link bind LIBRARIES
 {
-    "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,$(RPATH_OPTION:E=-R)$(SPACE)-Wl,"$(RPATH)" -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" -o "$(<)" $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS)
-
+    "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,$(RPATH_OPTION:E=-R)$(SPACE)-Wl,"$(RPATH)" -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" -o "$(<)" @($(<[1]:T).link:E=INPUT( $(>) );) $(START-GROUP) "$(EXTRA_LIBS)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS)
 }
 
 # Default value. Mostly for the sake of intel-linux that inherits from gcc, but
@@ -841,7 +847,7 @@
 # That warning is produced only on some platforms, for whatever reasons.
 actions piecemeal archive
 {
-    "$(.AR)" $(AROPTIONS) rc "$(<)" "$(>)"
+    "$(.AR)" $(AROPTIONS) rc "$(<)" "@"@($(<[1]:T).rsp:E=$(>:T))
 }
 
 
@@ -856,7 +866,7 @@
 # Differs from 'link' above only by -shared.
 actions link.dll bind LIBRARIES
 {
-    "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,$(RPATH_OPTION:E=-R)$(SPACE)-Wl,"$(RPATH)" "$(.IMPLIB-COMMAND)$(<[1])" -o "$(<[-1])" $(HAVE_SONAME)-Wl,$(SONAME_OPTION)$(SPACE)-Wl,$(<[-1]:D=) -shared $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS)
+    "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,$(RPATH_OPTION:E=-R)$(SPACE)-Wl,"$(RPATH)" "$(.IMPLIB-COMMAND)$(<[1])" -o "$(<[-1])" $(HAVE_SONAME)-Wl,$(SONAME_OPTION)$(SPACE)-Wl,$(<[-1]:D=) -shared @($(<[1]:T).link:E=INPUT( $(>) );) $(START-GROUP) "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS)
 }
 
 rule setup-threading ( targets * : sources * : properties * )


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

 « Return to Thread: [Boost][build] Bjam ordering source $(>) list