Jakub Jelinek <ja...@redhat.com> writes:

> On Thu, Oct 31, 2013 at 01:32:19PM +0000, Iyer, Balaji V wrote:
>> > It is not just about not including 3, but also the []s in configure.ac
>> > were eaten by
>> > m4.  In any case, shouldn't you fix also config/generic?
>> > 
>> 
>> I am in the process of fixing config/generic. I also replaced [456] with
>> i?86.  That should work fine right?
>
> Yes.

Even with that change, i386-pc-solaris2.11 bootstrap is broken in
libcilkrts in two different ways:

* Configuring the library fails for the 64-bit multilib: config.log
  shows

configure:3105: checking whether the C++ compiler works
configure:3114: ./a.out
ld.so.1: a.out: fatal: 
/var/gcc/regression/trunk/11-gcc/build/./gcc/libgcc_s.so.1: wrong ELF class: 
ELFCLASS32
/vol/gcc/src/hg/trunk/local/libcilkrts/configure[3116]: eval: line 1: 4955: 
Killed
configure:3118: $? = 265
configure:3125: error: in 
`/var/gcc/regression/trunk/11-gcc/build/i386-pc-solaris2.11/amd64/libcilkrts':
configure:3127: error: cannot run C++ compiled programs.

  There's no 64-bit libgcc_s.so.1 installed in the runtime linker's
  default search path, and toplevel Makefile (via RPATH_ENVVAR) only
  takes care of the default multilib.  This is also reported for the
  libgcj case in PR other/43445.

* Even after setting LD_LIBRARY_PATH_64 to work around this,
  compilation fails for os-unix.c:

/vol/gcc/src/hg/trunk/local/libcilkrts/runtime/os-unix.c:66:5: error: #error 
"Unsupported OS"
 #   error "Unsupported OS"
     ^
/vol/gcc/src/hg/trunk/local/libcilkrts/runtime/os-unix.c: In function 
'__cilkrts_hardware_cpu_count':
/vol/gcc/src/hg/trunk/local/libcilkrts/runtime/os-unix.c:378:2: error: #error 
"Unknown architecture"
 #error "Unknown architecture"
  ^
/vol/gcc/src/hg/trunk/local/libcilkrts/runtime/os-unix.c: In function 
'__cilkrts_yield':
/vol/gcc/src/hg/trunk/local/libcilkrts/runtime/os-unix.c:411:5: warning: 
implicit declaration of function 'pthread_yield' 
[-Wimplicit-function-declaration]
     pthread_yield();
     ^
make[2]: *** [os-unix.lo] Error 1

  The following patch fixes this:

2013-10-31  Rainer Orth  <r...@cebitec.uni-bielefeld.de>

        * runtime/os-unix.c [__sun__ && __svr4__]: Include <sched.h>.
        (__cilkrts_hardware_cpu_count) [__sun__ && __svr4__]: Use sysconf.
        (__cilkrts_yield) [__sun__ && __svr4__]: Use sched_yield.

diff --git a/libcilkrts/runtime/os-unix.c b/libcilkrts/runtime/os-unix.c
--- a/libcilkrts/runtime/os-unix.c
+++ b/libcilkrts/runtime/os-unix.c
@@ -62,6 +62,9 @@
 #   include <vxWorks.h>   
 #   include <vxCpuLib.h>   
 #   include <taskLib.h>   
+// Solaris
+#elif defined __sun__ && defined __svr4__
+#   include <sched.h>
 #else
 #   error "Unsupported OS"
 #endif
@@ -346,7 +349,7 @@ static int linux_get_affinity_count (int
 
 COMMON_SYSDEP int __cilkrts_hardware_cpu_count(void)
 {
-#if defined ANDROID
+#if defined ANDROID || (defined(__sun__) && defined(__svr4__))
     return sysconf (_SC_NPROCESSORS_ONLN);
 #elif defined __MIC__
     /// HACK: Usually, the 3rd and 4th hyperthreads are not beneficial
@@ -401,9 +404,9 @@ COMMON_SYSDEP void __cilkrts_yield(void)
     // giving up the processor and latency starting up when work becomes
     // available
     _mm_delay_32(1024);
-#elif defined(ANDROID)
-    // On Android, call sched_yield to yield quantum.  I'm not sure why we
-    // don't do this on Linux also.
+#elif defined(ANDROID) || (defined(__sun__) && defined(__svr4__))
+    // On Android and Solaris, call sched_yield to yield quantum.  I'm not
+    // sure why we don't do this on Linux also.
     sched_yield();
 #else
     // On Linux, call pthread_yield (which in turn will call sched_yield)
        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

Reply via email to