This is the mail archive of the automake@gnu.org mailing list for the automake project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Partially Linked Objects


In message <Pine.SGI.4.03.9905101250030.1503-100000@uscream.vss.fsi.com>, Brian
 Ford writes:
>On 10 May 1999, Olly Betts wrote:
>> I'm trying to use automake to build a partially linked object (ld -r on all
>> the Unix platforms I need to support).  [snip]
>> 
>> Is there a way of doing this?  In reality there are a couple of hundred
>> sources, so I'm trying to avoid having to maintain a list of the sources and
>> the objects separately.  Any suggestions greatly appreciated.
>>
>Two suggestions.  Use libtool convienence libraries

There's a problem with using a library (which is why we currently use
partial linking) because many of these objects are almost unreferenced.  The
only references are via a master table of function pointers, and a static
C++ object in each file has a constrcutor which fills in the relevant
entries in the table.  Unfortunately if you put these objects in a library,
the linker thinks it knows best and throws most of them away.

I could probably adapt the hack we use under NT (apparently MSVC doesn't
support partial linking) which is to add dummy functions to each file and
reference them elsewhere.  I'm hoping to avoid this though, since in the
longer term I'm hoping to move the NT build from MSVC to mingw32 (which I
believe does support partial linking).

Another minor issue is that the library is much larger than the partially
linked object (nearly twice the size if memory serves).

>, or do something like
>this:
>
>noinst_PROGRAMS = partial.o
>partial_o_LDFLAGS = $(LDFLAGS) -r
>partial_o_SOURCES = partial1.c partial2.c

Aha, cunning - it hadn't occured to me that I could supply the "-r" using
LDFLAGS.  I've just tried this approach and it seems to work perfectly -
many thanks.

Cheers,
Olly


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]