Patchwork libgo patch committed: Update to weekly.2012-02-14 release

login
register
mail settings
Submitter Rainer Orth
Date March 2, 2012, 7:13 p.m.
Message ID <yddmx7yvmt6.fsf@manam.CeBiTec.Uni-Bielefeld.DE>
Download mbox | patch
Permalink /patch/144312/
State New
Headers show

Comments

Rainer Orth - March 2, 2012, 7:13 p.m.
Ian Lance Taylor <iant@google.com> writes:

> I have committed a patch to libgo to update to the weekly.2012-02-14
> release.  As usual, in this e-mail message I only include the patches to
> files specific to the gccgo version of libgo.  Bootstrapped and ran Go
> testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

This broke Solaris 10 (and probably 9 also) bootstrap:

/vol/gcc/src/hg/trunk/local/libgo/runtime/mem.c: In function 'mmap_fixed':
/vol/gcc/src/hg/trunk/local/libgo/runtime/mem.c:47:2: error: pointer targets in passing argument 1 of 'mmap' differ in signedness [-Werror=pointer-sign]
In file included from /vol/gcc/src/hg/trunk/local/libgo/runtime/runtime.h:23:0,
                 from /vol/gcc/src/hg/trunk/local/libgo/runtime/mem.c:8:
/usr/include/sys/mman.h:168:16: note: expected 'caddr_t' but argument is of type 'byte *'
/vol/gcc/src/hg/trunk/local/libgo/runtime/mem.c:53:3: error: pointer targets in passing argument 1 of 'mmap' differ in signedness [-Werror=pointer-sign]
In file included from /vol/gcc/src/hg/trunk/local/libgo/runtime/runtime.h:23:0,
                 from /vol/gcc/src/hg/trunk/local/libgo/runtime/mem.c:8:
/usr/include/sys/mman.h:168:16: note: expected 'caddr_t' but argument is of type 'byte *'
cc1: all warnings being treated as errors

The first mmap arg is caddr_t (char *), while byte * is uint8 *.
Casting to void * fixes this.

	Rainer
Ian Taylor - March 2, 2012, 8:48 p.m.
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> The first mmap arg is caddr_t (char *), while byte * is uint8 *.
> Casting to void * fixes this.

Thanks.

Committed.

Ian

Patch

# HG changeset patch
# Parent 3c65bd27734429765e18be13aeb46e624807b984
Cast mmap addr to void *

diff --git a/libgo/runtime/mem.c b/libgo/runtime/mem.c
--- a/libgo/runtime/mem.c
+++ b/libgo/runtime/mem.c
@@ -44,13 +44,13 @@  mmap_fixed(byte *v, uintptr n, int32 pro
 {
 	void *p;
 
-	p = runtime_mmap(v, n, prot, flags, fd, offset);
+	p = runtime_mmap((void *)v, n, prot, flags, fd, offset);
 	if(p != v && addrspace_free(v, n)) {
 		// On some systems, mmap ignores v without
 		// MAP_FIXED, so retry if the address space is free.
 		if(p != MAP_FAILED)
 			runtime_munmap(p, n);
-		p = runtime_mmap(v, n, prot, flags|MAP_FIXED, fd, offset);
+		p = runtime_mmap((void *)v, n, prot, flags|MAP_FIXED, fd, offset);
 	}
 	return p;
 }