PATCH: Make environ a weak alias to __environ

Peter S. Mazinger ps.m at gmx.net
Tue Jan 31 10:08:33 UTC 2006


On Tue, 31 Jan 2006, Peter S. Mazinger wrote:

> On Mon, 30 Jan 2006, Khem Raj wrote:
> 
> > Hi Peter
> > 
> > This patch make environ a weak alias to __environ. This was the original 
> > behavior which was modified when libc_hidden_proto/def
> > were introduced for environ.
> > 
> > Tested on arm-uclibc.
> 
> if that is the case, then arm could have problems w/ strong_alias 
> generally and needs rather a global change in bits/uClibc_arch_features.h.
> 
> Mike, how did an arch behave, if .set is not supported? Was it a gas 
> failure?

The list of global data (hope I have them all) that got handled the same 
way and could have the same problem (but not all of them have strong_alias 
counterparts and it seems that only the alias has problem)

libc:
in6addr_loopback,__rpc_thread_createrr,
__C_ctype_b_data,__C_ctype_b,__ctype_b
__C_ctype_tolower_data,__C_ctype_tolower,__ctype_tolower,
__C_ctype_toupper_data,__C_ctype_toupper,__ctype_toupper,
obstack_alloc_failed_handler,obstack_exit_failure
__environ,__global_locale,__curlocale_var,daylight,timezone,tzname,
__iconv_codesets,stdin,stdout,stderr,__stdin,optarg,opterr,optind,optopt
libm:
_LIB_VERSION

With global data hiding I had a problem:
libc/misc/error/error.c: 
doing

libc_hidden_proto(error_message_count)
unsigned int error_message_count = 0;
libc_hidden_def(error_message_count)

is allowed by gcc (removing = 0 fails differently depending on gcc 
version), but the resulting object has only the hidden 
__GI_error_message_count as defined, error_message_count gets lost.

if I do instead
attribute_hidden unsigned int __error_message_count = 0;
strong_alias(__error_message_count,error_message_count)

and change the use of error_message_count to __error_message_count, 
error_message_count does not show up again in the object (this is gcc 
dependent)

Peter

-- 
Peter S. Mazinger <ps dot m at gmx dot net>           ID: 0xA5F059F2
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08  BB6E C389 975E A5F0 59F2




More information about the uClibc mailing list