diff mbox

[gofrontend-dev] *-rtems Compilation Failures Advice Wanted

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

Commit Message

Ian Lance Taylor Dec. 13, 2011, 10:25 p.m. UTC
Joel Sherrill <joel.sherrill@oarcorp.com> writes:

> RTEMS does not currently have IPv6.
>
> /users/joel/test-gcc/gcc-svn/libgo/go/syscall/socket.go:299:51: error:
> use of undefined type 'IPv6Mreq'

This patch is intended to fix this problem.  Bootstrapped on
x86_64-unknown-linux-gnu, which proves little since the code is not
exercised.  Committed to mainline.

Ian
diff mbox

Patch

diff -r f332ea69a151 libgo/mksysinfo.sh
--- a/libgo/mksysinfo.sh	Tue Dec 13 14:07:07 2011 -0800
+++ b/libgo/mksysinfo.sh	Tue Dec 13 14:23:23 2011 -0800
@@ -183,10 +183,12 @@ 
 grep '^const _SHUT_' gen-sysinfo.go |
   sed -e 's/^\(const \)_\(SHUT[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
 
-# The net package requires a definition for IPV6ONLY.
-if ! grep '^const IPV6_V6ONLY ' ${OUT} >/dev/null 2>&1; then
-  echo "const IPV6_V6ONLY = 0" >> ${OUT}
-fi
+# The net package requires some const definitions.
+for m in IPV6_V6ONLY IPPROTO_IPV6 IPV6_JOIN_GROUP IPV6_LEAVE_GROUP; do
+  if ! grep "^const $m " ${OUT} >/dev/null 2>&1; then
+    echo "const $m = 0" >> ${OUT}
+  fi
+done
 
 # pathconf constants.
 grep '^const __PC' gen-sysinfo.go |
@@ -474,10 +476,13 @@ 
       -e 's/_in_addr/[4]byte/g' \
     >> ${OUT}
 
+# We need IPMreq to compile the net package.
+if ! grep 'type IPMreq ' ${OUT} >/dev/null 2>&1; then
+  echo 'type IPMreq struct { Multiaddr [4]byte; Interface [4]byte; }' >> ${OUT}
+fi
+
 # The size of the ip_mreq struct.
-if grep 'type IPMreq ' ${OUT} > /dev/null 2>&1; then
-  echo 'var SizeofIPMreq = int(unsafe.Sizeof(IPMreq{}))' >> ${OUT}
-fi
+echo 'var SizeofIPMreq = int(unsafe.Sizeof(IPMreq{}))' >> ${OUT}
 
 # The ipv6_mreq struct.
 grep '^type _ipv6_mreq ' gen-sysinfo.go | \
@@ -487,6 +492,11 @@ 
       -e 's/_in6_addr/[16]byte/' \
     >> ${OUT}
 
+# We need IPv6Mreq to compile the net package.
+if ! grep 'type IPv6Mreq ' ${OUT} >/dev/null 2>&1; then
+  echo 'type IPv6Mreq struct { Multiaddr [16]byte; Interface uint32; }' >> ${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"