H. J. Lu - Re: PATCH: Build shared libraries with -Bsymbolic-functions (original) (raw)

This is the mail archive of the gcc-patches@gcc.gnu.orgmailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

On Wed, Jan 31, 2007 at 02:33:34PM -0800, H. J. Lu wrote:

On Wed, Jan 31, 2007 at 05:21:11PM -0500, Andrew Pinski wrote:

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.

Here are dynamic relocation changes on Linux/x86-64:

libgcc_s.so Old -Bsymbolic-functions '.rela.dyn': 10 entries 10 entries '.rela.plt': 31 entries 10 entries libffi.so '.rela.dyn': 7 entries 7 entries '.rela.plt': 16 entries 4 entries libgfortran.so '.rela.dyn': 139 entries 139 entries '.rela.plt': 283 entries 173 entries libgomp.so '.rela.dyn': 10 entries 10 entries '.rela.plt': 26 entries 26 entries libmudflapth.so '.rela.dyn': 133 entries 133 entries '.rela.plt': 172 entries 148 entries libmudflap.so '.rela.dyn': 123 entries 123 entries '.rela.plt': 162 entries 139 entries libobjc.so '.rela.dyn': 340 entries 340 entries '.rela.plt': 170 entries 56 entries libssp.so '.rela.dyn': 9 entries 9 entries '.rela.plt': 20 entries 18 entries libstdc++.so '.rela.dyn': 2435 entries 2435 entries '.rela.plt': 533 entries 107 entries

Here are dynamic relocation changes on Linux/i686:

        Old				-Bsymbolic-functions

libgcc_s.so '.rel.dyn': 9 entries 9 entries '.rel.plt': 29 entries 11 entries libffi.so '.rel.dyn': 7 entries 7 entries '.rel.plt': 8 entries 5 entries libgfortran.so '.rel.dyn': 138 entries 138 entries '.rel.plt': 248 entries 174 entries libgomp.so '.rel.dyn': 9 entries 9 entries '.rel.plt': 26 entries 26 entries libmudflapth.so '.rel.dyn': 133 entries 133 entries '.rel.plt': 173 entries 149 entries libmudflap.so '.rel.dyn': 123 entries 123 entries '.rel.plt': 163 entries 140 entries libobjc.so '.rel.dyn': 340 entries 340 entries '.rel.plt': 171 entries 57 entries libssp.so '.rel.dyn': 9 entries 9 entries '.rel.plt': 21 entries 19 entrie libstdc++.so '.rel.dyn': 2435 entries 2435 entries '.rel.plt': 538 entries 110 entries

The test result is at

http://gcc.gnu.org/ml/gcc-testresults/2007-02/msg00388.html

-Bsymbolic-functions can reduce PLT relocations by as much as 80% without any regressions. I am enclosing my patch here again.

H.J.

Attachment:gcc-symbolic-14.patch
Description: Text document


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