build change, define a "standard" way to hide functions
Peter Mazinger
ps.m at gmx.net
Sat Mar 26 01:23:28 UTC 2011
Hi,
I am proposing following changes in the build:
A.
- include only .oS files into shared libraries (-DSHARED defined)
- include .os (if DOPIC is enabled) or .o (if DOPIC disabled) files into archives (lib*.a)
- if SHARED is defined attribute_hidden is hiding (and accordingly *hidden_proto the __GI_x counterpart)
- if SHARED is not defined attribute_hidden is nop (*hidden_proto is only a redefine to __GI_x without hiding)
- *hidden_def/*hidden_weak keeps it's definition as strong_alias/weak_alias
The jump relocation avoidance (achieved by hidden functions) is relevant
only for shared libraries, in static libraries the hidden functions makes
it difficult to strip them if not needed (unused/eliding weaks come to my mind)
The only consequence will be, that the build will have to compile all files twice (build taking somewhat longer).
On the other side we do not have to care in the Makefiles if one file
goes to the shared library or not (that some may not even understand)
B.
Use only *hidden_proto to hide functions (do not use attribute_hidden explicitly), if we need the visible/exported function as well, then we
need to add *hidden_def or *hidden_weak
There seems to be a problem of understanding how these *hidden_proto/def/weak work
(especially the difference in .S and .c files)
I personally use attribute_hidden if I know that the function is only
for internal use, else the *hidden_proto/*hidden_def/weak, but I have
also seen duplicates as x() attribute_hidden; *hidden_proto(x) that really
does not make sense
Anyway, we should define some rules how these should be used (I know,
that the hidden stuff is documented in libc-symbols.h, but that seems
not be enough...
Regards, Peter
--
NEU: FreePhone - kostenlos mobil telefonieren und surfen!
Jetzt informieren: http://www.gmx.net/de/go/freephone
More information about the uClibc
mailing list