I am linking a number of executables against a shared library that I've
built, and some the executables contain code that collides with symbols
defined in the shared library for both function names and some static data
in the shared obj.  I have a few questions about how to control the linkage
here.

Initially I was having all kinds of namespace collisions between .  By
using a version script like

    youch.so.0.0 {
        global:
            entry1;
            entry2;
            entry3;
            entry4;
        local:
            *;
    };

I was able to avoid the function cross-linkage (I think).  However, it
appears  that I am still having cross-linkage problems with some static
data in my shared object, where the code from the executable seems to be
accessing static data that should be for the shared object (or vice
versa).  Stripping the shared object before linking against it doesn't seem
to help.


Questions:
     - Is linking the shared object specifing the --version-script the
proper way to hide the symbols that I don't want to export?  That's what
the ld info seemed to be saying, but it was a bit confusing.
     - Should the version script above hide my data as well as the
functions, i.e., is this apparent cross-linkage on static data the
expected behavior in this case?
     - Is there a way to make the link happen the way I want it, i.e.
references  to global data in the code in the shared object and in the
objects statically linked into the executable are resolved to the symbols
in their respective data segments?


Any help with these questions would be appeciated, as would any pointers to
further documentation.

Thanks

Matt La Mantia



$ cat /proc/version
Linux version 2.0.34 ([EMAIL PROTECTED]) (gcc version 2.7.2.3) #1 Fri May 8
16:05:57 EDT 1998

$ gcc -v
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.60/specs
gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)

Reply via email to