[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: two instances of global from shared lib linked with -Bsymbolic

From: Alan Modra
Subject: Re: two instances of global from shared lib linked with -Bsymbolic
Date: Wed, 7 Apr 2004 21:57:01 +0930
User-agent: Mutt/1.4i

On Wed, Apr 07, 2004 at 01:05:05PM +0200, Rafal Dabrowa wrote:
> OK, this attribute works for variables too. But, is it possible to:
> 1. have the attribute set by default for functions (e.g. by use a 
> compiler/linker option)

There isn't such an option currently (at least not that I'm aware of).
It would be possible to automate the process using current tools.  You
could extract the names of all function symbols from your object files
(nm -f sysv or objdump -t), then create an assembly file consisting of
 .protected sym1
 .protected sym2
Compiling this file and linking with your other objects will result in
all the mentioned symbols being protected.

> 2. behave more smart with global variables: if the variable is defined in 
> main 
> program also, then two separate instances are created. If the variable is not 
> defined in main program (but declared only as "extern"), then only one 
> variable instance appears. This should work like function symbols resolution: 
> if a function is defined both in library and in main program, then both use 
> own function instance. If main program doesn't have own function defined, 
> then it uses function from library.
> I am compiling a code which is primarily developed under AIX system. AIX 
> behaves in this way, and I went into trouble. Is complicated to add such 
> possibility in ld program ?

I suggest you write a small testcase to see what happens with current
tools, ie. ld and ld.so from glibc.  It might be that it all works
correctly at the moment.

Alan Modra
IBM OzLabs - Linux Technology Centre

reply via email to

[Prev in Thread] Current Thread [Next in Thread]