syscall: always define _AT_FDCWD and IPv6MTUInfo

They aren't defined by old versions of glibc, but are required by the
code in syscall_linux.go.

Fixes https://gcc.gnu.org/PR88060

Change-Id: Id894b306b7cf7c6e352a068ae0856b638799e049
Reviewed-on: https://go-review.googlesource.com/c/150697
Reviewed-by: Cherry Zhang <cherryyz@google.com>
diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh
index 2fa7aff..d4286dc 100755
--- a/libgo/mksysinfo.sh
+++ b/libgo/mksysinfo.sh
@@ -202,6 +202,11 @@
   fi
 fi
 
+# The syscall package requires _AT_FDCWD, but doesn't export it.
+if ! grep '^const _AT_FDCWD = ' ${OUT} >/dev/null 2>&1; then
+  echo "const _AT_FDCWD = -100" >> ${OUT}
+fi
+
 # sysconf constants.
 grep '^const __SC' gen-sysinfo.go |
   sed -e 's/^\(const \)__\(SC[^= ]*\)\(.*\)$/\1\2 = __\2/' >> ${OUT}
@@ -669,6 +674,14 @@
       -e 's/ip6m_mtu/Mtu/' \
     >> ${OUT}
 
+# We need IPv6MTUInfo to compile the syscall package.
+if ! grep 'type IPv6MTUInfo ' ${OUT} >/dev/null 2>&1; then
+  echo 'type IPv6MTUInfo struct { Addr RawSockaddrInet6; Mtu uint32; }' >> ${OUT}
+fi
+if ! grep 'const _sizeof_ip6_mtuinfo = ' ${OUT} >/dev/null 2>&1; then
+  echo 'const SizeofIPv6MTUInfo = 32' >> ${OUT}
+fi
+
 # Try to guess the type to use for fd_set.
 fd_set=`grep '^type _fd_set ' gen-sysinfo.go || true`
 fds_bits_type="_C_long"