PR 65616 points out that you can't use gccgo to build a PIE because
go-main.c is not compiled with -fPIC. This patch fixes that. I could
have used -fPIE, but -fPIC is essentially the same here and seems more
flexible. Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu. Committed to mainline and GCC 5 branch.
Ian
diff -r c713e818f342 libgo/Makefile.am
--- a/libgo/Makefile.am Fri Apr 17 14:58:05 2015 -0700
+++ b/libgo/Makefile.am Fri Apr 24 09:40:23 2015 -0700
@@ -2032,6 +2032,10 @@
libgobegin_llgo_a_SOURCES = \
runtime/go-main.c
+# Use -fPIC for libgobegin so that it can be put in a PIE.
+libgobegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
+libgobegin_llgo_a_CFLAGS = $(AM_CFLAGS) -fPIC
+
libnetgo_a_SOURCES = $(go_netgo_files)
libnetgo_a_LIBADD = netgo.o