libgo: adapt runtime.inc to AIX

* Two AIX types are wrongfully exported to runtime.inc as their names
  make them look like a Go type.
* The sigset go type conflicts with a system sigset type.

Issue golang/go#19200

Change-Id: I235cb81e49c8f1e4d8e2396cd03b399572f02a61
Reviewed-on: https://go-review.googlesource.com/38192
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
index 47b2429..e941230 100644
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -572,6 +572,9 @@
 	$(SHELL) $(srcdir)/mvifdiff.sh tmp-sigtab.go sigtab.go
 	$(STAMP) $@
 
+# _Complex_lock and _Reader_lock are Go translations of some AIX system
+# types and should not be exported back to C
+# sigset conflicts with system type sigset on AIX, so we need to rename it
 runtime.inc: s-runtime-inc; @true
 s-runtime-inc: runtime.lo Makefile
 	rm -f runtime.inc.tmp2
@@ -579,7 +582,12 @@
 	for pattern in '_[GP][a-z]' _Max _Lock _Sig _Trace _MHeap _Num; do \
 	  grep "#define $$pattern" runtime.inc.tmp >> runtime.inc.tmp2; \
 	done
-	$(SHELL) $(srcdir)/mvifdiff.sh runtime.inc.tmp2 runtime.inc
+	for TYPE in _Complex_lock _Reader_lock; do \
+	  sed -e '/struct '$${TYPE}' {/,/^}/s/^.*$$//' runtime.inc.tmp2 > runtime.inc.tmp3; \
+	  mv runtime.inc.tmp3 runtime.inc.tmp2; \
+	done
+	sed -e 's/sigset/sigset_go/' runtime.inc.tmp2 > runtime.inc.tmp3
+	$(SHELL) $(srcdir)/mvifdiff.sh runtime.inc.tmp3 runtime.inc
 	$(STAMP) $@
 
 noinst_DATA = zstdpkglist.go