[uClibc]__USE_WEAK_ALIASES in __uClibc_main.c

Miles Bader miles at lsi.nec.co.jp
Fri Mar 15 02:13:44 UTC 2002


What's the point of this code in __uClibc_main.c:

   #if !defined HAVE_ELF || !defined __UCLIBC_HAS_MMU__
   # undef weak_function
   # undef weak_const_function
   # define weak_function
   # define weak_const_function
   # define __USE_WEAK_ALIASES
   #endif

Why does an MMUless system have to use weak aliases instead of weak
symbols?  It worked fine before with weak functions.

I removed it locally, and things work fine:

--- __uClibc_main.c.~1.16.~	Fri Mar 15 10:00:34 2002
+++ __uClibc_main.c	Fri Mar 15 11:01:19 2002
@@ -15,7 +15,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-#if !defined HAVE_ELF || !defined __UCLIBC_HAS_MMU__
+#if !defined HAVE_ELF
 # undef weak_function
 # undef weak_const_function
 # define weak_function


Also, according to my compiler, the `weak aliases' case (when it was
incorrectly being enabled on my system) fails to compile, because all
the calls to `weak_alias' inside the `#ifdef __USE_WEAK_ALIASES' at the
end are real declarations, which conflict with the declarations at the
beginning of the file.  E.g. this:

   extern int weak_function atexit(void (*function)(void));

conflicts with this:

   weak_alias(__uClibc_empty_func, atexit);

Perhaps this is compiler version dependent; my compiler is somewhat old
(based on gcc 2.93 I think).

-Miles
-- 
Fast, small, soon; pick any 2.



More information about the uClibc mailing list