diff mbox

libgo patch committed: Fix build on MIPS GNU/Linux

Message ID mcraa1t2kpf.fsf@dhcp-172-18-216-180.mtv.corp.google.com
State New
Headers show

Commit Message

Ian Lance Taylor April 30, 2012, 5:28 p.m. UTC
This patch to libgo fixes the build on MIPS GNU/Linux.  I haven't been
able to fully test gccgo, as the MIPS64 machine in the GCC compile farm
is running a version of glibc that is too old--it does not support
makecontext and friends.  However, this patch at least gets past the
immediate build problem reported in PR 52586.  Bootstrapped and ran Go
testsuite on x86_64-unknown-linux-gnu.  Committed to mainline and 4.7
branch.

Ian

Comments

Andrew Pinski May 1, 2012, 7:10 p.m. UTC | #1
On Mon, Apr 30, 2012 at 10:28 AM, Ian Lance Taylor <iant@google.com> wrote:
> This patch to libgo fixes the build on MIPS GNU/Linux.  I haven't been
> able to fully test gccgo, as the MIPS64 machine in the GCC compile farm
> is running a version of glibc that is too old--it does not support
> makecontext and friends.  However, this patch at least gets past the
> immediate build problem reported in PR 52586.  Bootstrapped and ran Go
> testsuite on x86_64-unknown-linux-gnu.  Committed to mainline and 4.7
> branch.

I tested the trunk after this patch on mips64-linux-gnu (with glibc
2.15) and the testsuite looks good.
		=== go tests ===


Running target unix//-march=octeon+/-mabi=64
FAIL: go.test/test/nilptr.go execution,  -O2 -g

		=== go Summary for unix//-march=octeon+/-mabi=64 ===

# of expected passes		3291
# of unexpected failures	1
# of expected failures		4
# of untested testcases		6

Running target unix//-march=octeon+/-mabi=n32
FAIL: go.test/test/nilptr.go execution,  -O2 -g

		=== go Summary for unix//-march=octeon+/-mabi=n32 ===

# of expected passes		3291
# of unexpected failures	1
# of expected failures		4
# of untested testcases		6

Running target unix//-march=octeon2/-mabi=64
FAIL: go.test/test/nilptr.go execution,  -O2 -g

		=== go Summary for unix//-march=octeon2/-mabi=64 ===

# of expected passes		3291
# of unexpected failures	1
# of expected failures		4
# of untested testcases		6

Running target unix//-march=octeon2/-mabi=n32
FAIL: go.test/test/nilptr.go execution,  -O2 -g

		=== go Summary for unix//-march=octeon2/-mabi=n32 ===

# of expected passes		3291
# of unexpected failures	1
# of expected failures		4
# of untested testcases		6

		=== go Summary ===

# of expected passes		13164
# of unexpected failures	4
# of expected failures		16
# of untested testcases		24
/home/apinski/src/gcc-fsf/local/gcc/objdir/gcc/testsuite/go/../../gccgo
 version 4.8.0 20120501 (experimental) [trunk revision 187009] (GCC)

		=== libgo tests ===


Running target unix
FAIL: runtime
FAIL: net/http
FAIL: text/template

		=== libgo Summary for unix ===

# of expected passes		120
# of unexpected failures	3

Running target unix/-mabi=64
FAIL: net/http

		=== libgo Summary for unix/-mabi=64 ===

# of expected passes		122
# of unexpected failures	1

		=== libgo Summary ===

# of expected passes		242
# of unexpected failures	4
/home/apinski/src/gcc-fsf/local/gcc/objdir/./gcc/gccgo version 4.8.0
20120501 (experimental) [trunk revision 187009] (GCC)


Thanks,
Andrew Pinski

>
> Ian
>
Ian Lance Taylor May 1, 2012, 7:18 p.m. UTC | #2
Andrew Pinski <pinskia@gmail.com> writes:

> I tested the trunk after this patch on mips64-linux-gnu (with glibc
> 2.15) and the testsuite looks good.

Thanks for testing.

> FAIL: go.test/test/nilptr.go execution,  -O2 -g

The nilptr.go test is known to fail on various targets.  Search for
nilptr in gcc/testsuite/go.test/go-test.exp.  Probably we just need to
add mips64 there.

> 		=== libgo tests ===
>
>
> Running target unix
> FAIL: runtime
> FAIL: net/http
> FAIL: text/template
>
> 		=== libgo Summary for unix ===
>
> # of expected passes		120
> # of unexpected failures	3



> Running target unix/-mabi=64
> FAIL: net/http
>
> 		=== libgo Summary for unix/-mabi=64 ===
>
> # of expected passes		122
> # of unexpected failures	1


I don't know what is going on with these failures.

