Ian Lance Taylor <i...@google.com> writes:

> I have committed a patch to libgo to update it to the weekly.2011-12-22
> release.  As usual I am not including all the changes here, only the
> ones to files which are specific to gccgo.  Bootstrapped and ran Go
> testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

The patch introduced a couple of other problems:

* There's a warning during libgo configure:

checking for --enable-version-specific-runtime-libs... no
/vol/gcc/src/hg/trunk/solaris/libgo/configure[13514]: test: argument expected
checking whether -fsplit-stack is supported... no

  Fixed as follows:

diff --git a/libgo/configure.ac b/libgo/configure.ac
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -126,6 +126,7 @@ is_darwin=no
 is_freebsd=no
 is_irix=no
 is_linux=no
+is_netbsd=no
 is_rtems=no
 is_solaris=no
 GOOS=unknown

* Bootstrap on Solaris < 11 is broken:

/vol/gcc/src/hg/trunk/local/libgo/runtime/mem.c:73:2: error: implicit 
declaration of function 'madvise' [-Werror=implicit-function-declaration]

  The madvise declaration in <sys/mman.h> is only visible if
  !(_XOPEN_SOURCE > 420).  Since _XOPEN_SOURCE is necessary for other
  compilations, I've #undef'ed the symbol at the beginning of this
  particular file:

diff --git a/libgo/runtime/mem.c b/libgo/runtime/mem.c
--- a/libgo/runtime/mem.c
+++ b/libgo/runtime/mem.c
@@ -1,3 +1,7 @@
+/* Defining _XOPEN_SOURCE hides the declaration of madvise() on Solaris <
+   11 and the MADV_DONTNEED definition on IRIX 6.5.  */
+#undef _XOPEN_SOURCE
+
 #include <errno.h>
 #include <unistd.h>
 
  As the comment states, IRIX has a similar problem, but that could be
  fixed in a different way.

* The IRIX libgo build is broken like this:

/vol/gcc/src/hg/trunk/local/libgo/runtime/go-map-delete.c: In function 
'__go_map_delete':
/vol/gcc/src/hg/trunk/local/libgo/runtime/go-map-delete.c:38:11: error: 
assignment from incompatible pointer type [-Werror]

/vol/gcc/src/hg/trunk/local/libgo/runtime/go-map-index.c:36:10: error: 
assignment from incompatible pointer type [-Werror]

  On IRIX, size_t and uintptr_t differ, so I'm changing the prototypes
  above to match what's in go-type.h.

/vol/gcc/src/hg/trunk/local/libgo/runtime/mem.c:70:25: error: unused parameter 
'v' [-Werror=unused-parameter]
/vol/gcc/src/hg/trunk/local/libgo/runtime/mem.c:70:36: error: unused parameter 
'n' [-Werror=unused-parameter]

  As mentioned above, MADV_DONTNEED may be unavailable, so the args need
  to be marked unused to avoid the warning.

diff --git a/libgo/runtime/go-map-delete.c b/libgo/runtime/go-map-delete.c
--- a/libgo/runtime/go-map-delete.c
+++ b/libgo/runtime/go-map-delete.c
@@ -20,7 +20,7 @@ __go_map_delete (struct __go_map *map, c
   const struct __go_map_descriptor *descriptor;
   const struct __go_type_descriptor *key_descriptor;
   uintptr_t key_offset;
-  _Bool (*equalfn) (const void*, const void*, size_t);
+  _Bool (*equalfn) (const void*, const void*, uintptr_t);
   size_t key_hash;
   size_t key_size;
   size_t bucket_index;
diff --git a/libgo/runtime/go-map-index.c b/libgo/runtime/go-map-index.c
--- a/libgo/runtime/go-map-index.c
+++ b/libgo/runtime/go-map-index.c
@@ -21,7 +21,7 @@ __go_map_rehash (struct __go_map *map)
   const struct __go_type_descriptor *key_descriptor;
   uintptr_t key_offset;
   size_t key_size;
-  size_t (*hashfn) (const void *, size_t);
+  uintptr_t (*hashfn) (const void *, uintptr_t);
   uintptr_t old_bucket_count;
   void **old_buckets;
   uintptr_t new_bucket_count;
@@ -80,7 +80,7 @@ __go_map_index (struct __go_map *map, co
   const struct __go_map_descriptor *descriptor;
   const struct __go_type_descriptor *key_descriptor;
   uintptr_t key_offset;
-  _Bool (*equalfn) (const void*, const void*, size_t);
+  _Bool (*equalfn) (const void*, const void*, uintptr_t);
   size_t key_hash;
   size_t key_size;
   size_t bucket_index;
diff --git a/libgo/runtime/mem.c b/libgo/runtime/mem.c
--- a/libgo/runtime/mem.c
+++ b/libgo/runtime/mem.c
@@ -71,7 +71,7 @@ runtime_SysAlloc(uintptr n)
 }
 
 void
-runtime_SysUnused(void *v, uintptr n)
+runtime_SysUnused(void *v __attribute__ ((unused)), uintptr n __attribute__ 
((unused)))
 {
 #ifdef MADV_DONTNEED
        runtime_madvise(v, n, MADV_DONTNEED);

With those changes, I was able to get libgo to build again on IRIX 6.5
and Solaris 10.

        Rainer

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

Reply via email to