2018-01-14 12:59:01 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Copyright 2018 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.
|
|
|
|
|
|
|
|
# Code in Makefile.am will invoke this script with two arguments.
|
|
|
|
# The first is a GOARCH value. The second is a keyword.
|
|
|
|
# The script will print the value of that keyword for that GOARCH.
|
|
|
|
# Keywords:
|
|
|
|
# - bigendian: true or false
|
|
|
|
# - cachelinesize: the cache line size in bytes
|
|
|
|
# (for performance only; it's not essential to get this right)
|
|
|
|
# - defaultphyspagesize: the default physical page size in bytes
|
|
|
|
# (not currently used, but maybe some day)
|
|
|
|
# - family: the processor family, from ALLGOARCHFAMILY in configure.ac
|
|
|
|
# - int64align: alignment of int64 type in bytes
|
|
|
|
# - maxalign: maximum alignment of values of Go types in bytes
|
|
|
|
# - minframesize: size of smallest possible function frame in bytes
|
|
|
|
# (not currently used, may never be used)
|
|
|
|
# - pcquantum: minimum size of a single instruction in bytes
|
|
|
|
# - ptrsize: size of a pointer in bytes
|
|
|
|
|
|
|
|
if test $# -ne 2; then
|
|
|
|
echo 1>&2 "usage: goarch <goarch> <keyword>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
goarch=$1
|
|
|
|
keyword=$2
|
|
|
|
|
|
|
|
# Default values
|
|
|
|
bigendian=false
|
|
|
|
cachelinesize=64
|
|
|
|
defaultphyspagesize=4096
|
|
|
|
family=unknown
|
|
|
|
int64align=8
|
|
|
|
maxalign=8
|
|
|
|
minframesize=0
|
|
|
|
pcquantum=1
|
|
|
|
ptrsize=8
|
2021-07-31 05:28:58 +08:00
|
|
|
stackalign=8
|
2018-01-14 12:59:01 +08:00
|
|
|
|
|
|
|
case $goarch in
|
|
|
|
386)
|
|
|
|
family=I386
|
|
|
|
int64align=4
|
|
|
|
maxalign=4
|
|
|
|
ptrsize=4
|
2021-07-31 05:28:58 +08:00
|
|
|
stackalign=4
|
2018-01-14 12:59:01 +08:00
|
|
|
;;
|
|
|
|
alpha)
|
|
|
|
family=ALPHA
|
|
|
|
defaultphyspagesize=8192
|
|
|
|
pcquantum=4
|
|
|
|
;;
|
2018-10-02 04:17:11 +08:00
|
|
|
amd64)
|
2018-01-14 12:59:01 +08:00
|
|
|
family=AMD64
|
|
|
|
;;
|
2018-10-02 04:17:11 +08:00
|
|
|
amd64p32)
|
|
|
|
family=AMD64
|
|
|
|
ptrsize=4
|
2021-07-31 05:28:58 +08:00
|
|
|
stackalign=4
|
2018-10-02 04:17:11 +08:00
|
|
|
;;
|
2018-01-14 12:59:01 +08:00
|
|
|
arm | armbe)
|
|
|
|
family=ARM
|
|
|
|
cachelinesize=32
|
|
|
|
minframesize=4
|
|
|
|
pcquantum=4
|
|
|
|
ptrsize=4
|
2021-07-31 05:28:58 +08:00
|
|
|
stackalign=4
|
2018-01-14 12:59:01 +08:00
|
|
|
case $goarch in
|
|
|
|
*be)
|
|
|
|
bigendian=true
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
arm64 | arm64be)
|
|
|
|
family=ARM64
|
|
|
|
cachelinesize=32
|
|
|
|
defaultphyspagesize=65536
|
|
|
|
minframesize=8
|
|
|
|
pcquantum=4
|
2021-07-31 05:28:58 +08:00
|
|
|
stackalign=16
|
2018-01-14 12:59:01 +08:00
|
|
|
case $goarch in
|
|
|
|
*be)
|
|
|
|
bigendian=true
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
ia64)
|
|
|
|
family=IA64
|
|
|
|
cachelinesize=128
|
|
|
|
defaultphyspagesize=65536
|
|
|
|
;;
|
|
|
|
m68k)
|
|
|
|
family=M68K
|
|
|
|
bigendian=true
|
|
|
|
cachelinesize=16
|
|
|
|
int64align=2
|
|
|
|
maxalign=2
|
|
|
|
pcquantum=4
|
|
|
|
ptrsize=4
|
2021-07-31 05:28:58 +08:00
|
|
|
stackalign=4
|
2018-01-14 12:59:01 +08:00
|
|
|
;;
|
|
|
|
mips | mipsle | mips64p32 | mips64p32le)
|
|
|
|
family=MIPS
|
|
|
|
bigendian=true
|
|
|
|
cachelinesize=32
|
|
|
|
defaultphyspagesize=16384
|
|
|
|
minframesize=4
|
|
|
|
pcquantum=4
|
|
|
|
ptrsize=4
|
2021-07-31 05:28:58 +08:00
|
|
|
stackalign=4
|
2018-01-14 12:59:01 +08:00
|
|
|
case $goarch in
|
|
|
|
*le)
|
|
|
|
bigendian=false
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
mips64 | mips64le)
|
|
|
|
family=MIPS64
|
|
|
|
bigendian=true
|
|
|
|
cachelinesize=32
|
|
|
|
defaultphyspagesize=16384
|
|
|
|
minframesize=8
|
|
|
|
pcquantum=4
|
|
|
|
case $goarch in
|
|
|
|
*le)
|
|
|
|
bigendian=false
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2018-05-03 06:28:46 +08:00
|
|
|
nios2)
|
|
|
|
family=NIOS2
|
|
|
|
cachelinesize=32
|
|
|
|
minframesize=16
|
|
|
|
pcquantum=4
|
|
|
|
ptrsize=4
|
2021-07-31 05:28:58 +08:00
|
|
|
stackalign=4
|
2018-05-03 06:28:46 +08:00
|
|
|
;;
|
2018-01-14 12:59:01 +08:00
|
|
|
ppc)
|
|
|
|
family=PPC
|
|
|
|
bigendian=true
|
|
|
|
defaultphyspagesize=65536
|
|
|
|
minframesize=32
|
|
|
|
pcquantum=4
|
|
|
|
ptrsize=4
|
2021-07-31 05:28:58 +08:00
|
|
|
stackalign=4
|
2018-01-14 12:59:01 +08:00
|
|
|
;;
|
|
|
|
ppc64 | ppc64le)
|
|
|
|
family=PPC64
|
|
|
|
bigendian=true
|
|
|
|
defaultphyspagesize=65536
|
|
|
|
minframesize=32
|
|
|
|
pcquantum=4
|
2021-07-31 05:28:58 +08:00
|
|
|
stackalign=16
|
2018-01-14 12:59:01 +08:00
|
|
|
case $goarch in
|
|
|
|
*le)
|
|
|
|
bigendian=false
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2018-06-12 03:16:34 +08:00
|
|
|
riscv)
|
|
|
|
family=RISCV
|
|
|
|
pcquantum=2
|
|
|
|
ptrsize=4
|
2021-07-31 05:28:58 +08:00
|
|
|
stackalign=4
|
2018-06-12 03:16:34 +08:00
|
|
|
;;
|
2018-02-23 03:49:04 +08:00
|
|
|
riscv64)
|
|
|
|
family=RISCV64
|
|
|
|
pcquantum=2
|
|
|
|
;;
|
2018-01-14 12:59:01 +08:00
|
|
|
s390)
|
|
|
|
family=S390
|
|
|
|
bigendian=true
|
|
|
|
cachelinesize=256
|
|
|
|
minframesize=4
|
|
|
|
pcquantum=2
|
|
|
|
ptrsize=4
|
2021-07-31 05:28:58 +08:00
|
|
|
stackalign=4
|
2018-01-14 12:59:01 +08:00
|
|
|
;;
|
|
|
|
s390x)
|
|
|
|
family=S390X
|
|
|
|
bigendian=true
|
|
|
|
cachelinesize=256
|
|
|
|
minframesize=8
|
|
|
|
pcquantum=2
|
|
|
|
;;
|
|
|
|
sh | shbe)
|
|
|
|
family=SH
|
|
|
|
cachelinesize=16
|
|
|
|
int64align=4
|
|
|
|
minframesize=4
|
|
|
|
pcquantum=2
|
|
|
|
ptrsize=4
|
2021-07-31 05:28:58 +08:00
|
|
|
stackalign=4
|
2018-01-14 12:59:01 +08:00
|
|
|
case $goarch in
|
|
|
|
*be)
|
|
|
|
bigendian=true
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
sparc)
|
|
|
|
family=SPARC
|
|
|
|
bigendian=true
|
|
|
|
defaultphyspagesize=8192
|
|
|
|
pcquantum=4
|
|
|
|
ptrsize=4
|
2021-07-31 05:28:58 +08:00
|
|
|
stackalign=4
|
2018-01-14 12:59:01 +08:00
|
|
|
;;
|
|
|
|
sparc64)
|
|
|
|
family=SPARC64
|
|
|
|
bigendian=true
|
|
|
|
defaultphyspagesize=8192
|
|
|
|
pcquantum=4
|
|
|
|
;;
|
2018-06-12 03:16:34 +08:00
|
|
|
wasm)
|
|
|
|
family=WASM
|
|
|
|
defaultphyspagesize=65536
|
|
|
|
;;
|
2018-01-14 12:59:01 +08:00
|
|
|
*)
|
|
|
|
echo 1>&2 "unrecognized goarch value \"$goarch\""
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if test "$family" = "unknown"; then
|
|
|
|
echo 1>&2 "internal error: no family for goarch value \"$goarch\""
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
case $keyword in
|
|
|
|
bigendian)
|
|
|
|
echo $bigendian
|
|
|
|
;;
|
|
|
|
cachelinesize)
|
|
|
|
echo $cachelinesize
|
|
|
|
;;
|
|
|
|
defaultphyspagesize)
|
|
|
|
echo $defaultphyspagesize
|
|
|
|
;;
|
|
|
|
family)
|
|
|
|
echo $family
|
|
|
|
;;
|
|
|
|
int64align)
|
|
|
|
echo $int64align
|
|
|
|
;;
|
|
|
|
maxalign)
|
|
|
|
echo $maxalign
|
|
|
|
;;
|
|
|
|
minframesize)
|
|
|
|
echo $minframesize
|
|
|
|
;;
|
|
|
|
pcquantum)
|
|
|
|
echo $pcquantum
|
|
|
|
;;
|
|
|
|
ptrsize)
|
|
|
|
echo $ptrsize
|
|
|
|
;;
|
2021-07-31 05:28:58 +08:00
|
|
|
stackalign)
|
|
|
|
echo $stackalign
|
|
|
|
;;
|
2018-01-14 12:59:01 +08:00
|
|
|
*)
|
|
|
|
echo 1>&2 "unrecognized keyword \"$keyword\""
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|