🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #3620

Force linking of .a?

#3620
From: Paul D. Smith
Date: Mon, 10 May 1999 00:00
39 lines
2701 bytes
I have an app that links a lot of libraries.  We use archives because
we can insert/remove elements during the build; some of them have 700 or
more elements so it can be a considerable time savings over
deleting/rebuilding the archive from scratch.

Until now this hasn't been an issue, but now we're trying to introduce
some dynamic loading using dlopen(), etc.  Yes, we do need to do it this
way :).

The problem is that some of the .so's need some particular functions,
but nothing in the core binary needs those functions.  Since they're in
archives but nothing references them during the link, they're not pulled
into the core.  Since they're needed by more than one dynamic object
(.so), we can't just put them in one.

I've seen that I can add -uSYMBOL to the link line and that works for a
given .o, but it's gross since there will undoubtedly be many more cases
of this in the future.  Similarly, I'd like to avoid dummy function
calls, etc.

What we'd like to do is find some kind of linker flag (or other method)
that forces the entire contents of particular .a's to be linked, even if
nothing appears to reference any of the symbols in some of the .o's in
the archive.

I tried the docs for ld(1) but didn't see anything; surely this isn't
such an unusual requirement?  Anyone have any ideas?

We're using the Cygnus GCC compiler kit on Solaris 2.5.1 right now, but
I was hoping for something at least moderately portable...

Thanks!

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <psmith@baynetworks.com>         Network Management Development
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
   These are my opinions---Nortel Networks takes no responsibility for them.
Technical Details
Message-ID: <p5ogjs8dgz.fsf@baynetworks.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,9f41c0c55a58cbbd,start
X-Google-Attributes: gid11318c,public
X-Google-Thread: fc89c,9f41c0c55a58cbbd,start
X-Google-Attributes: gidfc89c,public
X-Google-Thread: 11035d,9f41c0c55a58cbbd,start
X-Google-Attributes: gid11035d,public
From: psmith@baynetworks.com (Paul D. Smith)
Subject: Force linking of .a?
Date: 1999/05/10
Message-ID: <p5ogjs8dgz.fsf@baynetworks.com>
X-Deja-AN: 476443497
X-Complaints-To: usenet@spinner.corpeast.baynetworks.com
X-Trace: spinner.corpeast.baynetworks.com 926395085 11378 192.32.138.39 (11 May 1999 03:58:05 GMT)
Organization: Bay Networks, Inc. / Billerica, MA
Reply-To: psmith@baynetworks.com
NNTP-Posting-Date: 11 May 1999 03:58:05 GMT
Newsgroups: comp.unix.programmer,comp.unix.solaris,gnu.gcc.help