From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Youngdale" To: hjl@nynexst.com (H.J. Lu) Cc: bonn@eskimo.com (David Bonn), kjahds@kjahds.com (Kenneth Albanowski), lmfken@lmf.ericsson.se (Kenneth Osterberg), ian@lasermoon.co.uk, mat@ardi.com (Mat Hostetter), ecn@clark.net (Eric C. Newton), doughera@lafcol.lafayette.edu (Andy Dougherty), brian@mathworks.com (Brian Bourgault), jchristy@bga.com (John W. Christy), craig@metrolink.com (Craig Groeschel), imp@village.org (Warner Losh), robf@www.willows.com (Rob Farnum), Huw.Rogers@ska.com (Huw Rogers), meissner@cygnus.com (Michael Meissner), linux-gcc@vger.rutgers.edu (linuxgcc), gas2@cygnus.com, raeburn@cygnus.com (Ken Raeburn), ian@cygnus.com (Ian Lance Taylor) Subject: Re: DT_SYMBOLIC and -Bsymbolic Date: Tue, 20 Jun 1995 11:55:00 -0000 Message-id: <9506201454.ZM27215@aib.com> References: <9506200047.AA09538@titanic.nynexst.com> X-SW-Source: 1995/msg00120.html OK, I think the enclosed patch is more along the lines of what is required. The general idea is that we bypass the PLT when -Bsymbolic is in effect, and in addition the GOT slots have a different type of relocation (R_*_RELATIVE instead of R_*_GLOB_DAT). I updated both the Sparc and i386 backends (others would be easy, if other backends supported shared libs). From what I can tell the advantages of using this are that you get slightly better performance at runtime since you do not go through the PLT for every function call. In addition, there is less startup overhead since there are no PLT slots to be initialized. The GOT slots still exist, but the R_*_RELOCATION relocations do not have a symbol, so you do not have to search any of the symbol tables to perform these relocations, and there would be yet another very slight performance increase. The Solaris linker does put a DT_SYMBOLIC entry in the .dynamic section, but I am not sure what it is used for. It is possible that it would be used in cases where you attempt to link non-PIC code into a shared library, since you would still be emitting relocations to the output file in this case. Thus patches to the dynamic loader should still be required. The drawbacks to using this flag are that the library is less sharable. In other words, the user cannot redefine functions in the library and expect that their redefinition will work for calls to the function from within the library. I vaguely recall a few months ago seeing a discussion between some of the members of the ABI+ committee (who are charged with updating the SVr4 ABI, and merging differences between Solaris and Unixware). Apparently some (but not all) SVr4 vendors are using -Bsymbolic with libc - apparently for performance reasons. FWIW, I would recommend against ever using this switch except in certain specific cases - people need to know exactly what they are doing when they turn this one on, and they need to know the ramifications. -Eric -- "The woods are lovely, dark and deep. But I have promises to keep, And lines to code before I sleep, And lines to code before I sleep."