runtime/internal/sys: new package, API copied from Go 1.7

Copy over the Go 1.7 runtime/internal/sys package, but instead of having
    separate files for each GOARCH and GOOS value, set the values in
    configure.ac and write them out in Makefile.am.  Setting the values in
    configure.ac should make it easier to add new processors.
    
    Remove the automake GOARCH conditionals, which are no longer used.
    Leave the GOOS conditionals for now, as they are used for the C runtime
    package.
    
    Reviewed-on: https://go-review.googlesource.com/29018

From-SVN: r240083
This commit is contained in:
Ian Lance Taylor 2016-09-11 13:23:27 +00:00 committed by Ian Lance Taylor
parent a1cd04ace8
commit a846424359
13 changed files with 593 additions and 417 deletions

View File

@ -1,3 +1,8 @@
2016-09-11 Ian Lance Taylor <iant@golang.org>
* go-gcc.cc (Gcc_backend::Gcc_backend): Add builtin versions of
ctz, ctzll, bswap32, bswap64.
2016-09-10 Ian Lance Taylor <iant@golang.org>
* go-backend.c (go_trampoline_info): Remove.

View File

@ -692,6 +692,28 @@ Gcc_backend::Gcc_backend()
NULL_TREE),
false, false);
// Used by runtime/internal/sys.
this->define_builtin(BUILT_IN_CTZ, "__builtin_ctz", "ctz",
build_function_type_list(integer_type_node,
unsigned_type_node,
NULL_TREE),
true, false);
this->define_builtin(BUILT_IN_CTZLL, "__builtin_ctzll", "ctzll",
build_function_type_list(integer_type_node,
long_long_unsigned_type_node,
NULL_TREE),
true, false);
this->define_builtin(BUILT_IN_BSWAP32, "__builtin_bswap32", "bswap32",
build_function_type_list(uint32_type_node,
uint32_type_node,
NULL_TREE),
true, false);
this->define_builtin(BUILT_IN_BSWAP64, "__builtin_bswap64", "bswap64",
build_function_type_list(uint64_type_node,
uint64_type_node,
NULL_TREE),
true, false);
// We provide some functions for the math library.
tree math_function_type = build_function_type_list(double_type_node,
double_type_node,

View File

@ -1,4 +1,4 @@
d3a145b111a4f4ea772b812c6a0b3a853c207819
841bea960b1f097e2cff5ad2618800296dcd4ec2
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.

View File

@ -586,12 +586,54 @@ time.c: $(srcdir)/runtime/time.goc goc2c
version.go: s-version; @true
s-version: Makefile
rm -f version.go.tmp
echo "package runtime" > version.go.tmp
echo 'const defaultGoroot = "$(prefix)"' >> version.go.tmp
echo 'const theVersion = "'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'"' >> version.go.tmp
echo 'const theGoarch = "'$(GOARCH)'"' >> version.go.tmp
echo 'const theGoos = "'$(GOOS)'"' >> version.go.tmp
echo 'const theGccgoToolDir = "$(libexecsubdir)"' >> version.go.tmp
echo "package sys" > version.go.tmp
echo 'const DefaultGoroot = "$(prefix)"' >> version.go.tmp
echo 'const TheVersion = "'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'"' >> version.go.tmp
echo 'const GOARCH = "'$(GOARCH)'"' >> version.go.tmp
echo 'const GOOS = "'$(GOOS)'"' >> version.go.tmp
echo 'const GccgoToolDir = "$(libexecsubdir)"' >> version.go.tmp
echo >> version.go.tmp
echo "type ArchFamilyType int" >> version.go.tmp
echo >> version.go.tmp
echo "const (" >> version.go.tmp
echo " UNKNOWN ArchFamilyType = iota" >> version.go.tmp
for a in $(ALLGOARCHFAMILY); do \
echo " $${a}" >> version.go.tmp; \
done
echo ")" >> version.go.tmp
echo >> version.go.tmp
for a in $(ALLGOARCH); do \
f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
n="$${f}`echo $${a} | sed -e 's/.//'`"; \
if test "$${a}" = "$(GOARCH)"; then \
echo "const Goarch$${n} = 1" >> version.go.tmp; \
else \
echo "const Goarch$${n} = 0" >> version.go.tmp; \
fi; \
done
echo >> version.go.tmp
echo "const (" >> version.go.tmp
echo " ArchFamily = $(GOARCH_FAMILY)" >> version.go.tmp
echo " BigEndian = $(GOARCH_BIGENDIAN)" >> version.go.tmp
echo " CacheLineSize = $(GOARCH_CACHELINESIZE)" >> version.go.tmp
echo " PhysPageSize = $(GOARCH_PHYSPAGESIZE)" >> version.go.tmp
echo " PCQuantum = $(GOARCH_PCQUANTUM)" >> version.go.tmp
echo " Int64Align = $(GOARCH_INT64ALIGN)" >> version.go.tmp
echo " HugePageSize = $(GOARCH_HUGEPAGESIZE)" >> version.go.tmp
echo " MinFrameSize = $(GOARCH_MINFRAMESIZE)" >> version.go.tmp
echo ")" >> version.go.tmp
echo >> version.go.tmp
for a in $(ALLGOOS); do \
f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
n="$${f}`echo $${a} | sed -e 's/.//'`"; \
if test "$${a}" = "$(GOOS)"; then \
echo "const Goos$${n} = 1" >> version.go.tmp; \
else \
echo "const Goos$${n} = 0" >> version.go.tmp; \
fi; \
done
echo >> version.go.tmp
echo "type Uintreg uintptr" >> version.go.tmp
$(SHELL) $(srcdir)/mvifdiff.sh version.go.tmp version.go
$(STAMP) $@
@ -845,6 +887,7 @@ libgo_go_objs = \
runtime/pprof.lo \
runtime/internal/atomic.lo \
runtime/internal/atomic_c.lo \
runtime/internal/sys.lo \
sync/atomic.lo \
sync/atomic_c.lo \
text/scanner.lo \
@ -1224,7 +1267,7 @@ regexp/check: $(CHECK_DEPS)
@$(CHECK)
.PHONY: regexp/check
extra_go_files_runtime = runtime_sysinfo.go version.go
extra_go_files_runtime = runtime_sysinfo.go
@go_include@ runtime-go.lo.dep
runtime-go.lo.dep: $(srcdir)/go/runtime/*.go $(extra_go_files_runtime)
@ -2379,6 +2422,18 @@ runtime/internal/atomic/check: $(CHECK_DEPS)
@$(CHECK)
.PHONY: runtime/internal/atomic/check
extra_go_files_runtime_internal_sys = version.go
@go_include@ runtime/internal/sys.lo.dep
runtime/internal/sys.lo.dep: $(srcdir)/go/runtime/internal/sys/*.go
$(BUILDDEPS)
runtime_internal_sys_lo_GOCFLAGS = -fgo-compiling-runtime
runtime/internal/sys.lo:
$(BUILDPACKAGE)
runtime/internal/sys/check: $(CHECK_DEPS)
@$(CHECK)
.PHONY: runtime/internal/sys/check
@go_include@ sync/atomic.lo.dep
sync/atomic.lo.dep: $(srcdir)/go/sync/atomic/*.go
$(BUILDDEPS)
@ -2816,6 +2871,8 @@ runtime/pprof.gox: runtime/pprof.lo
$(BUILDGOX)
runtime/internal/atomic.gox: runtime/internal/atomic.lo
$(BUILDGOX)
runtime/internal/sys.gox: runtime/internal/sys.lo
$(BUILDGOX)
sync/atomic.gox: sync/atomic.lo
$(BUILDGOX)
@ -2971,6 +3028,7 @@ TEST_PACKAGES = \
regexp/syntax/check \
runtime/pprof/check \
runtime/internal/atomic/check \
runtime/internal/sys/check \
sync/atomic/check \
text/scanner/check \
text/tabwriter/check \

View File

@ -213,10 +213,10 @@ am__DEPENDENCIES_1 = bufio.lo bytes.lo bytes/index.lo context.lo \
os/user.lo path/filepath.lo regexp/syntax.lo \
net/rpc/jsonrpc.lo runtime/debug.lo runtime/pprof.lo \
runtime/internal/atomic.lo runtime/internal/atomic_c.lo \
sync/atomic.lo sync/atomic_c.lo text/scanner.lo \
text/tabwriter.lo text/template.lo text/template/parse.lo \
testing/iotest.lo testing/quick.lo unicode/utf16.lo \
unicode/utf8.lo
runtime/internal/sys.lo sync/atomic.lo sync/atomic_c.lo \
text/scanner.lo text/tabwriter.lo text/template.lo \
text/template/parse.lo testing/iotest.lo testing/quick.lo \
unicode/utf16.lo unicode/utf8.lo
am__DEPENDENCIES_2 =
am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1) \
../libbacktrace/libbacktrace.la $(am__DEPENDENCIES_2) \
@ -341,6 +341,9 @@ ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = testsuite
ACLOCAL = @ACLOCAL@
ALLGOARCH = @ALLGOARCH@
ALLGOARCHFAMILY = @ALLGOARCHFAMILY@
ALLGOOS = @ALLGOOS@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
@ -365,6 +368,14 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GOARCH = @GOARCH@
GOARCH_BIGENDIAN = @GOARCH_BIGENDIAN@
GOARCH_CACHELINESIZE = @GOARCH_CACHELINESIZE@
GOARCH_FAMILY = @GOARCH_FAMILY@
GOARCH_HUGEPAGESIZE = @GOARCH_HUGEPAGESIZE@
GOARCH_INT64ALIGN = @GOARCH_INT64ALIGN@
GOARCH_MINFRAMESIZE = @GOARCH_MINFRAMESIZE@
GOARCH_PCQUANTUM = @GOARCH_PCQUANTUM@
GOARCH_PHYSPAGESIZE = @GOARCH_PHYSPAGESIZE@
GOC = @GOC@
GOCFLAGS = $(CFLAGS)
GOOS = @GOOS@
@ -1099,6 +1110,7 @@ libgo_go_objs = \
runtime/pprof.lo \
runtime/internal/atomic.lo \
runtime/internal/atomic_c.lo \
runtime/internal/sys.lo \
sync/atomic.lo \
sync/atomic_c.lo \
text/scanner.lo \
@ -1238,7 +1250,7 @@ CHECK_DEPS = $(toolexeclibgo_DATA) $(toolexeclibgoarchive_DATA) \
@HAVE_STAT_TIMESPEC_FALSE@@LIBGO_IS_SOLARIS_TRUE@matchargs_os =
@HAVE_STAT_TIMESPEC_TRUE@@LIBGO_IS_SOLARIS_TRUE@matchargs_os = --tag=solaristag
@LIBGO_IS_SOLARIS_FALSE@matchargs_os =
extra_go_files_runtime = runtime_sysinfo.go version.go
extra_go_files_runtime = runtime_sysinfo.go
runtime_go_lo_GOCFLAGS = -fgo-c-header=runtime.inc.tmp -fgo-compiling-runtime
@LIBGO_IS_BSD_TRUE@golang_org_x_net_route_lo = \
@LIBGO_IS_BSD_TRUE@ golang_org/x/net/route/route.lo
@ -1251,6 +1263,8 @@ runtime_go_lo_GOCFLAGS = -fgo-c-header=runtime.inc.tmp -fgo-compiling-runtime
# Also use -fno-inline to get better results from the memory profiler.
runtime_pprof_check_GOCFLAGS = -static-libgo -fno-inline
runtime_internal_atomic_lo_GOCFLAGS = -fgo-compiling-runtime
extra_go_files_runtime_internal_sys = version.go
runtime_internal_sys_lo_GOCFLAGS = -fgo-compiling-runtime
# How to build a .gox file from a .lo file.
BUILDGOX = \
@ -1389,6 +1403,7 @@ TEST_PACKAGES = \
regexp/syntax/check \
runtime/pprof/check \
runtime/internal/atomic/check \
runtime/internal/sys/check \
sync/atomic/check \
text/scanner/check \
text/tabwriter/check \
@ -3567,12 +3582,54 @@ time.c: $(srcdir)/runtime/time.goc goc2c
version.go: s-version; @true
s-version: Makefile
rm -f version.go.tmp
echo "package runtime" > version.go.tmp
echo 'const defaultGoroot = "$(prefix)"' >> version.go.tmp
echo 'const theVersion = "'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'"' >> version.go.tmp
echo 'const theGoarch = "'$(GOARCH)'"' >> version.go.tmp
echo 'const theGoos = "'$(GOOS)'"' >> version.go.tmp
echo 'const theGccgoToolDir = "$(libexecsubdir)"' >> version.go.tmp
echo "package sys" > version.go.tmp
echo 'const DefaultGoroot = "$(prefix)"' >> version.go.tmp
echo 'const TheVersion = "'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'"' >> version.go.tmp
echo 'const GOARCH = "'$(GOARCH)'"' >> version.go.tmp
echo 'const GOOS = "'$(GOOS)'"' >> version.go.tmp
echo 'const GccgoToolDir = "$(libexecsubdir)"' >> version.go.tmp
echo >> version.go.tmp
echo "type ArchFamilyType int" >> version.go.tmp
echo >> version.go.tmp
echo "const (" >> version.go.tmp
echo " UNKNOWN ArchFamilyType = iota" >> version.go.tmp
for a in $(ALLGOARCHFAMILY); do \
echo " $${a}" >> version.go.tmp; \
done
echo ")" >> version.go.tmp
echo >> version.go.tmp
for a in $(ALLGOARCH); do \
f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
n="$${f}`echo $${a} | sed -e 's/.//'`"; \
if test "$${a}" = "$(GOARCH)"; then \
echo "const Goarch$${n} = 1" >> version.go.tmp; \
else \
echo "const Goarch$${n} = 0" >> version.go.tmp; \
fi; \
done
echo >> version.go.tmp
echo "const (" >> version.go.tmp
echo " ArchFamily = $(GOARCH_FAMILY)" >> version.go.tmp
echo " BigEndian = $(GOARCH_BIGENDIAN)" >> version.go.tmp
echo " CacheLineSize = $(GOARCH_CACHELINESIZE)" >> version.go.tmp
echo " PhysPageSize = $(GOARCH_PHYSPAGESIZE)" >> version.go.tmp
echo " PCQuantum = $(GOARCH_PCQUANTUM)" >> version.go.tmp
echo " Int64Align = $(GOARCH_INT64ALIGN)" >> version.go.tmp
echo " HugePageSize = $(GOARCH_HUGEPAGESIZE)" >> version.go.tmp
echo " MinFrameSize = $(GOARCH_MINFRAMESIZE)" >> version.go.tmp
echo ")" >> version.go.tmp
echo >> version.go.tmp
for a in $(ALLGOOS); do \
f=`echo $${a} | sed -e 's/\(.\).*/\1/' -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
n="$${f}`echo $${a} | sed -e 's/.//'`"; \
if test "$${a}" = "$(GOOS)"; then \
echo "const Goos$${n} = 1" >> version.go.tmp; \
else \
echo "const Goos$${n} = 0" >> version.go.tmp; \
fi; \
done
echo >> version.go.tmp
echo "type Uintreg uintptr" >> version.go.tmp
$(SHELL) $(srcdir)/mvifdiff.sh version.go.tmp version.go
$(STAMP) $@
@ -5003,6 +5060,15 @@ runtime/internal/atomic/check: $(CHECK_DEPS)
@$(CHECK)
.PHONY: runtime/internal/atomic/check
@go_include@ runtime/internal/sys.lo.dep
runtime/internal/sys.lo.dep: $(srcdir)/go/runtime/internal/sys/*.go
$(BUILDDEPS)
runtime/internal/sys.lo:
$(BUILDPACKAGE)
runtime/internal/sys/check: $(CHECK_DEPS)
@$(CHECK)
.PHONY: runtime/internal/sys/check
@go_include@ sync/atomic.lo.dep
sync/atomic.lo.dep: $(srcdir)/go/sync/atomic/*.go
$(BUILDDEPS)
@ -5433,6 +5499,8 @@ runtime/pprof.gox: runtime/pprof.lo
$(BUILDGOX)
runtime/internal/atomic.gox: runtime/internal/atomic.lo
$(BUILDGOX)
runtime/internal/sys.gox: runtime/internal/sys.lo
$(BUILDGOX)
sync/atomic.gox: sync/atomic.lo
$(BUILDGOX)

449
libgo/configure vendored
View File

@ -629,48 +629,19 @@ GO_SYSCALL_OS_ARCH_FILE
GO_SYSCALL_OS_FILE
GO_LIBCALL_OS_ARCH_FILE
GO_LIBCALL_OS_FILE
ALLGOARCHFAMILY
ALLGOARCH
GOARCH_MINFRAMESIZE
GOARCH_HUGEPAGESIZE
GOARCH_INT64ALIGN
GOARCH_PCQUANTUM
GOARCH_PHYSPAGESIZE
GOARCH_CACHELINESIZE
GOARCH_BIGENDIAN
GOARCH_FAMILY
GOARCH
LIBGO_IS_X86_64_FALSE
LIBGO_IS_X86_64_TRUE
LIBGO_IS_SPARC64_FALSE
LIBGO_IS_SPARC64_TRUE
LIBGO_IS_SPARC_FALSE
LIBGO_IS_SPARC_TRUE
LIBGO_IS_S390X_FALSE
LIBGO_IS_S390X_TRUE
LIBGO_IS_S390_FALSE
LIBGO_IS_S390_TRUE
LIBGO_IS_PPC64LE_FALSE
LIBGO_IS_PPC64LE_TRUE
LIBGO_IS_PPC64_FALSE
LIBGO_IS_PPC64_TRUE
LIBGO_IS_PPC_FALSE
LIBGO_IS_PPC_TRUE
LIBGO_IS_MIPS64_FALSE
LIBGO_IS_MIPS64_TRUE
LIBGO_IS_MIPSO64_FALSE
LIBGO_IS_MIPSO64_TRUE
LIBGO_IS_MIPSN64_FALSE
LIBGO_IS_MIPSN64_TRUE
LIBGO_IS_MIPSN32_FALSE
LIBGO_IS_MIPSN32_TRUE
LIBGO_IS_MIPSO32_FALSE
LIBGO_IS_MIPSO32_TRUE
LIBGO_IS_MIPS_FALSE
LIBGO_IS_MIPS_TRUE
LIBGO_IS_M68K_FALSE
LIBGO_IS_M68K_TRUE
LIBGO_IS_IA64_FALSE
LIBGO_IS_IA64_TRUE
LIBGO_IS_ARM64_FALSE
LIBGO_IS_ARM64_TRUE
LIBGO_IS_ARM_FALSE
LIBGO_IS_ARM_TRUE
LIBGO_IS_ALPHA_FALSE
LIBGO_IS_ALPHA_TRUE
LIBGO_IS_386_FALSE
LIBGO_IS_386_TRUE
USE_DEJAGNU
ALLGOOS
GOOS
LIBGO_IS_BSD_FALSE
LIBGO_IS_BSD_TRUE
@ -11130,7 +11101,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11133 "configure"
#line 11104 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -11236,7 +11207,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11239 "configure"
#line 11210 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -13522,6 +13493,11 @@ fi
go_include="-include"
# All known GOOS values. This is the union of all operating systems
# supported by the gofrontend and all operating systems supported by
# the gc toolchain.
ALLGOOS="android darwin dragonfly freebsd irix linux netbsd openbsd plan9 rtems solaris windows"
is_darwin=no
is_freebsd=no
is_irix=no
@ -13625,6 +13601,7 @@ fi
USE_DEJAGNU=no
case ${host} in
*-*-rtems*) USE_DEJAGNU=yes ;;
@ -13633,34 +13610,46 @@ case ${host} in
esac
is_386=no
is_alpha=no
is_arm=no
is_arm64=no
is_ia64=no
is_m68k=no
mips_abi=unknown
is_ppc=no
is_ppc64=no
is_ppc64le=no
is_s390=no
is_s390x=no
is_sparc=no
is_sparc64=no
is_x86_64=no
# All known GOARCH values. This is the union of all architectures
# supported by the gofrontend and all architectures supported by the
# gc toolchain.
# N.B. Keep in sync with gcc/testsuite/go.test/go-test.exp (go-set-goarch).
ALLGOARCH="386 alpha amd64 amd64p32 arm armbe arm64 arm64be ia64 m68k mipso32 mipsn32 mipso64 mipsn64 mips mipsle mips64 mips64le mips64p32 mips64pe32le ppc ppc64 ppc64le s390 s390x sparc sparc64"
# All known GOARCH_FAMILY values.
ALLGOARCHFAMILY="I386 ALPHA AMD64 ARM ARM64 IA64 M68K MIPS MIPS64 PPC PPC64 S390 S390X SPARC SPARC64"
GOARCH=unknown
GOARCH_FAMILY=unknown
GOARCH_BIGENDIAN=0
GOARCH_CACHELINESIZE=64
GOARCH_PHYSPAGESIZE=4096
GOARCH_PCQUANTUM=1
GOARCH_INT64ALIGN=8
GOARCH_HUGEPAGESIZE=0
GOARCH_MINFRAMESIZE=0
case ${host} in
alpha*-*-*)
is_alpha=yes
GOARCH=alpha
GOARCH_FAMILY=ALPHA
GOARCH_PHYSPAGESIZE=8192
GOARCH_PCQUANTUM=4
;;
aarch64-*-*)
is_arm64=yes
GOARCH=arm64
GOARCH_FAMILY=ARM64
GOARCH_CACHELINESIZE=32
GOARCH_PHYSPAGESIZE=65536
GOARCH_PCQUANTUm=4
GOARCH_MINFRAMESIZE=8
;;
arm*-*-* | strongarm*-*-* | ep9312*-*-* | xscale-*-*)
is_arm=yes
GOARCH=arm
GOARCH_FAMILY=ARM
GOARCH_CACHELINESIZE=32
GOARCH_PCQUANTUM=4
GOARCH_INT64ALIGN=4
GOARCH_MINFRAMESIZE=4
;;
i[34567]86-*-* | x86_64-*-*)
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@ -13671,24 +13660,32 @@ case ${host} in
#endif
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
is_386=yes
GOARCH=386
GOARCH_FAMILY=I386
GOARCH_INT64ALIGN=4
GOARCH_HUGEPAGESIZE="1 << 21"
else
is_x86_64=yes
GOARCH=amd64
GOARCH_FAMILY=AMD64
GOARCH_HUGEPAGESIZE="1 << 21"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test "$is_386" = "yes"; then
GOARCH=386
else
GOARCH=amd64
fi
;;
ia64-*-*)
is_ia64=yes
GOARCH=ia64
GOARCH_FAMILY=IA64
GOARCH_CACHELINESIZE=16384
GOARCH_PHYSPAGESIZE=8192
;;
m68k*-*-*)
is_m68k=yes
GOARCH=m68k
GOARCH_FAMILY=M68K
GOARCH_BIGENDIAN=1
GOARCH_CACHELINESIZE=16
GOARCH_PCQUANTUM=4
GOARCH_INT64ALIGN=4
;;
mips*-*-*)
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@ -13747,6 +13744,27 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
"n64") GOARCH=mipsn64 ;;
"o64") GOARCH=mipso64 ;;
esac
case "$mips_abi" in
"o32" | "n32")
GOARCH_FAMILY=MIPS
GOARCH_INT64ALIGN=4
GOARCH_MINFRAMESIZE=4
;;
"n64" | "o64")
GOARCH_FAMILY=MIPS64
GOARCH_MINFRAMESIZE=8
;;
esac
case "${host}" in
mips*el)
;;
*)
GOARCH_BIGENDIAN=1
;;
esac
GOARCH_CACHELINESIZE=32
GOARCH_PHYSPAGESIZE=16384
GOARCH_PCQUANTUM=4
;;
rs6000*-*-* | powerpc*-*-*)
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@ -13757,9 +13775,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
#endif
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
is_ppc=yes
GOARCH=ppc
GOARCH_FAMILY=PPC
GOARCH_BIGENDIAN=1
GOARCH_INT64ALIGN=4
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
GOARCH_FAMILY=PPC64
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#if defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN__)
@ -13767,20 +13791,19 @@ else
#endif
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
is_ppc64le=yes
GOARCH=ppc64le
else
is_ppc64=yes
GOARCH=ppc64
GOARCH_BIGENDIAN=1
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test "$is_ppc" = "yes"; then
GOARCH=ppc
elif test "$is_ppc64" = "yes"; then
GOARCH=ppc64
else
GOARCH=ppc64le
fi
GOARCH_PHYSPAGESIZE=65536
GOARCH_PCQUANTUM=4
GOARCH_MINFRAMESIZE=32
;;
s390*-*-*)
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@ -13791,16 +13814,21 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
#endif
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
is_s390=yes
GOARCH=s390
GOARCH_FAMILY=S390
GOARCH_INT64ALIGN=4
GOARCH_MINFRAMESIZE=4
else
is_s390x=yes
GOARCH=s390x
GOARCH_FAMILY=S390X
GOARCH_MINFRAMESIZE=8
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test "$is_s390" = "yes"; then
GOARCH=s390
else
GOARCH=s390x
fi
GOARCH_BIGENDIAN=1
GOARCH_CACHELINESIZE=256
GOARCH_PCQUANTUM=2
;;
sparc*-*-*)
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@ -13811,177 +13839,30 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
#endif
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
is_sparc=yes
GOARCH=sparc
GOARCH_FAMILY=SPARC
GOARCH_INT64ALIGN=4
else
is_sparc64=yes
GOARCH=sparc64
GOARCH_FAMILY=SPARC64
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test "$is_sparc" = "yes"; then
GOARCH=sparc
else
GOARCH=sparc64
fi
GOARCH_BIGENDIAN=1
GOARCH_PHYSPAGESIZE=8192
GOARCH_PCQUANTUM=4
;;
esac
if test $is_386 = yes; then
LIBGO_IS_386_TRUE=
LIBGO_IS_386_FALSE='#'
else
LIBGO_IS_386_TRUE='#'
LIBGO_IS_386_FALSE=
fi
if test $is_alpha = yes; then
LIBGO_IS_ALPHA_TRUE=
LIBGO_IS_ALPHA_FALSE='#'
else
LIBGO_IS_ALPHA_TRUE='#'
LIBGO_IS_ALPHA_FALSE=
fi
if test $is_arm = yes; then
LIBGO_IS_ARM_TRUE=
LIBGO_IS_ARM_FALSE='#'
else
LIBGO_IS_ARM_TRUE='#'
LIBGO_IS_ARM_FALSE=
fi
if test $is_arm64 = yes; then
LIBGO_IS_ARM64_TRUE=
LIBGO_IS_ARM64_FALSE='#'
else
LIBGO_IS_ARM64_TRUE='#'
LIBGO_IS_ARM64_FALSE=
fi
if test $is_ia64 = yes; then
LIBGO_IS_IA64_TRUE=
LIBGO_IS_IA64_FALSE='#'
else
LIBGO_IS_IA64_TRUE='#'
LIBGO_IS_IA64_FALSE=
fi
if test $is_m68k = yes; then
LIBGO_IS_M68K_TRUE=
LIBGO_IS_M68K_FALSE='#'
else
LIBGO_IS_M68K_TRUE='#'
LIBGO_IS_M68K_FALSE=
fi
if test $mips_abi != unknown; then
LIBGO_IS_MIPS_TRUE=
LIBGO_IS_MIPS_FALSE='#'
else
LIBGO_IS_MIPS_TRUE='#'
LIBGO_IS_MIPS_FALSE=
fi
if test $mips_abi = o32; then
LIBGO_IS_MIPSO32_TRUE=
LIBGO_IS_MIPSO32_FALSE='#'
else
LIBGO_IS_MIPSO32_TRUE='#'
LIBGO_IS_MIPSO32_FALSE=
fi
if test $mips_abi = n32; then
LIBGO_IS_MIPSN32_TRUE=
LIBGO_IS_MIPSN32_FALSE='#'
else
LIBGO_IS_MIPSN32_TRUE='#'
LIBGO_IS_MIPSN32_FALSE=
fi
if test $mips_abi = n64; then
LIBGO_IS_MIPSN64_TRUE=
LIBGO_IS_MIPSN64_FALSE='#'
else
LIBGO_IS_MIPSN64_TRUE='#'
LIBGO_IS_MIPSN64_FALSE=
fi
if test $mips_abi = o64; then
LIBGO_IS_MIPSO64_TRUE=
LIBGO_IS_MIPSO64_FALSE='#'
else
LIBGO_IS_MIPSO64_TRUE='#'
LIBGO_IS_MIPSO64_FALSE=
fi
if test $mips_abi = n64 -o $mips_abi = o64; then
LIBGO_IS_MIPS64_TRUE=
LIBGO_IS_MIPS64_FALSE='#'
else
LIBGO_IS_MIPS64_TRUE='#'
LIBGO_IS_MIPS64_FALSE=
fi
if test $is_ppc = yes; then
LIBGO_IS_PPC_TRUE=
LIBGO_IS_PPC_FALSE='#'
else
LIBGO_IS_PPC_TRUE='#'
LIBGO_IS_PPC_FALSE=
fi
if test $is_ppc64 = yes; then
LIBGO_IS_PPC64_TRUE=
LIBGO_IS_PPC64_FALSE='#'
else
LIBGO_IS_PPC64_TRUE='#'
LIBGO_IS_PPC64_FALSE=
fi
if test $is_ppc64le = yes; then
LIBGO_IS_PPC64LE_TRUE=
LIBGO_IS_PPC64LE_FALSE='#'
else
LIBGO_IS_PPC64LE_TRUE='#'
LIBGO_IS_PPC64LE_FALSE=
fi
if test $is_s390 = yes; then
LIBGO_IS_S390_TRUE=
LIBGO_IS_S390_FALSE='#'
else
LIBGO_IS_S390_TRUE='#'
LIBGO_IS_S390_FALSE=
fi
if test $is_s390x = yes; then
LIBGO_IS_S390X_TRUE=
LIBGO_IS_S390X_FALSE='#'
else
LIBGO_IS_S390X_TRUE='#'
LIBGO_IS_S390X_FALSE=
fi
if test $is_sparc = yes; then
LIBGO_IS_SPARC_TRUE=
LIBGO_IS_SPARC_FALSE='#'
else
LIBGO_IS_SPARC_TRUE='#'
LIBGO_IS_SPARC_FALSE=
fi
if test $is_sparc64 = yes; then
LIBGO_IS_SPARC64_TRUE=
LIBGO_IS_SPARC64_FALSE='#'
else
LIBGO_IS_SPARC64_TRUE='#'
LIBGO_IS_SPARC64_FALSE=
fi
if test $is_x86_64 = yes; then
LIBGO_IS_X86_64_TRUE=
LIBGO_IS_X86_64_FALSE='#'
else
LIBGO_IS_X86_64_TRUE='#'
LIBGO_IS_X86_64_FALSE=
fi
@ -15798,86 +15679,6 @@ 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_386_TRUE}" && test -z "${LIBGO_IS_386_FALSE}"; then
as_fn_error "conditional \"LIBGO_IS_386\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LIBGO_IS_ALPHA_TRUE}" && test -z "${LIBGO_IS_ALPHA_FALSE}"; then
as_fn_error "conditional \"LIBGO_IS_ALPHA\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LIBGO_IS_ARM_TRUE}" && test -z "${LIBGO_IS_ARM_FALSE}"; then
as_fn_error "conditional \"LIBGO_IS_ARM\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LIBGO_IS_ARM64_TRUE}" && test -z "${LIBGO_IS_ARM64_FALSE}"; then
as_fn_error "conditional \"LIBGO_IS_ARM64\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LIBGO_IS_IA64_TRUE}" && test -z "${LIBGO_IS_IA64_FALSE}"; then
as_fn_error "conditional \"LIBGO_IS_IA64\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LIBGO_IS_M68K_TRUE}" && test -z "${LIBGO_IS_M68K_FALSE}"; then
as_fn_error "conditional \"LIBGO_IS_M68K\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LIBGO_IS_MIPS_TRUE}" && test -z "${LIBGO_IS_MIPS_FALSE}"; then
as_fn_error "conditional \"LIBGO_IS_MIPS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LIBGO_IS_MIPSO32_TRUE}" && test -z "${LIBGO_IS_MIPSO32_FALSE}"; then
as_fn_error "conditional \"LIBGO_IS_MIPSO32\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LIBGO_IS_MIPSN32_TRUE}" && test -z "${LIBGO_IS_MIPSN32_FALSE}"; then
as_fn_error "conditional \"LIBGO_IS_MIPSN32\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LIBGO_IS_MIPSN64_TRUE}" && test -z "${LIBGO_IS_MIPSN64_FALSE}"; then
as_fn_error "conditional \"LIBGO_IS_MIPSN64\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LIBGO_IS_MIPSO64_TRUE}" && test -z "${LIBGO_IS_MIPSO64_FALSE}"; then
as_fn_error "conditional \"LIBGO_IS_MIPSO64\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LIBGO_IS_MIPS64_TRUE}" && test -z "${LIBGO_IS_MIPS64_FALSE}"; then
as_fn_error "conditional \"LIBGO_IS_MIPS64\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LIBGO_IS_PPC_TRUE}" && test -z "${LIBGO_IS_PPC_FALSE}"; then
as_fn_error "conditional \"LIBGO_IS_PPC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LIBGO_IS_PPC64_TRUE}" && test -z "${LIBGO_IS_PPC64_FALSE}"; then
as_fn_error "conditional \"LIBGO_IS_PPC64\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LIBGO_IS_PPC64LE_TRUE}" && test -z "${LIBGO_IS_PPC64LE_FALSE}"; then
as_fn_error "conditional \"LIBGO_IS_PPC64LE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LIBGO_IS_S390_TRUE}" && test -z "${LIBGO_IS_S390_FALSE}"; then
as_fn_error "conditional \"LIBGO_IS_S390\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LIBGO_IS_S390X_TRUE}" && test -z "${LIBGO_IS_S390X_FALSE}"; then
as_fn_error "conditional \"LIBGO_IS_S390X\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LIBGO_IS_SPARC_TRUE}" && test -z "${LIBGO_IS_SPARC_FALSE}"; then
as_fn_error "conditional \"LIBGO_IS_SPARC\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LIBGO_IS_SPARC64_TRUE}" && test -z "${LIBGO_IS_SPARC64_FALSE}"; then
as_fn_error "conditional \"LIBGO_IS_SPARC64\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${LIBGO_IS_X86_64_TRUE}" && test -z "${LIBGO_IS_X86_64_FALSE}"; then
as_fn_error "conditional \"LIBGO_IS_X86_64\" 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

View File

@ -142,6 +142,11 @@ AC_SUBST(LIBATOMIC)
go_include="-include"
AC_SUBST(go_include)
# All known GOOS values. This is the union of all operating systems
# supported by the gofrontend and all operating systems supported by
# the gc toolchain.
ALLGOOS="android darwin dragonfly freebsd irix linux netbsd openbsd plan9 rtems solaris windows"
is_darwin=no
is_freebsd=no
is_irix=no
@ -174,6 +179,7 @@ AM_CONDITIONAL(LIBGO_IS_RTEMS, test $is_rtems = yes)
AM_CONDITIONAL(LIBGO_IS_SOLARIS, test $is_solaris = yes)
AM_CONDITIONAL(LIBGO_IS_BSD, test $is_darwin = yes -o $is_dragonfly = yes -o $is_freebsd = yes -o $is_netbsd = yes -o $is_openbsd = yes)
AC_SUBST(GOOS)
AC_SUBST(ALLGOOS)
dnl Test whether we need to use DejaGNU or whether we can use the
dnl simpler gotest approach. We can only use gotest for a native
@ -186,35 +192,46 @@ case ${host} in
esac
AC_SUBST(USE_DEJAGNU)
dnl N.B. Keep in sync with gcc/testsuite/go.test/go-test.exp (go-set-goarch).
is_386=no
is_alpha=no
is_arm=no
is_arm64=no
is_ia64=no
is_m68k=no
mips_abi=unknown
is_ppc=no
is_ppc64=no
is_ppc64le=no
is_s390=no
is_s390x=no
is_sparc=no
is_sparc64=no
is_x86_64=no
# All known GOARCH values. This is the union of all architectures
# supported by the gofrontend and all architectures supported by the
# gc toolchain.
# N.B. Keep in sync with gcc/testsuite/go.test/go-test.exp (go-set-goarch).
ALLGOARCH="386 alpha amd64 amd64p32 arm armbe arm64 arm64be ia64 m68k mipso32 mipsn32 mipso64 mipsn64 mips mipsle mips64 mips64le mips64p32 mips64pe32le ppc ppc64 ppc64le s390 s390x sparc sparc64"
# All known GOARCH_FAMILY values.
ALLGOARCHFAMILY="I386 ALPHA AMD64 ARM ARM64 IA64 M68K MIPS MIPS64 PPC PPC64 S390 S390X SPARC SPARC64"
GOARCH=unknown
GOARCH_FAMILY=unknown
GOARCH_BIGENDIAN=0
GOARCH_CACHELINESIZE=64
GOARCH_PHYSPAGESIZE=4096
GOARCH_PCQUANTUM=1
GOARCH_INT64ALIGN=8
GOARCH_HUGEPAGESIZE=0
GOARCH_MINFRAMESIZE=0
case ${host} in
alpha*-*-*)
is_alpha=yes
GOARCH=alpha
GOARCH_FAMILY=ALPHA
GOARCH_PHYSPAGESIZE=8192
GOARCH_PCQUANTUM=4
;;
aarch64-*-*)
is_arm64=yes
GOARCH=arm64
GOARCH_FAMILY=ARM64
GOARCH_CACHELINESIZE=32
GOARCH_PHYSPAGESIZE=65536
GOARCH_PCQUANTUm=4
GOARCH_MINFRAMESIZE=8
;;
arm*-*-* | strongarm*-*-* | ep9312*-*-* | xscale-*-*)
is_arm=yes
GOARCH=arm
GOARCH_FAMILY=ARM
GOARCH_CACHELINESIZE=32
GOARCH_PCQUANTUM=4
GOARCH_INT64ALIGN=4
GOARCH_MINFRAMESIZE=4
;;
changequote(,)dnl
i[34567]86-*-* | x86_64-*-*)
@ -223,20 +240,29 @@ changequote([,])dnl
#ifdef __x86_64__
#error 64-bit
#endif],
[is_386=yes], [is_x86_64=yes])
if test "$is_386" = "yes"; then
GOARCH=386
else
GOARCH=amd64
fi
[GOARCH=386
GOARCH_FAMILY=I386
GOARCH_INT64ALIGN=4
GOARCH_HUGEPAGESIZE="1 << 21"
],
[GOARCH=amd64
GOARCH_FAMILY=AMD64
GOARCH_HUGEPAGESIZE="1 << 21"
])
;;
ia64-*-*)
is_ia64=yes
GOARCH=ia64
GOARCH_FAMILY=IA64
GOARCH_CACHELINESIZE=16384
GOARCH_PHYSPAGESIZE=8192
;;
m68k*-*-*)
is_m68k=yes
GOARCH=m68k
GOARCH_FAMILY=M68K
GOARCH_BIGENDIAN=1
GOARCH_CACHELINESIZE=16
GOARCH_PCQUANTUM=4
GOARCH_INT64ALIGN=4
;;
mips*-*-*)
AC_COMPILE_IFELSE([
@ -267,72 +293,98 @@ changequote([,])dnl
"n64") GOARCH=mipsn64 ;;
"o64") GOARCH=mipso64 ;;
esac
case "$mips_abi" in
"o32" | "n32")
GOARCH_FAMILY=MIPS
GOARCH_INT64ALIGN=4
GOARCH_MINFRAMESIZE=4
;;
"n64" | "o64")
GOARCH_FAMILY=MIPS64
GOARCH_MINFRAMESIZE=8
;;
esac
case "${host}" in
mips*el)
;;
*)
GOARCH_BIGENDIAN=1
;;
esac
GOARCH_CACHELINESIZE=32
GOARCH_PHYSPAGESIZE=16384
GOARCH_PCQUANTUM=4
;;
rs6000*-*-* | powerpc*-*-*)
AC_COMPILE_IFELSE([
#ifdef _ARCH_PPC64
#error 64-bit
#endif],
[is_ppc=yes],
[AC_COMPILE_IFELSE([
[GOARCH=ppc
GOARCH_FAMILY=PPC
GOARCH_BIGENDIAN=1
GOARCH_INT64ALIGN=4
],
[
GOARCH_FAMILY=PPC64
AC_COMPILE_IFELSE([
#if defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN__)
#error 64be
#endif],
[is_ppc64le=yes],[is_ppc64=yes])])
if test "$is_ppc" = "yes"; then
GOARCH=ppc
elif test "$is_ppc64" = "yes"; then
GOARCH=ppc64
else
GOARCH=ppc64le
fi
[GOARCH=ppc64le
],
[GOARCH=ppc64
GOARCH_BIGENDIAN=1
])])
GOARCH_PHYSPAGESIZE=65536
GOARCH_PCQUANTUM=4
GOARCH_MINFRAMESIZE=32
;;
s390*-*-*)
AC_COMPILE_IFELSE([
#if defined(__s390x__)
#error 64-bit
#endif],
[is_s390=yes], [is_s390x=yes])
if test "$is_s390" = "yes"; then
GOARCH=s390
else
GOARCH=s390x
fi
[GOARCH=s390
GOARCH_FAMILY=S390
GOARCH_INT64ALIGN=4
GOARCH_MINFRAMESIZE=4
], [GOARCH=s390x
GOARCH_FAMILY=S390X
GOARCH_MINFRAMESIZE=8
])
GOARCH_BIGENDIAN=1
GOARCH_CACHELINESIZE=256
GOARCH_PCQUANTUM=2
;;
sparc*-*-*)
AC_COMPILE_IFELSE([
#if defined(__sparcv9) || defined(__arch64__)
#error 64-bit
#endif],
[is_sparc=yes], [is_sparc64=yes])
if test "$is_sparc" = "yes"; then
GOARCH=sparc
else
GOARCH=sparc64
fi
[GOARCH=sparc
GOARCH_FAMILY=SPARC
GOARCH_INT64ALIGN=4
],
[GOARCH=sparc64
GOARCH_FAMILY=SPARC64
])
GOARCH_BIGENDIAN=1
GOARCH_PHYSPAGESIZE=8192
GOARCH_PCQUANTUM=4
;;
esac
AM_CONDITIONAL(LIBGO_IS_386, test $is_386 = yes)
AM_CONDITIONAL(LIBGO_IS_ALPHA, test $is_alpha = yes)
AM_CONDITIONAL(LIBGO_IS_ARM, test $is_arm = yes)
AM_CONDITIONAL(LIBGO_IS_ARM64, test $is_arm64 = yes)
AM_CONDITIONAL(LIBGO_IS_IA64, test $is_ia64 = yes)
AM_CONDITIONAL(LIBGO_IS_M68K, test $is_m68k = yes)
AM_CONDITIONAL(LIBGO_IS_MIPS, test $mips_abi != unknown)
AM_CONDITIONAL(LIBGO_IS_MIPSO32, test $mips_abi = o32)
AM_CONDITIONAL(LIBGO_IS_MIPSN32, test $mips_abi = n32)
AM_CONDITIONAL(LIBGO_IS_MIPSN64, test $mips_abi = n64)
AM_CONDITIONAL(LIBGO_IS_MIPSO64, test $mips_abi = o64)
AM_CONDITIONAL(LIBGO_IS_MIPS64, test $mips_abi = n64 -o $mips_abi = o64)
AM_CONDITIONAL(LIBGO_IS_PPC, test $is_ppc = yes)
AM_CONDITIONAL(LIBGO_IS_PPC64, test $is_ppc64 = yes)
AM_CONDITIONAL(LIBGO_IS_PPC64LE, test $is_ppc64le = yes)
AM_CONDITIONAL(LIBGO_IS_S390, test $is_s390 = yes)
AM_CONDITIONAL(LIBGO_IS_S390X, test $is_s390x = yes)
AM_CONDITIONAL(LIBGO_IS_SPARC, test $is_sparc = yes)
AM_CONDITIONAL(LIBGO_IS_SPARC64, test $is_sparc64 = yes)
AM_CONDITIONAL(LIBGO_IS_X86_64, test $is_x86_64 = yes)
AC_SUBST(GOARCH)
AC_SUBST(GOARCH_FAMILY)
AC_SUBST(GOARCH_BIGENDIAN)
AC_SUBST(GOARCH_CACHELINESIZE)
AC_SUBST(GOARCH_PHYSPAGESIZE)
AC_SUBST(GOARCH_PCQUANTUM)
AC_SUBST(GOARCH_INT64ALIGN)
AC_SUBST(GOARCH_HUGEPAGESIZE)
AC_SUBST(GOARCH_MINFRAMESIZE)
AC_SUBST(ALLGOARCH)
AC_SUBST(ALLGOARCHFAMILY)
dnl Some files are only present when needed for specific architectures.
GO_LIBCALL_OS_FILE=

View File

@ -157,6 +157,8 @@ of the run-time system.
*/
package runtime
import "runtime/internal/sys"
// Gosched yields the processor, allowing other goroutines to run. It does not
// suspend the current goroutine, so execution resumes automatically.
func Gosched()
@ -282,23 +284,23 @@ func GOROOT() string {
if s != "" {
return s
}
return defaultGoroot
return sys.DefaultGoroot
}
// Version returns the Go tree's version string.
// It is either the commit hash and date at the time of the build or,
// when possible, a release tag like "go1.3".
func Version() string {
return theVersion
return sys.TheVersion
}
// GOOS is the running program's operating system target:
// one of darwin, freebsd, linux, and so on.
const GOOS string = theGoos
const GOOS string = sys.GOOS
// GOARCH is the running program's architecture target:
// 386, amd64, arm, or s390x.
const GOARCH string = theGoarch
const GOARCH string = sys.GOARCH
// GCCGOTOOLDIR is the Tool Dir for the gccgo build
const GCCGOTOOLDIR string = theGccgoToolDir
const GCCGOTOOLDIR string = sys.GccgoToolDir

View File

@ -0,0 +1,77 @@
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package sys
//extern __builtin_ctz
func builtinCtz32(uint32) int32
//extern __builtin_ctzll
func builtinCtz64(uint64) int32
//go:nosplit
// Ctz64 counts trailing (low-order) zeroes,
// and if all are zero, then 64.
func Ctz64(x uint64) uint64 {
if x == 0 {
return 64
}
return uint64(builtinCtz64(x))
}
//go:nosplit
// Ctz32 counts trailing (low-order) zeroes,
// and if all are zero, then 32.
func Ctz32(x uint32) uint32 {
if x == 0 {
return 32
}
return uint32(builtinCtz32(x))
}
//go:nosplit
// Ctz16 counts trailing (low-order) zeroes,
// and if all are zero, then 16.
func Ctz16(x uint16) uint16 {
if x == 0 {
return 16
}
return uint16(builtinCtz32(uint32(x)))
}
//go:nosplit
// Ctz8 counts trailing (low-order) zeroes,
// and if all are zero, then 8.
func Ctz8(x uint8) uint8 {
if x == 0 {
return 8
}
return uint8(builtinCtz32(uint32(x)))
}
//extern __builtin_bswap64
func bswap64(uint64) uint64
//go:nosplit
// Bswap64 returns its input with byte order reversed
// 0x0102030405060708 -> 0x0807060504030201
func Bswap64(x uint64) uint64 {
return bswap64(x)
}
//extern __builtin_bswap32
func bswap32(uint32) uint32
//go:nosplit
// Bswap32 returns its input with byte order reversed
// 0x01020304 -> 0x04030201
func Bswap32(x uint32) uint32 {
return bswap32(x)
}

View File

@ -0,0 +1,54 @@
package sys_test
import (
"runtime/internal/sys"
"testing"
)
func TestCtz64(t *testing.T) {
for i := uint(0); i <= 64; i++ {
x := uint64(5) << i
if got := sys.Ctz64(x); got != uint64(i) {
t.Errorf("Ctz64(%d)=%d, want %d", x, got, i)
}
}
}
func TestCtz32(t *testing.T) {
for i := uint(0); i <= 32; i++ {
x := uint32(5) << i
if got := sys.Ctz32(x); got != uint32(i) {
t.Errorf("Ctz32(%d)=%d, want %d", x, got, i)
}
}
}
func TestCtz16(t *testing.T) {
for i := uint(0); i <= 16; i++ {
x := uint16(5) << i
if got := sys.Ctz16(x); got != uint16(i) {
t.Errorf("Ctz16(%d)=%d, want %d", x, got, i)
}
}
}
func TestCtz8(t *testing.T) {
for i := uint(0); i <= 8; i++ {
x := uint8(5) << i
if got := sys.Ctz8(x); got != uint8(i) {
t.Errorf("Ctz8(%d)=%d, want %d", x, got, i)
}
}
}
func TestBswap64(t *testing.T) {
x := uint64(0x1122334455667788)
y := sys.Bswap64(x)
if y != 0x8877665544332211 {
t.Errorf("Bswap(%x)=%x, want 0x8877665544332211", x, y)
}
}
func TestBswap32(t *testing.T) {
x := uint32(0x11223344)
y := sys.Bswap32(x)
if y != 0x44332211 {
t.Errorf("Bswap(%x)=%x, want 0x44332211", x, y)
}
}

View File

@ -0,0 +1,11 @@
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package sys
// Declarations for runtime services implemented in C or assembly.
const PtrSize = 4 << (^uintptr(0) >> 63) // unsafe.Sizeof(uintptr(0)) but an ideal const
const RegSize = 4 << (^Uintreg(0) >> 63) // unsafe.Sizeof(uintreg(0)) but an ideal const
const SpAlign = 1*(1-GoarchArm64) + 16*GoarchArm64 // SP alignment: 1 normally, 16 for ARM64

View File

@ -0,0 +1,15 @@
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// package sys contains system- and configuration- and architecture-specific
// constants used by the runtime.
package sys
// The next line makes 'go generate' write the zgen_*.go files with
// per-OS and per-arch information, including constants
// named goos_$GOOS and goarch_$GOARCH for every
// known GOOS and GOARCH. The constant is 1 on the
// current system, 0 otherwise; multiplying by them is
// useful for defining GOOS- or GOARCH-specific constants.
//go:generate go run gengoos.go

View File

@ -79,6 +79,9 @@ am__can_run_installinfo = \
DEJATOOL = $(PACKAGE)
RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
ACLOCAL = @ACLOCAL@
ALLGOARCH = @ALLGOARCH@
ALLGOARCHFAMILY = @ALLGOARCHFAMILY@
ALLGOOS = @ALLGOOS@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
@ -103,6 +106,14 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GOARCH = @GOARCH@
GOARCH_BIGENDIAN = @GOARCH_BIGENDIAN@
GOARCH_CACHELINESIZE = @GOARCH_CACHELINESIZE@
GOARCH_FAMILY = @GOARCH_FAMILY@
GOARCH_HUGEPAGESIZE = @GOARCH_HUGEPAGESIZE@
GOARCH_INT64ALIGN = @GOARCH_INT64ALIGN@
GOARCH_MINFRAMESIZE = @GOARCH_MINFRAMESIZE@
GOARCH_PCQUANTUM = @GOARCH_PCQUANTUM@
GOARCH_PHYSPAGESIZE = @GOARCH_PHYSPAGESIZE@
GOC = @GOC@
GOCFLAGS = @GOCFLAGS@
GOOS = @GOOS@