Ian
Andrew Pinski May 2, 2012, 6:24 a.m. UTC | #3
On Tue, May 1, 2012 at 12:18 PM, Ian Lance Taylor <iant@google.com> wrote:
> Andrew Pinski <pinskia@gmail.com> writes:
>
>> I tested the trunk after this patch on mips64-linux-gnu (with glibc
>> 2.15) and the testsuite looks good.
>
> Thanks for testing.
>
>> FAIL: go.test/test/nilptr.go execution,  -O2 -g
>
> The nilptr.go test is known to fail on various targets.  Search for
> nilptr in gcc/testsuite/go.test/go-test.exp.  Probably we just need to
> add mips64 there.
>
>>               === libgo tests ===
>>
>>
>> Running target unix
>> FAIL: runtime
>> FAIL: net/http
>> FAIL: text/template
>>
>>               === libgo Summary for unix ===
>>
>> # of expected passes          120
>> # of unexpected failures      3
>
>
>
>> Running target unix/-mabi=64
>> FAIL: net/http
>>
>>               === libgo Summary for unix/-mabi=64 ===
>>
>> # of expected passes          122
>> # of unexpected failures      1


n32 failures:

--- FAIL: runtime_test.TestGcSys (0.56 seconds)
        mfinal_test.go:35: used 4718592 extra bytes
        mfinal_test.go:37: using too much memory: 4718592 bytes
FAIL
FAIL: runtime
/home/apinski/src/gcc-fsf/local/gcc/libgo/testsuite/gotest: line 448:
gotest-timeout: No such file or directory
....
panic: test timed out
FAIL: net/http
......
--- FAIL: template.TestExecute (0.29 seconds)
        template.go:531: chained method: unexpected execute error:
template: chained method:1: nil pointer evaluating
*template.U.TrueFalse
        template.go:531: chained method on variable: unexpected
execute error: template: chained method on variable:1: nil pointer
evaluating *template.U.TrueFalse
        template.go:541: range count: expected
                        "[0]a[1]b[2]c[3]d[4]e"
                got
                        ""
FAIL
FAIL: text/template

n64:
panic: test timed out
FAIL: net/http
/home/apinski/src/gcc-fsf/local/gcc/libgo/testsuite/gotest: line 448:
gotest-timeout: No such file or directory



>
>
> I don't know what is going on with these failures.
>
> Ian
Ian Lance Taylor May 2, 2012, 1:17 p.m. UTC | #4
Andrew Pinski <pinskia@gmail.com> writes:

> n32 failures:
>
> --- FAIL: runtime_test.TestGcSys (0.56 seconds)
>         mfinal_test.go:35: used 4718592 extra bytes
>         mfinal_test.go:37: using too much memory: 4718592 bytes
> FAIL
> FAIL: runtime
> /home/apinski/src/gcc-fsf/local/gcc/libgo/testsuite/gotest: line 448:
> gotest-timeout: No such file or directory
> ....
> panic: test timed out
> FAIL: net/http
> ......
> --- FAIL: template.TestExecute (0.29 seconds)
>         template.go:531: chained method: unexpected execute error:
> template: chained method:1: nil pointer evaluating
> *template.U.TrueFalse
>         template.go:531: chained method on variable: unexpected
> execute error: template: chained method on variable:1: nil pointer
> evaluating *template.U.TrueFalse
>         template.go:541: range count: expected
>                         "[0]a[1]b[2]c[3]d[4]e"
>                 got
>                         ""
> FAIL
> FAIL: text/template
>
> n64:
> panic: test timed out
> FAIL: net/http
> /home/apinski/src/gcc-fsf/local/gcc/libgo/testsuite/gotest: line 448:
> gotest-timeout: No such file or directory


Thanks.  Unfortunately I can't see what is going wrong.

Ian
diff mbox

Patch

diff -r a5f055c95162 libgo/go/syscall/libcall_linux.go
--- a/libgo/go/syscall/libcall_linux.go	Fri Apr 27 21:56:09 2012 -0700
+++ b/libgo/go/syscall/libcall_linux.go	Mon Apr 30 08:54:38 2012 -0700
@@ -203,7 +203,11 @@ 
 		p = (*byte)(unsafe.Pointer(&_zero))
 	}
 	Entersyscall()
-	r1, _, errno := Syscall(SYS_GETDENTS64, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(len(buf)))
+	s := SYS_GETDENTS64
+	if s == 0 {
+		s = SYS_GETDENTS
+	}
+	r1, _, errno := Syscall(uintptr(s), uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(len(buf)))
 	n = int(r1)
 	if n < 0 {
 		err = errno
diff -r a5f055c95162 libgo/mksysinfo.sh
--- a/libgo/mksysinfo.sh	Fri Apr 27 21:56:09 2012 -0700
+++ b/libgo/mksysinfo.sh	Mon Apr 30 08:54:38 2012 -0700
@@ -224,6 +224,14 @@ 
     echo "const $sup = _$sys" >> ${OUT}
   done
 
+# The GNU/Linux support wants to use SYS_GETDENTS64 if available.
+if ! grep '^const SYS_GETDENTS ' ${OUT} >/dev/null 2>&1; then
+  echo "const SYS_GETDENTS = 0" >> ${OUT}
+fi
+if ! grep '^const SYS_GETDENTS64 ' ${OUT} >/dev/null 2>&1; then
+  echo "const SYS_GETDENTS64 = 0" >> ${OUT}
+fi
+
 # Stat constants.
 grep '^const _S_' gen-sysinfo.go | \
   sed -e 's/^\(const \)_\(S_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}