From d40d77c4b8e84ab22bb631c5cced89b10ce3a84c Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Thu, 25 Apr 2019 06:18:22 +0000 Subject: system/gcc: fix more GCC Go bugs --- system/gcc/339-gccgo-errstr.patch | 45 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 system/gcc/339-gccgo-errstr.patch (limited to 'system/gcc/339-gccgo-errstr.patch') diff --git a/system/gcc/339-gccgo-errstr.patch b/system/gcc/339-gccgo-errstr.patch new file mode 100644 index 000000000..f78d18aa4 --- /dev/null +++ b/system/gcc/339-gccgo-errstr.patch @@ -0,0 +1,45 @@ +--- gcc-8.3.0/libgo/go/syscall/errstr_linux.go 2016-08-06 00:36:33.000000000 +0000 ++++ /dev/null 2019-04-08 15:05:18.560000000 +0000 +@@ -1,31 +0,0 @@ +-// errstr_linux.go -- GNU/Linux specific error strings. +- +-// Copyright 2010 The Go Authors. All rights reserved. +-// Use of this source code is governed by a BSD-style +-// license that can be found in the LICENSE file. +- +-// We use this rather than errstr.go because on GNU/Linux sterror_r +-// returns a pointer to the error message, and may not use buf at all. +- +-package syscall +- +-import "unsafe" +- +-//sysnb strerror_r(errnum int, b []byte) (errstr *byte) +-//strerror_r(errnum _C_int, b *byte, len Size_t) *byte +- +-func Errstr(errnum int) string { +- a := make([]byte, 128) +- p := strerror_r(errnum, a) +- b := (*[1000]byte)(unsafe.Pointer(p)) +- i := 0 +- for b[i] != 0 { +- i++ +- } +- // Lowercase first letter: Bad -> bad, but STREAM -> STREAM. +- if i > 1 && 'A' <= b[0] && b[0] <= 'Z' && 'a' <= b[1] && b[1] <= 'z' { +- c := b[0] + 'a' - 'A' +- return string(c) + string(b[1:i]) +- } +- return string(b[:i]) +-} +--- gcc-8.3.0/libgo/go/syscall/errstr.go.old 2016-08-06 00:36:33.000000000 +0000 ++++ gcc-8.3.0/libgo/go/syscall/errstr.go 2019-04-25 05:41:27.915806277 +0000 +@@ -4,8 +4,6 @@ + // Use of this source code is governed by a BSD-style + // license that can be found in the LICENSE file. + +-// +build !linux +- + package syscall + + //sysnb strerror_r(errnum int, buf []byte) (err Errno) -- cgit v1.2.3-60-g2f50