From de0f55dbb314264d7858a9d98c805285c62f5b6b Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 9 Sep 2019 20:08:32 +0000 Subject: [PATCH] libgo: only build x/sys/cpu/cpu_gccgo.c on x86 systems The C file has a build tag, but the procedure we use for building C files ignores build tags. This should fix the libgo build on non-x86 systems. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/194378 From-SVN: r275544 --- gcc/go/gofrontend/MERGE | 2 +- libgo/Makefile.am | 8 +++++++- libgo/Makefile.in | 23 +++++++++++++---------- libgo/configure | 19 +++++++++++++++++-- libgo/configure.ac | 2 ++ 5 files changed, 40 insertions(+), 14 deletions(-) diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 79349d792ee..c75e959ba19 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -17bef47f464983fd8513f88f3f159d28e2423e79 +03fa49394bb4b37453795bef3119e5b40c929aee The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/Makefile.am b/libgo/Makefile.am index 7bdfaa98513..5f7d0580e31 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -683,6 +683,12 @@ else syscall_lib_clone_lo = endif +if LIBGO_IS_X86 +golangorg_x_sys_cpu_gccgo_lo = golang.org/x/sys/cpu_gccgo.lo +else +golangorg_x_sys_cpu_gccgo_lo = +endif + PACKAGES = $(shell cat $(srcdir)/libgo-packages.txt) libgo_go_objs = \ @@ -700,7 +706,7 @@ libgo_go_objs = \ runtime/internal/atomic_c.lo \ sync/atomic_c.lo \ internal/cpu/cpu_gccgo.lo \ - golang.org/x/sys/cpu_gccgo.lo + $(golangorg_x_sys_cpu_gccgo_lo) libgo_ldflags = \ -version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS) diff --git a/libgo/Makefile.in b/libgo/Makefile.in index 751683887a3..69a8f7a052d 100644 --- a/libgo/Makefile.in +++ b/libgo/Makefile.in @@ -215,19 +215,20 @@ am_libgotool_a_OBJECTS = libgotool_a_OBJECTS = $(am_libgotool_a_OBJECTS) LTLIBRARIES = $(toolexeclib_LTLIBRARIES) @LIBGO_IS_LINUX_TRUE@am__DEPENDENCIES_1 = syscall/clone_linux.lo -am__DEPENDENCIES_2 = $(addsuffix .lo,$(PACKAGES)) \ +@LIBGO_IS_X86_TRUE@am__DEPENDENCIES_2 = golang.org/x/sys/cpu_gccgo.lo +am__DEPENDENCIES_3 = $(addsuffix .lo,$(PACKAGES)) \ internal/bytealg/bytealg.lo reflect/makefunc_ffi_c.lo \ $(am__DEPENDENCIES_1) syscall/errno.lo syscall/signame.lo \ syscall/wait.lo $(golangorg_x_net_lif_lo) \ $(golangorg_x_net_route_lo) log/syslog/syslog_c.lo \ runtime/internal/atomic_c.lo sync/atomic_c.lo \ - internal/cpu/cpu_gccgo.lo golang.org/x/sys/cpu_gccgo.lo -am__DEPENDENCIES_3 = -am__DEPENDENCIES_4 = $(am__DEPENDENCIES_2) \ - ../libbacktrace/libbacktrace.la $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_3) -libgo_llgo_la_DEPENDENCIES = $(am__DEPENDENCIES_4) + internal/cpu/cpu_gccgo.lo $(am__DEPENDENCIES_2) +am__DEPENDENCIES_4 = +am__DEPENDENCIES_5 = $(am__DEPENDENCIES_3) \ + ../libbacktrace/libbacktrace.la $(am__DEPENDENCIES_4) \ + $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_4) \ + $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_4) +libgo_llgo_la_DEPENDENCIES = $(am__DEPENDENCIES_5) @LIBGO_IS_RTEMS_TRUE@am__objects_1 = \ @LIBGO_IS_RTEMS_TRUE@ runtime/rtems-task-variable-add.lo am__objects_2 = runtime/aeshash.lo runtime/go-assert.lo \ @@ -254,7 +255,7 @@ libgo_llgo_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libgo_llgo_la_LDFLAGS) $(LDFLAGS) -o $@ @GOC_IS_LLGO_TRUE@am_libgo_llgo_la_rpath = -rpath $(toolexeclibdir) -libgo_la_DEPENDENCIES = $(am__DEPENDENCIES_4) +libgo_la_DEPENDENCIES = $(am__DEPENDENCIES_5) am_libgo_la_OBJECTS = $(am__objects_2) libgo_la_OBJECTS = $(am_libgo_la_OBJECTS) libgo_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ @@ -906,6 +907,8 @@ SYSINFO_FLAGS = \ @LIBGO_IS_LINUX_FALSE@syscall_lib_clone_lo = @LIBGO_IS_LINUX_TRUE@syscall_lib_clone_lo = syscall/clone_linux.lo +@LIBGO_IS_X86_FALSE@golangorg_x_sys_cpu_gccgo_lo = +@LIBGO_IS_X86_TRUE@golangorg_x_sys_cpu_gccgo_lo = golang.org/x/sys/cpu_gccgo.lo PACKAGES = $(shell cat $(srcdir)/libgo-packages.txt) libgo_go_objs = \ $(addsuffix .lo,$(PACKAGES)) \ @@ -922,7 +925,7 @@ libgo_go_objs = \ runtime/internal/atomic_c.lo \ sync/atomic_c.lo \ internal/cpu/cpu_gccgo.lo \ - golang.org/x/sys/cpu_gccgo.lo + $(golangorg_x_sys_cpu_gccgo_lo) libgo_ldflags = \ -version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS) diff --git a/libgo/configure b/libgo/configure index ebdffa88437..09c89dfe070 100755 --- a/libgo/configure +++ b/libgo/configure @@ -662,6 +662,8 @@ GO_SYSCALL_OS_FILE GO_LIBCALL_OS_ARCH_FILE GO_LIBCALL_OS_FILE FUNCTION_DESCRIPTORS +LIBGO_IS_X86_FALSE +LIBGO_IS_X86_TRUE ALLGOARCHFAMILY ALLGOARCH GOARCH @@ -11484,7 +11486,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11487 "configure" +#line 11489 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11590,7 +11592,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11593 "configure" +#line 11595 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -14229,6 +14231,15 @@ esac + if test "$GOARCH" = "386" -o "$GOARCH" = "amd64" -o "$GOARCH" = "amd64p32"; then + LIBGO_IS_X86_TRUE= + LIBGO_IS_X86_FALSE='#' +else + LIBGO_IS_X86_TRUE='#' + LIBGO_IS_X86_FALSE= +fi + + FUNCTION_DESCRIPTORS=false case ${host} in rs6000*-*-* | powerpc*-*-*) @@ -16038,6 +16049,10 @@ if test -z "${LIBGO_IS_BSD_TRUE}" && test -z "${LIBGO_IS_BSD_FALSE}"; then as_fn_error $? "conditional \"LIBGO_IS_BSD\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${LIBGO_IS_X86_TRUE}" && test -z "${LIBGO_IS_X86_FALSE}"; then + as_fn_error $? "conditional \"LIBGO_IS_X86\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${USING_SPLIT_STACK_TRUE}" && test -z "${USING_SPLIT_STACK_FALSE}"; then as_fn_error $? "conditional \"USING_SPLIT_STACK\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/libgo/configure.ac b/libgo/configure.ac index 8a0a04f77ab..de364afd0fe 100644 --- a/libgo/configure.ac +++ b/libgo/configure.ac @@ -354,6 +354,8 @@ AC_SUBST(GOARCH) AC_SUBST(ALLGOARCH) AC_SUBST(ALLGOARCHFAMILY) +AM_CONDITIONAL(LIBGO_IS_X86, test "$GOARCH" = "386" -o "$GOARCH" = "amd64" -o "$GOARCH" = "amd64p32") + FUNCTION_DESCRIPTORS=false case ${host} in rs6000*-*-* | powerpc*-*-*) -- 2.30.2