__uc_malloc hooks

Denys Vlasenko vda.linux at googlemail.com
Sat Sep 15 18:51:48 UTC 2007


Hi again Mike,

On Saturday 15 September 2007 19:09, Denys Vlasenko wrote:
> Anyway I have a feeling that I am lost in the #define maze
> and the only thing which I understand is that
> 
> libc_hidden_def(foo)
> 
> is not a "hidden definition of foo", it's a "definition of hidden symbol
> _MAGIC_JUNK_foo which is aliased to foo", and
> 
> libc_hidden_proto(foo)
> 
> is not a "hidden prototype of foo" but rather "please make all references
> to foo in this .c file refer to _MAGIC_JUNK_foo".
> 
> Which is utterly confusing.
> 
> Can I have macro names which do not lie to me?
> 
> libc_define_internal_alias(foo)
>   [or libc_define_internal_name(foo) or libc_define_internal(foo) or...]
> and
> libc_use_internal_alias(foo)

I think that libc-symbols.h needs cleanup.

A few things I noticed.

NOT_IN_libc is never defined in uclibc tarball (grepping for
'define[^d].*NOT_IN_libc' gives nothing). Yet tons of #ifs check it.
Is it needed?


Ugliest part of libc-symbols.h starts here:

/* Handling on non-exported internal names.  We have to do this only
   for shared code.  */
#ifdef SHARED
# define INTUSE(name) name##_internal
# define INTDEF(name) strong_alias (name, name##_internal)
# define INTVARDEF(name) \
  _INTVARDEF (name, name##_internal)
# if defined HAVE_VISIBILITY_ATTRIBUTE
#  define _INTVARDEF(name, aliasname) \
  extern __typeof (name) aliasname __attribute__ ((alias (#name), visibility ("hidden")));
# else
#  define _INTVARDEF(name, aliasname) \
  extern __typeof (name) aliasname __attribute__ ((alias (#name)));
# endif
# define INTDEF2(name, newname) strong_alias (name, newname##_internal)
# define INTVARDEF2(name, newname) _INTVARDEF (name, newname##_internal)
#else
# define INTUSE(name) name
# define INTDEF(name)
# define INTVARDEF(name)
# define INTDEF2(name, newname)
# define INTVARDEF2(name, newname)
#endif


INTUSE: one user (libc/misc/regex/regex_internal.h)
INT[VAR]DEF[2]: no users
worth removing?


Directly after that libc-symbols.h contains libc_hidden_XXX land.
I do think that libc_hidden_def/libc_hidden_proto macros need renaming.

What do you think?
--
vda



More information about the uClibc mailing list