Right now, it's okay, since parlib redefines printf to akaros_printf.  That
tricks whatever dark magic that triggers the 'multiple libcs' problem.  But
when we fix printf to not use a macro-based solution, this breaks.

Until we understand more, we need to continue to be careful about where we
call printf or similar functions within glibc.  Normally, we'll find out
when the toolchain build fails, but with the #undef printf in
parlib/stdio.h, we were hiding those failures.  That will be fixed shortly.

Rebuild glibc.

Signed-off-by: Barret Rhoden <[email protected]>
---
 .../glibc-2.19-akaros/sysdeps/akaros/Versions        |  1 +
 .../glibc-2.19-akaros/sysdeps/akaros/parlib-compat.c |  6 ++++++
 .../glibc-2.19-akaros/sysdeps/akaros/sigaction.c     | 20 ++++++++++++--------
 3 files changed, 19 insertions(+), 8 deletions(-)

diff --git 
a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/Versions 
b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/Versions
index 7ca731db0067..e9912691eddc 100644
--- a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/Versions
+++ b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/Versions
@@ -57,6 +57,7 @@ libc {
 
     # Weak symbols in parlib-compat.c
     akaros_printf;
+    print_user_context;
     _assert_failed;
   }
 }
diff --git 
a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/parlib-compat.c 
b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/parlib-compat.c
index 6327402fbde3..881e6e2c8b66 100644
--- a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/parlib-compat.c
+++ b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/parlib-compat.c
@@ -21,6 +21,12 @@ int __akaros_printf(const char *format, ...)
 }
 weak_alias(__akaros_printf, akaros_printf)
 
+void __print_user_context(struct user_context *ctx)
+{
+       assert(0);
+}
+weak_alias(__print_user_context, print_user_context)
+
 void ___assert_failed(const char *file, int line, const char *msg)
 {
        assert(0);
diff --git 
a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/sigaction.c 
b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/sigaction.c
index 9ba55ac8b9a1..4096eeb48fb7 100644
--- a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/sigaction.c
+++ b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/sigaction.c
@@ -5,12 +5,16 @@
  * See LICENSE for details.
  */
 
-#include <stdio.h>
 #include <errno.h>
 #include <ros/procinfo.h>
 #include <ros/syscall.h>
 #include <parlib/signal.h>
 #include <parlib/vcore.h>
+/* This is nasty.  We can't use the regular printf here.  If we do, we'll get
+ * the dreaded "multiple libcs" error during a glibc rebuild.  But we can use 
an
+ * akaros_printf.  If there are parts of glibc that don't link against parlib,
+ * we'll get the weak symbol.  (rtld perhaps). */
+#include <parlib/stdio.h>
 
 /* We define the signal_ops struct in glibc so that it is accessible without
  * being linked to parlib. Parlib-based 2LSs will override it with their
@@ -36,30 +40,30 @@ static void default_term_handler(int signr, siginfo_t 
*info, void *ctx)
 
 static void default_core_handler(int signr, siginfo_t *info, void *ctx)
 {
-       printf("Segmentation Fault (sorry, no core dump yet)\n");
+       akaros_printf("Segmentation Fault (sorry, no core dump yet)\n");
        if (ctx)
                print_user_context((struct user_context*)ctx);
        else
-               printf("No ctx for %s\n", __func__);
+               akaros_printf("No ctx for %s\n", __func__);
        if (info) {
                /* ghetto, we don't have access to the PF err, since we only 
have a few
                 * fields available in siginfo (e.g. there's no si_trapno). */
-               printf("Fault type %d at addr %p\n", info->si_errno,
-                       info->si_addr);
+               akaros_printf("Fault type %d at addr %p\n", info->si_errno,
+                             info->si_addr);
        } else {
-               printf("No fault info\n");
+               akaros_printf("No fault info\n");
        }
        default_term_handler((1 << 7) + signr, info, ctx);
 }
 
 static void default_stop_handler(int signr, siginfo_t *info, void *ctx)
 {
-       printf("Stop signal received!  No support to stop yet though!\n");
+       akaros_printf("Stop signal received!  No support to stop yet 
though!\n");
 }
 
 static void default_cont_handler(int signr, siginfo_t *info, void *ctx)
 {
-       printf("Cont signal received!  No support to cont yet though!\n");
+       akaros_printf("Cont signal received!  No support to cont yet 
though!\n");
 }
 
 typedef void (*__sigacthandler_t)(int, siginfo_t *, void *);
-- 
2.6.0.rc2.230.g3dd15c0

-- 
You received this message because you are subscribed to the Google Groups 
"Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to