libgo: fix go_export extraction on Darwin
On Darwin, the section name is prefixed with the segment name, __GNU_GO.
Change-Id: I395a47d9922248ad19bda668946decb62435d3d8
Reviewed-on: https://go-review.googlesource.com/c/151097
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
index aeaa203..1201cf5 100644
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -13,6 +13,12 @@
subdirs = testsuite
endif
+if LIBGO_IS_DARWIN
+GO_EXPORT_SECTION_NAME = __GNU_GO.__go_export
+else
+GO_EXPORT_SECTION_NAME = .go_export
+endif
+
SUBDIRS = ${subdirs}
gcc_version := $(shell $(GOC) -dumpversion)
@@ -818,7 +824,7 @@
if test ! -f $$f; then \
f="$(basename $(<D)/.libs/$(<F)).o"; \
fi; \
- $(OBJCOPY) -j .go_export $$f $@.tmp; \
+ $(OBJCOPY) -j $(GO_EXPORT_SECTION_NAME) $$f $@.tmp; \
$(SHELL) $(srcdir)/mvifdiff.sh $@.tmp `echo $@ | sed -e 's/s-gox/gox/'`
GOTESTFLAGS =
diff --git a/libgo/Makefile.in b/libgo/Makefile.in
index 7f39891..346683b 100644
--- a/libgo/Makefile.in
+++ b/libgo/Makefile.in
@@ -529,6 +529,8 @@
# Go support.
SUFFIXES = .c .go .gox .o .obj .lo .a
@LIBGO_IS_RTEMS_TRUE@subdirs = testsuite
+@LIBGO_IS_DARWIN_FALSE@GO_EXPORT_SECTION_NAME = .go_export
+@LIBGO_IS_DARWIN_TRUE@GO_EXPORT_SECTION_NAME = __GNU_GO.__go_export
SUBDIRS = ${subdirs}
gcc_version := $(shell $(GOC) -dumpversion)
MAINT_CHARSET = latin1
@@ -1001,7 +1003,7 @@
if test ! -f $$f; then \
f="$(basename $(<D)/.libs/$(<F)).o"; \
fi; \
- $(OBJCOPY) -j .go_export $$f $@.tmp; \
+ $(OBJCOPY) -j $(GO_EXPORT_SECTION_NAME) $$f $@.tmp; \
$(SHELL) $(srcdir)/mvifdiff.sh $@.tmp `echo $@ | sed -e 's/s-gox/gox/'`
GOTESTFLAGS =