Exporting symbols in a dynamic library

Exporting symbols in a dynamic library

Post by fuh » Mon, 18 Nov 2002 23:16:27



I have made a dynamic library, but I'd only like a certain 4 functions to be
fetched with dlsym() and everything else to remain private.

So far the only way I've thought of doing this is to use the 'strip' command
with the -K flag.

Is there a better way?

 
 
 

Exporting symbols in a dynamic library

Post by John Reise » Tue, 19 Nov 2002 03:14:41


 > I have made a dynamic library, but I'd only like a certain 4 functions to be
 > fetched with dlsym() and everything else to remain private.

Use a linker script to control symbol visibility.  "info ld" topic "Scripts",
"VERSION" command.

 
 
 

Exporting symbols in a dynamic library

Post by @ple...@no.spa » Tue, 19 Nov 2002 09:46:43



>  > I have made a dynamic library, but I'd only like a certain 4
> functions to be
>  > fetched with dlsym() and everything else to remain private.

> Use a linker script to control symbol visibility.  "info ld" topic
> "Scripts",
> "VERSION" command.

Meta-question: when I type "info ld" on my system (Debian 3.0) I get
basically the same text as the man page, no nodes/topics/navigability
and in particular no data on version scripts. It even says

        Info: (*manpages*)ld, 1603 lines

in the bottom line. Am I missing something or is there an additional
package to install or what?

DD

 
 
 

Exporting symbols in a dynamic library

Post by John Reise » Tue, 19 Nov 2002 10:52:43


 >> Use a linker script to control symbol visibility.  "info ld" topic
 >> "Scripts",
 >> "VERSION" command.
 >
 >
 > Meta-question: when I type "info ld" on my system (Debian 3.0) I get
 > basically the same text as the man page, no nodes/topics/navigability
 > and in particular no data on version scripts.

You are missing the good stuff.

http://sources.redhat.com/binutils/docs-2.12/ld.info/index.html

 
 
 

Exporting symbols in a dynamic library

Post by John Hasle » Tue, 19 Nov 2002 11:10:48



Quote:> Meta-question: when I type "info ld" on my system (Debian 3.0) I get
> basically the same text as the man page, no nodes/topics/navigability
> and in particular no data on version scripts.

apt-get install binutils-doc
--
John Hasler

Dancing Horse Hill
Elmwood, WI
 
 
 

Exporting symbols in a dynamic library

Post by fuh » Wed, 20 Nov 2002 01:30:08


well considering there's only 4 out of may functions/variable that I want
exported, is

     VERS_1.1 {
         global:
                 symb1;
                symb2;
                symb3;
                symb4;
         local:
                *
     };

the way to go?


Quote:> > I have made a dynamic library, but I'd only like a certain 4 functions
to be
>  > fetched with dlsym() and everything else to remain private.

> Use a linker script to control symbol visibility.  "info ld" topic
"Scripts",
> "VERSION" command.

 
 
 

Exporting symbols in a dynamic library

Post by fuh » Wed, 20 Nov 2002 01:46:45


--retain-symbols-file also seems like a useful option to ld.


> well considering there's only 4 out of may functions/variable that I want
> exported, is

>      VERS_1.1 {
>          global:
>                  symb1;
>                 symb2;
>                 symb3;
>                 symb4;
>          local:
>                 *
>      };

> the way to go?



> > > I have made a dynamic library, but I'd only like a certain 4 functions
> to be
> >  > fetched with dlsym() and everything else to remain private.

> > Use a linker script to control symbol visibility.  "info ld" topic
> "Scripts",
> > "VERSION" command.

 
 
 

Exporting symbols in a dynamic library

Post by John Reise » Wed, 20 Nov 2002 01:59:45



 >
 >>Meta-question: when I type "info ld" on my system (Debian 3.0) I get
 >>basically the same text as the man page, no nodes/topics/navigability
 >>and in particular no data on version scripts.
 >
 >
 > apt-get install binutils-doc

Perhaps Debian's legendary lag will not reveal the important addition of
anonymous versions that was announced less than one year ago:
http://sources.redhat.com/ml/binutils-cvs/2001-12/msg00101.html
and is in binutils 2.12 and documented in the reference that I gave.  Of course
if the Debian 3.0 docs are consistent with its installed software, then the
OP might have to install other software in order to _use_ anonymous versions.

 
 
 

Exporting symbols in a dynamic library

Post by Roger Leig » Wed, 20 Nov 2002 05:39:01





>  >>Meta-question: when I type "info ld" on my system (Debian 3.0) I get
>  >>basically the same text as the man page, no nodes/topics/navigability
>  >>and in particular no data on version scripts.

>  > apt-get install binutils-doc

> Perhaps Debian's legendary lag will not reveal the important addition of
> anonymous versions that was announced less than one year ago:
> http://sources.redhat.com/ml/binutils-cvs/2001-12/msg00101.html
> and is in binutils 2.12 and documented in the reference that I gave.

$ dpkg -s binutils | grep Version
Version: 2.12.90.0.1-4

(3.0r0 - woody)

--
Roger Leigh
                "Liberty and Livelihood" - Support the Countryside Alliance
                Printing on GNU/Linux?  http://gimp-print.sourceforge.net/
                GPG Public Key: 0x25BFB848 available on public keyservers