This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

libgo patch committed: Fix build on MIPS GNU/Linux


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

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}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]