[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 11:07:10 +0930 |
User-agent: |
Mutt/1.4i |
On Tue, Apr 06, 2004 at 03:41:52PM -0400, Ian Lance Taylor wrote:
> Rafal Dabrowa <address@hidden> writes:
> > void fun1() { ... }
> > void fun2() { fun1(); ... }
> >
> > Function fun2 invokes fun1. I want up to fun2 would always invoke fun1 from
> > my
> > library. It is surprising for me, that if I create fun1 in main program,
> > then
> > fun2 invokes fun1 from main program instead of library. From this reason I
> > have added -Bsymbolic option.
>
> If you want to guarantee that fun2 calls fun1, and you also want to
> make it possible for programs linked against the shared library to
> call fun1 in the shared library, then there is no simple way to do
> this.
If fun1 is made protected, then the library will behave as Rafal
desires. See gcc's info on function attributes.
void __attribute__ ((visibility ("protected")))
fun1 () { ... }
I've thought before that a useful extension to our ld version scripts
would be to have a "protected" keyword in addition to "global" and
"local".
--
Alan Modra
IBM OzLabs - Linux Technology Centre
- two instances of global from shared lib linked with -Bsymbolic, Rafal Dabrowa, 2004/04/06
- Re: two instances of global from shared lib linked with -Bsymbolic, Ian Lance Taylor, 2004/04/06
- Re: two instances of global from shared lib linked with -Bsymbolic, Rafal Dabrowa, 2004/04/06
- Re: two instances of global from shared lib linked with -Bsymbolic, Ian Lance Taylor, 2004/04/06
- Re: two instances of global from shared lib linked with -Bsymbolic, Rafal Dabrowa, 2004/04/06
- Re: two instances of global from shared lib linked with -Bsymbolic, Ian Lance Taylor, 2004/04/06
- Re: two instances of global from shared lib linked with -Bsymbolic,
Alan Modra <=
- Re: two instances of global from shared lib linked with -Bsymbolic, Ian Lance Taylor, 2004/04/06
- Re: two instances of global from shared lib linked with -Bsymbolic, Alan Modra, 2004/04/06
- Re: two instances of global from shared lib linked with -Bsymbolic, Rafal Dabrowa, 2004/04/07
- Re: two instances of global from shared lib linked with -Bsymbolic, Alan Modra, 2004/04/07
- Re: two instances of global from shared lib linked with -Bsymbolic, Ian Lance Taylor, 2004/04/07
- Re: two instances of global from shared lib linked with -Bsymbolic, Rafal Dabrowa, 2004/04/08
- Re: two instances of global from shared lib linked with -Bsymbolic, Ian Lance Taylor, 2004/04/08