Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2006-03-20 03:56:55


Hi Mattias,

> A couple of questions:
>
> Is there any support for partial linking of library targets?
>
> Something along the lines of
> lib foo : bar.c baz.c : <link>partial ;
>
> A typical unix linker supports this by specifying "-r". Also, instead of
> the usual ".a" archive you end up with another relocatable object file,
> so the example above would generate foo.o, not foo.a.

How is this different from creating a shared library? I never used this "-r"
option, so just want to know.

> Combined with a linker script (passed through <linkflags>) this can be
> used to strip out unwanted symbols from a library that otherwise would
> be included, which can speed up linking of large projects. It also
> happens to be useful when the generated library is distributed to
> customers, where we don't want internal symbols exposed.

But you can use linker script with shared libraries just as well, no?

> How would I go about supporting c compilers that optimize across source
> files? These typically fall into two categories:
>
> Compilers that generate "fake" object files that contain an intermediate
> representation of the source file, and delay actual compilation until
> the link stage. One example is Intel's compiler (icc). Boost.Build
> supports this easily by passing the correct command line options to the
> compiler and linker, though it is quite easy to trip up by accidentally
> inserting these fake object files into library archives.

What would be the best solution in this case? Use some special tool for
creating archives that would convert fake objects into real ones, or just
not using archives at all?

> Compilers that require all source code files presented to the compiler
> at once. Two examples are gcc 4.1 (with the "-fwhole-program" option)
> and the RealView ARM compiler ("-O3" enables multifile compilation). I
> thought about creating empty object files and delaying the compilation
> to the link stage as with icc, but I can't quite figure out how to get
> all the source files to the link stage. Any (better) ideas on how to do
> this with Boost.Build?

So, the idea is that compiler should be given several source files at once,
plus an extra option, right? Well, I guess the right solution is this:

1. Add new feature <IPO>, or something like that.
2. Modify gcc.jam so that the linking-generator checks for <IPO>. If IPO is
on, the linking generator will grab all CPP sources and create a single
compile action with all CPP sources as inputs, unlike the standard behaviour
where one compile action is created for each CPP source.

If you're willing to dive a bit into Boost.Build, this should not be very hard
to do.

> PS: Boost.Build is a good deal better than any of the other alternatives
> I've experimented with, so keep up the good work! :-)

Thank you!

- Volodya

-- 
Vladimir Prus
http://vladimir_prus.blogspot.com
Boost.Build V2: http://boost.org/boost-build2

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