<TYPE HTML PUBLIC "-//W3C//DTD HTML//EN"> H . J . Lu - Re: A patch for default version and archive</TITL����/HEAD> <BODY> <!--X-Body-Begin--> <!--X-User-Header--> <!--htdig_noindex--> <p>This is the mail archive of the <tt>binutils����rces.redhat.com</tt> mailing list for the <a href="/binutils/">binutils project</a>. <!--/htdig_noindex--> <!--X-User-Head����nd--> <!--X-TopPNI--> <!--htdig_noindex--> <HR> <table border="0"> <tr><th align="left">Index Nav:</th> <td colspan=���� [<A HREF="index.html#00341">Date Index</A>] [<a href="subjects.html#00341">Subject Index</a>] [<a href="a����rs.html#00341">Author Index</a>] [<A HREF="threads.html#00341">Thread Index</A>] </td> </tr> <tr><th ali����left">Message Nav:</th> <td>[<A HREF="msg00340.html">Date Prev</A>] [<A HREF="msg00342.html">Date Next<����</td> <td>[<A HREF="msg00340.html">Thread Prev</A>] [<A HREF="msg00342.html">Thread Next</A>]</td> </<jĀ:</��ble> <!--/ht��������������������������������������������gBody--> <!--X-Subject-Header-Begin--> <h1>Re: A patch for defau����ersion and archive</h1> <!--X-Subject-Header-End--> <!--X-Head-of-Message--> <UL> <LI><em>To</em>: nickc at redhat dot com, ����tils at sourceware dot cygnus dot com,drepper at cygnus dot com</LI> <LI><em>Subject</em>: Re: A patch for default version a����rchive</LI> <LI><em>From</em>: "H . J . Lu" <hjl at valinux dot com></LI> <LI><em>Date</em>: Mon, 20 Nov 200����:39:10 -0800</LI> <LI><em>References</em>: <<A HREF="msg00196.html">20001114093316.A26311@valinux.com</A>> <<A HREF����g00199.html">20001114174950.11381.qmail@daffy.airs.com</A>> <<A HREF="msg00205.html">20001114102156.D26311@valinux.com����> <<A HREF="msg00214.html">20001114190853.12099.qmail@daffy.airs.com</A>> <<A HREF="msg00217.html">2000111411352����9733@valinux.com</A>> <<A HREF="msg00242.html">20001115180458.17974.qmail@daffy.airs.com</A>> <<A HREF="msg00245����l">20001115110936.A11306@valinux.com</A>> <<A HREF="msg00261.html">20001116182517.22930.qmail@daffy.airs.com</A>> &����A HREF="msg00320.html">20001118174929.A23180@valinux.com</A>> <<A HREF="msg00335.html">20001120183825.3839.qmail@daffy����s.com</A>></LI> </UL> <!--X-Head-of-Message-End--> <!--X-Head-Body-Sep-Begin--> <HR> <!--X-Head-Body-Sep-End--> <!--X-Bod����-Message--> <PRE> On Mon, Nov 20, 2000 at 10:38:25AM -0800, Ian Lance Taylor wrote: > > Then try > > # o����mp --dynamic-sym /usr/lib/lib*.so | grep GLIBC > # objdump --dynamic-sym /usr/X11R6/lib/lib*.so | grep GLIBC > >����, that's different. That is versioned symbols doing what they were > originally designed to do, namely refer to specific����sions in other > shared libraries. Those version numbers were inserted by the program > linker based on the version n����rs it found in shared libraries at > the time it did the link. They do not (necessarily) reflect any > occurrence of ����icit versioned references in object files. That is not true. I am enclosing a testcase here. # make cc -g -O -c -o main.����in.c cc -c -g -O -fPIC ref.c cc -c -g -O -fPIC foo1.c cc -shared -Wl,-soname,libfoo.so -o libfoo1.so foo1.o -Wl,--version-s����t,libfoo1.map cc -shared -o libref.so ref.o libfoo1.so rm -f libfoo.so ln -s libfoo1.so libfoo.so cc -o test1 main.o libref����-Wl,-rpath,. cc -g -O -c -o bar.o bar.c cc -shared -o libbar.so bar.o -Wl,--version-script,libbar.map rm -f libfoo.so ln ����ibfoo1.so libfoo.so cc -o test2 main.o libbar.so libref.so -Wl,-rpath,. cc -c -g -O -fPIC foo2.c cc -shared -Wl,-soname,libf����o -o libfoo2.so foo2.o -Wl,--version-script,libfoo2.map cc -g -O -c -o foo3.o foo3.c cc -shared -Wl,-soname,libfoo.so -����bfoo3.so foo3.o -Wl,--version-script,libfoo3.map cc -shared -Wl,-soname,libfoo.so -o libfoo4.so foo3.o libbar.so -Wl,--ver����-script,libfoo3.map rm -f libfoo.so ln -s libfoo1.so libfoo.so ./test1 foo: 1 rm -f libfoo.so ln -s libfoo2.so libfoo.so ./����1 foo: 1 rm -f libfoo.so ln -s libfoo3.so libfoo.so ./test1 ./test1: error while loading shared libraries: ./libref.so: symb����oo, version ver1 not defined in file libfoo.so with link time reference make: [all] Error 127 (ignored) rm -f libfoo.so ln -����bfoo4.so libfoo.so ./test1 ./test1: error while loading shared libraries: ./libref.so: symbol foo, version ver1 not defined ����ile libfoo.so with link time reference make: [all] Error 127 (ignored) ./test2 foo: 1000 # objdump --dynamic-sym libref.so |����p foo 00000000 DO *UND* 00000004 ver1 foo As you can tell from my testcase, the reference to "foo" in libref.����s versioned to "ver1". If you take out, the version "ver1" of "foo" in libfoo.so, you will get ./test1: error while loading����red libraries: ./libref.so: symbol foo, version ver1 not defined in file libfoo.so with link time reference Also, its refer���� can be overriden at the link time as you see in cc -o test2 main.o libbar.so libref.so -Wl,-rpath,. rm -f libfoo.so ln -s ����oo4.so libfoo.so ./test2 foo: 1000 where the definition of the version "ver1" of "foo" comes from libbar.so, not libfoo.so.����t; > The versioned reference is consistent with both shared and regular > objects. That is what I expected. We ���� versioned references in > shared library today. I don't believe there is anything seriously wrong > with versio����references in regular objects. > > Except for the behaviour of the default version, a version number is > for all ����tical purposes part of the symbol name. The behaviour of > the default version appears confusing when used with regular ����cts. I know it may be confusing at the first look. But it is not that confusing when you look a closer look. In short, ther���� no big difference between 00000000 DO *UND* 00000004 ver1 foo and 00000000 DO *UND* 00000004 (ver1)���� foo at the run-time. Both has to be bound to foo with version "ver1". > > What advantage do we get by permittin����rsioned references in regular > objects? Using an explicit version means that you don't want to use <A HREF="http://ft����linux.com/pub/support/hjl/glibc/compat/">http://ftp.valinux.com/pub/support/hjl/glibc/compat/</A> > the default symbol. ����why can't you just use a symbol name? For > example, anybody who wants to use an explicit version reference could > s����y define an alias for the symbol which defines the version. > Wouldn't that provide exactly the same functionality withou����e > confusion associated with default versions? > It doesn't work very well if we want to override the definition. ����tally agree that symbol versioning should be used with caution, in DSOs or regular objects. It may easily lead to problems. ���� H.J. Lu (hjl@valinux.com) </PRE> <P><A HREF="msg00341/bug.tar.gz" >bug.tar.gz</A></P> <!--X-Body-of-Message-End--> <!--X-����ody-End--> <!--X-Follow-Ups--> <HR> <UL><LI><STRONG>Follow-Ups</STRONG>: <UL> <LI><STRONG><A NAME="00342" HREF="msg00342.htm����e: A patch for default version and archive</A></STRONG> <UL><LI><EM>From:</EM> Ian Lance Taylor</LI></UL></LI> <LI><STRONG><����ME="00345" HREF="msg00345.html">Re: A patch for default version and archive</A></STRONG> <UL><LI><EM>From:</EM> Ulrich Drepp����LI></UL></LI> </UL></LI></UL> <!--X-Follow-Ups-End--> <!--X-References--> <UL><LI><STRONG>References</STRONG>: <UL> <LI><STR<jĀ:<A��AME="00196" �������������������������������������������� version and archive</A></STRONG> <UL><LI><EM>From:</EM> H . J .����/LI></UL></LI> <LI><STRONG><A NAME="00199" HREF="msg00199.html">Re: A patch for default version and archive</A></STRONG> <UL����><EM>From:</EM> Ian Lance Taylor</LI></UL></LI> <LI><STRONG><A NAME="00205" HREF="msg00205.html">Re: A patch for default ver���� and archive</A></STRONG> <UL><LI><EM>From:</EM> H . J . Lu</LI></UL></LI> <LI><STRONG><A NAME="00214" HREF="msg00214.html"><jĀ:A ��tch for defa��������������������������������������������><EM>From:</EM> Ian Lance Taylor</LI></UL></LI> <LI><STRONG><A N<jĀ:"0��17" HREF="ms�������������������������������������������� and archive</A></STRONG> <UL><LI><EM>From:</EM> H . J . Lu</LI><jĀ:><��I> <LI><STRO��������������������������������������������A patch for default version and archive</A></STRONG> <UL><LI><EM����m:</EM> Ian Lance Taylor</LI></UL></LI> <LI><STRONG><A NAME="00245" HREF="msg00245.html">Re: A patch for default version and����hive</A></STRONG> <UL><LI><EM>From:</EM> H . J . Lu</LI></UL></LI> <LI><STRONG><A NAME="00261" HREF="msg00261.html">Re: A pa����for default version and archive</A></STRONG> <UL><LI><EM>From:</EM> Ian Lance Taylor</LI></UL></LI> <LI><STRONG><A NAME="003����HREF="msg00320.html">Re: A patch for default version and archive</A></STRONG> <UL><LI><EM>From:</EM> H . J . Lu</LI></UL></L<jĀ:LI��STRONG><A NA��������������������������������������������for default version and archive</A></STRONG> <UL><LI><EM>From:</����Ian Lance Taylor</LI></UL></LI> </UL></LI></UL> <!--X-References-End--> <!--X-BotPNI--> <!--htdig_noindex--> <table border="���� <tr><th align="left">Index Nav:</th> <td colspan="2"> [<A HREF="index.html#00341">Date Index</A>] [<a h����"subjects.html#00341">Subject Index</a>] [<a href="authors.html#00341">Author Index</a>] [<A HREF="threads.html#00<jĀ:>T��ead Ind��������������������������������������������"left">Message Nav:</th> <td>[<A HREF="msg00340.html">Date����p;Prev</A>] [<A HREF="msg00342.html">Date Next</A>]</td> <td>[<A HREF="msg00340.html">Thread Prev</A>]&����;[<A HREF="msg00342.html">Thread Next</A>]</td> </tr> </table> <!--/htdig_noindex--> <!--X-BotPNI-End--> <!--X-User-����er--> <!--X-User-Footer-End--> </BODY> </HTML>