Merge r6159 (parts of):

Minor build-system adjustments, mostly.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6289 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_cpuid.S b/coregrind/m_cpuid.S
index 9aa57c1..17d444d 100644
--- a/coregrind/m_cpuid.S
+++ b/coregrind/m_cpuid.S
@@ -60,8 +60,6 @@
     VG_(has_cpuid):
         movq    $1, %rax
         ret
-#elif defined(VGA_appc32)
-//CAB: TODO
 #endif
 
 /*
@@ -143,13 +141,13 @@
         movq    %rbp, %rsp
         popq    %rbp
         ret
-#elif defined(VGA_appc32)
-//CAB: TODO
 #endif
-        
+
+#if defined(VGA_x86) || defined(VGA_amd64)        
 /* Let the linker know we don't need an executable stack */
 .section .note.GNU-stack,"",@progbits
-		
+#endif
+
 ##--------------------------------------------------------------------##
 ##--- end                                                          ---##
 ##--------------------------------------------------------------------##
diff --git a/coregrind/m_libcassert.c b/coregrind/m_libcassert.c
index 1f50fed..9b8125d 100644
--- a/coregrind/m_libcassert.c
+++ b/coregrind/m_libcassert.c
@@ -30,6 +30,7 @@
 
 #include "pub_core_basics.h"
 #include "pub_core_vki.h"
+#include "pub_core_vkiscnums.h"
 #include "pub_core_threadstate.h"
 #include "pub_core_libcbase.h"
 #include "pub_core_libcassert.h"
@@ -39,7 +40,6 @@
 #include "pub_core_syscall.h"
 #include "pub_core_tooliface.h"     // For VG_(details).{name,bug_reports_to}
 #include "pub_core_options.h"       // For VG_(clo_xml)
-#include "pub_core_vkiscnums.h"
 
 /* ---------------------------------------------------------------------
    Assertery.
@@ -62,7 +62,7 @@
           : "=r" (pc),\
             "=r" (sp),\
             "=r" (fp));
-#elif defined(VGP_ppc32_linux)
+#elif defined(VGP_ppc32_linux) || defined(VGP_ppc32_aix5)
 #  define GET_REAL_PC_SP_AND_FP(pc, sp, fp)                   \
       asm("mflr 0;"                   /* r0 = lr */           \
           "bl m_libcassert_get_ip;"   /* lr = pc */           \
@@ -76,7 +76,7 @@
             "=r" (fp)               \
           : /* reads none */        \
           : "r0" /* trashed */ );
-#elif defined(VGP_ppc64_linux)
+#elif defined(VGP_ppc64_linux) || defined(VGP_ppc64_aix5)
 #  define GET_REAL_PC_SP_AND_FP(pc, sp, fp)                   \
       asm("mflr 0;"                   /* r0 = lr */           \
           "bl .m_libcassert_get_ip;"  /* lr = pc */           \
@@ -99,7 +99,9 @@
 /* Pull down the entire world */
 void VG_(exit)( Int status )
 {
+#  if defined(VGO_linux)
    (void)VG_(do_syscall1)(__NR_exit_group, status );
+#  endif
    (void)VG_(do_syscall1)(__NR_exit, status );
    /* Why are we still alive here? */
    /*NOTREACHED*/
@@ -108,7 +110,7 @@
 }
 
 // Print the scheduler status.
-static void pp_sched_status ( void )
+void VG_(show_sched_status) ( void )
 {
    Int i; 
    VG_(printf)("\nsched status:\n"); 
@@ -143,11 +145,7 @@
                         ips, BACKTRACE_DEPTH, ip, sp, fp, lr, sp, stacktop);
    VG_(pp_StackTrace)  (ips, BACKTRACE_DEPTH);
  
-   // Don't print this, as it's not terribly interesting and avoids a
-   // dependence on m_scheduler/, which would be crazy.
-   //VG_(printf)("\nBasic block ctr is approximately %llu\n", VG_(bbs_done) );
- 
-   pp_sched_status();
+   VG_(show_sched_status)();
    VG_(printf)("\n");
    VG_(printf)("Note: see also the FAQ.txt in the source distribution.\n");
    VG_(printf)("It contains workarounds to several common problems.\n");
@@ -169,7 +167,7 @@
 
    static Bool entered = False;
    if (entered) 
-     VG_(exit)(2);
+      VG_(exit)(2);
    entered = True;
 
    va_start(vargs, format);
@@ -251,7 +249,7 @@
       "Valgrind has to exit now.  Sorry.  Bye!");
    VG_(message)(Vg_UserMsg,
       "");
-   pp_sched_status();
+   VG_(show_sched_status)();
    VG_(exit)(1);
 }
 
diff --git a/coregrind/m_threadmodel.c b/coregrind/m_threadmodel.c
index e7d3a09..5bd5b7e 100644
--- a/coregrind/m_threadmodel.c
+++ b/coregrind/m_threadmodel.c
@@ -7,7 +7,7 @@
    This file is part of Valgrind,  a dynamic binary instrumentation
    framework.
 
-   Copyright (C) 2005 Jeremy Fitzhardinge
+   Copyright (C) 2005-2006 Jeremy Fitzhardinge
       jeremy@goop.org
 
    This program is free software; you can redistribute it and/or
diff --git a/coregrind/pub_core_libcassert.h b/coregrind/pub_core_libcassert.h
index b38853c..fdedfef 100644
--- a/coregrind/pub_core_libcassert.h
+++ b/coregrind/pub_core_libcassert.h
@@ -71,6 +71,9 @@
 extern void VG_(unimplemented) ( Char* msg )
             __attribute__((__noreturn__));
 
+/* Show the state of all threads.  Mostly for debugging V. */
+extern void VG_(show_sched_status) ( void );
+
 #endif   // __PUB_CORE_LIBCASSERT_H
 
 /*--------------------------------------------------------------------*/
diff --git a/coregrind/vg_preloaded.c b/coregrind/vg_preloaded.c
index 1e5d20c..261c769 100644
--- a/coregrind/vg_preloaded.c
+++ b/coregrind/vg_preloaded.c
@@ -55,7 +55,7 @@
 void VG_NOTIFY_ON_LOAD(freeres)( void )
 {
    int res;
-#ifndef __UCLIBC__
+#if !defined(__UCLIBC__) && !defined(VGO_aix5)
    extern void __libc_freeres(void);
    __libc_freeres();
 #endif