Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.development.apps > #272

Forcing loading of an object file from a library

From Josef Moellers <josef.moellers@ts.fujitsu.com>
Newsgroups comp.os.linux.development.apps
Subject Forcing loading of an object file from a library
Date 2011-10-07 14:01 +0200
Organization Fujitsu Technology Solutions
Message-ID <j6mpmb$hfk$1@nntp.ts.fujitsu.com> (permalink)

Show all headers | View raw


Hi,

I'm in the progress of developing a pretty large suite of test-software.

The center of this is a base program D which explicitly loads shared
object modules E.so on-demand using dlopen().
Next to this driver program D, there are several utilities C that do not
load shared objects.
All of these share common auxiliary code A, to a varying degree.

I therefore have
* the main code for the driver program D and the utilities C,
* the code for the shared object modules E.so,
* auxiliary code A used by the driver program, the shared object
modules, and/or the utilities, this code is put into a library B.

I now face the following problem:

The driver program does *not*, by itself, use certain auxiliary code A
and therefore this code is not automatically included in the driver
binary D.
However, the shared object modules E.so may require some of this
auxiliary code.
Since the driver binary does not have the auxiliary code, the shared
object modules fail to load because the references to the auxiliary code
cannot be resolved.

How can I force the driver binary D to include the auxiliary code A.o
without D requiring this by itself but only on behalf of the shared
object modules?

I'd rather not statically link A.o into E.so because there are quite a
number of A.o's and E.so's which could be loaded by D and I'd like to
keep the E.so's small: having one copy of A() in D could be used by all
E.so's.
Also, keeping all the A.o's in the library B.a allows the linker to pick
whichever A.o they require for each utilities C.

At present, I explicitly link A.o into D, but that is cumbersome because
I need to manually keep track of the dependencies and I have bought a
computer to do just that for me ;-)

Is there a directive that will force A() to be undefined in D so it gets
statically linked?

Josef
-- 
These are my personal views and not those of Fujitsu Technology Solutions!
Josef Möllers (Pinguinpfleger bei FTS)
	If failure had no penalty success would not be a prize (T.  Pratchett)
Company Details: http://de.ts.fujitsu.com/imprint.html

Back to comp.os.linux.development.apps | Previous | NextNext in thread | Find similar


Thread

Forcing loading of an object file from a library Josef Moellers <josef.moellers@ts.fujitsu.com> - 2011-10-07 14:01 +0200
  Re: Forcing loading of an object file from a library Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2011-10-07 17:28 +0300
  Re: Forcing loading of an object file from a library "Ersek, Laszlo" <lacos@caesar.elte.hu> - 2011-10-07 23:23 +0200
  Re: Forcing loading of an object file from a library Josef Moellers <josef.moellers@ts.fujitsu.com> - 2011-10-11 10:46 +0200

csiph-web