This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: A patch for default version and archive


On Mon, Nov 20, 2000 at 12:43:06PM -0800, Ian Lance Taylor wrote:
>    Date: Mon, 20 Nov 2000 12:39:10 -0800
>    From: "H . J . Lu" <hjl@valinux.com>
> 
>    On Mon, Nov 20, 2000 at 10:38:25AM -0800, Ian Lance Taylor wrote:
>    > 
>    >    Then try
>    > 
>    >    # objdump --dynamic-sym /usr/lib/lib*.so | grep GLIBC
>    >    # objdump --dynamic-sym /usr/X11R6/lib/lib*.so | grep GLIBC
>    > 
>    > No, that's different.  That is versioned symbols doing what they were
>    > originally designed to do, namely refer to specific versions in other
>    > shared libraries.  Those version numbers were inserted by the program
>    > linker based on the version numbers it found in shared libraries at
>    > the time it did the link.  They do not (necessarily) reflect any
>    > occurrence of explicit versioned references in object files.
> 
>    That is not true.
> 
> I'm sorry, I don't understand.  Which statement that I made is not
> true?
> 

I take that back. Let me rephrase what I'd like to point out:

1. There are versioned references in DSOs.
2. Versioned references in DSOs can be written as versioned references
in object files used to build DSOs instead of linking against the
DSO where there are default versioned defitions for symbols referenced.
3. The locations of the versioned symbols are recorded at the final
link time for executables. Those in DSOs don't really matter.
4. Even (3) can be changed with LD_PRELOAD. For my last testcase,

# ./test1 
./test1: error while loading shared libraries: ./libref.so: symbol foo, version ver1 not defined in file libfoo.so with link time reference
# ldd ./test1
        libref.so => ./libref.so (0x40019000)
        libc.so.6 => /lib/libc.so.6 (0x40026000)
        libfoo.so => ./libfoo.so (0x40157000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
        libbar.so => ./libbar.so (0x4015a000)
# LD_PRELOAD=./libbar.so ./test1
foo: 1000


-- 
H.J. Lu (hjl@valinux.com)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]