This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: Build shared libraries with -Bsymbolic-functions
- From: "H. J. Lu" <hjl at lucon dot org>
- To: Andrew Pinski <pinskia at physics dot uc dot edu>
- Cc: Andrew Haley <aph at redhat dot com>, Paolo Bonzini <paolo dot bonzini at lu dot unisi dot ch>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 31 Jan 2007 14:33:34 -0800
- Subject: Re: PATCH: Build shared libraries with -Bsymbolic-functions
- References: <20070131220613.GA6909@lucon.org> <200701312221.l0VMLBj8011708@localhost.localdomain>
On Wed, Jan 31, 2007 at 05:21:11PM -0500, Andrew Pinski wrote:
> >
> > On Sun, Jan 14, 2007 at 10:47:41AM -0800, H. J. Lu wrote:
> > > On Sun, Jan 14, 2007 at 01:30:07PM -0500, Andrew Pinski wrote:
> > > > > I checked in the libjava part. Here is the updated patch for other
> > > > > libraries. If someone can give me a list of functions in libobjc
> > > > > which should be overridable, I will add them to the dynamic list
> > > > > for libobjc.
> > > >
> > > > All except for the class functions themselves. For libobjc, a better
> > > > way of doing this is actually marking the class methods as hidden as they
> > > > are never called directly.
> > >
> > > I assume *.m files have class functions and other files have non-class
> > > functions which may be overrable by programmers. Is that correct?
> > >
> > > What about functuons with the prefixes of __?
> >
> > I took a look at
> >
> > http://www.dribin.org/dave/blog/archives/2006/04/22/tracing_objc/
> > http://developer.apple.com/documentation/DeveloperTools/Conceptual/DynamicLibraries/Articles/UsingDynamicLibraries.html#//apple_ref/doc/uid/TP40002182-DontLinkElementID_32
>
>
> Apple's documention is about the NeXT runtime and not the GNU runtime so those don't
> apply really. The first link also only applies to the NeXT runtime.
My point is a user shouldn't assume that he/she can override
global function call references within libobjc, which is the only
visible impact my patch has.
>
> I have a patch for libobjc to use -fvisibility=hidden. The number of functions inside
> the Objective-C runtime is little so the issue of getting binding faster will not help
> it that much. Also I am working on just getting the class's methods marked hidden.
>
> Really your patch only helps targets where GNU binutils works and only where
> that specific option has been added (which is not going to be released until later
> this year). And my patches will help all targets even with older binutils.
>
> I would rather libobjc be done differently than the other target libraries because
> there is no reason to include this option when there are better ways of getting this
> working correctly.
-fvisibility=hidden only works on global functions which aren't
the part of libobjc ABI. For example,
BOOL objc_hash_is_key_in_hash (cache_ptr cache, const void *key);
is in hash.h and user can call it. It can't be hidden. But there
is
[hjl@gnu-26 .libs]$ readelf --wide -r libobjc.so.2 | grep objc_hash_is_key_in_hash
0000000000217910 0000010700000007 R_X86_64_JUMP_SLOT 000000000000cde0 objc_hash_is_key_in_hash + 0
My approach will remove this relocation.
H.J.