libgo-fix-arm.diff: Work around parse error of struct timex_ on ARM (both trunk
and 4.7 branch).
libgo-hardening.diff: Avoid compiler warnings in libgo with -D_FORTIFY_SOURCE=2,
which let the build fail with -Werror. first chunk for the trunk and 4.7, second
chunk for trunk only.
libgo-mksysinfo.diff: Fix TIOCNOTTY and TIOCSCTTY definitions, afaicr needed for
ARM as well. for trunk and 4.7.
I did sign the contributors agreement at
http://golang.org/doc/contribute.html#copyright, however I didn't get any
feedback or acknowledgement yet.
Matthias
# DP: libgo: Work around parse error of struct timex_ on ARM
Index: b/src/libgo/mksysinfo.sh
===================================================================
--- a/src/libgo/mksysinfo.sh
+++ b/src/libgo/mksysinfo.sh
@@ -173,6 +173,9 @@
${CC} -fdump-go-spec=gen-sysinfo.go -std=gnu99 -S -o sysinfo.s sysinfo.c
+# ARM
+sed -i '/type _timex/s/INVALID-bit-field/int32/g;/type _timex/s,^// ,,' gen-sysinfo.go
+
echo 'package syscall' > ${OUT}
echo 'import "unsafe"' >> ${OUT}
echo 'type _ unsafe.Pointer' >> ${OUT}
# DP: Avoid compiler warnings in libgo with -D_FORTIFY_SOURCE=2
Index: b/src/libgo/runtime/print.c
===================================================================
--- a/src/libgo/runtime/print.c
+++ b/src/libgo/runtime/print.c
@@ -18,7 +18,7 @@
G* g = runtime_g();
if(g == nil || g->writebuf == nil) {
- runtime_write(2, v, n);
+ ssize_t rv __attribute((unused)) = runtime_write(2, v, n);
return;
}
# DP: Fix build failure in libgo with -Werror -D_FORTIFY_SOURCE=2
--- a/src/libgo/runtime/go-signal.c
+++ b/src/libgo/runtime/go-signal.c
@@ -144,10 +144,12 @@
static void
runtime_badsignal(int32 sig)
{
+ ssize_t rv __attribute__((unused));
+
if (sig == SIGPROF) {
return; // Ignore SIGPROFs intended for a non-Go thread.
}
- runtime_write(2, badsignal, sizeof badsignal - 1);
+ rv = runtime_write(2, badsignal, sizeof badsignal - 1);
runtime_exit(1);
}
# DP: libgo: Fix TIOCNOTTY and TIOCSCTTY definitions
Index: b/src/libgo/mksysinfo.sh
===================================================================
--- a/src/libgo/mksysinfo.sh
+++ b/src/libgo/mksysinfo.sh
@@ -168,6 +168,12 @@
#ifdef TIOCGWINSZ
TIOCGWINSZ_val = TIOCGWINSZ,
#endif
+#ifdef TIOCNOTTY
+ TIOCNOTTY_val = TIOCNOTTY,
+#endif
+#ifdef TIOCSCTTY
+ TIOCSCTTY_val = TIOCSCTTY,
+#endif
};
EOF
@@ -728,6 +734,16 @@
echo 'const TIOCGWINSZ = _TIOCGWINSZ_val' >> ${OUT}
fi
fi
+if ! grep '^const TIOCNOTTY' ${OUT} >/dev/null 2>&1; then
+ if grep '^const _TIOCNOTTY_val' ${OUT} >/dev/null 2>&1; then
+ echo 'const TIOCNOTTY = _TIOCNOTTY_val' >> ${OUT}
+ fi
+fi
+if ! grep '^const TIOCSCTTY' ${OUT} >/dev/null 2>&1; then
+ if grep '^const _TIOCSCTTY_val' ${OUT} >/dev/null 2>&1; then
+ echo 'const TIOCSCTTY = _TIOCSCTTY_val' >> ${OUT}
+ fi
+fi
# The ioctl flags for terminal control
grep '^const _TC[GS]ET' gen-sysinfo.go | \