[build2] [build2 0.7-a.0] How to use start-group / end-group in config.c.loptions
Boris Kolpackov
boris at codesynthesis.com
Tue Feb 27 07:50:00 UTC 2018
Mueller Tobias (DC-MH/EMF1) <tobias.mueller2 at boschrexroth.de> writes:
> The "link relative" step is done by build2 however the order of the objects
> and libraries seems to be different than expected for the second step if
> "-Wl,--start-group %OBJECTFILES% %LIBRARIES% -Wl,--end-group" would be used.
Firstly, according to my understanding or --start/end-group, there is
no need to include %OBJECTFILES% into the group (since they are linked
whole anyway). So the above can be reduced to:
%OBJECTFILES% -Wl,--start-group %LIBRARIES% -Wl,--end-group
Now how to handle libraries depends on whether you are building them
with build2 or not. If not (i.e., they are some external libraries),
then you should be able to do this in your buildfile:
cc.libs += -Wl,--start-group -lfoo -bar -Wl,--end-group
If you are building them with build2, then to do this cleanly would
require support in build2 (similar to how we do --whole-archive). As
a hack, though, this should probably work:
cc.loptions += -Wl,--start-group
cc.libs += -Wl,--end-group
Boris
More information about the users
mailing list