diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-05-31 21:36:42 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-05-31 21:36:42 +0000 |
commit | 30bc05cfcb5889462047dccf3a03e357d1c1b155 (patch) | |
tree | 0fea5b7dccff8cf496f7083cd291e2be2d36d71a | |
parent | 4f14911c80fe5e57068a98bf8f65aef0a27a9494 (diff) | |
download | gcc-30bc05cfcb5889462047dccf3a03e357d1c1b155.zip gcc-30bc05cfcb5889462047dccf3a03e357d1c1b155.tar.gz gcc-30bc05cfcb5889462047dccf3a03e357d1c1b155.tar.bz2 |
libgo: support for sparc64 GNU/Linux
Fix lfstack code to work with sparc64 GNU/Linux address map.
Force alignment of epollevent. To make this work reliably, pass
GOARCH explicitly to mkrsysinfo.sh.
Patch by Vladimir Mezentsev.
Reviewed-on: https://go-review.googlesource.com/44494
From-SVN: r248765
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | libgo/Makefile.am | 2 | ||||
-rw-r--r-- | libgo/Makefile.in | 2 | ||||
-rw-r--r-- | libgo/go/runtime/lfstack_64bit.go | 12 | ||||
-rwxr-xr-x | libgo/mkrsysinfo.sh | 6 |
5 files changed, 20 insertions, 4 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 07127b0..33259da 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -884df09c3da0f39309ab13f2ad401628fb933050 +e5870eac67d4d5b1f86bdbfb13dadf4d5723f71d 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 8bbd437..0f9881f 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -531,7 +531,7 @@ s-version: Makefile runtime_sysinfo.go: s-runtime_sysinfo; @true s-runtime_sysinfo: $(srcdir)/mkrsysinfo.sh gen-sysinfo.go - GOOS=$(GOOS) $(SHELL) $(srcdir)/mkrsysinfo.sh + GOARCH=$(GOARCH) GOOS=$(GOOS) $(SHELL) $(srcdir)/mkrsysinfo.sh $(SHELL) $(srcdir)/mvifdiff.sh tmp-runtime_sysinfo.go runtime_sysinfo.go $(STAMP) $@ diff --git a/libgo/Makefile.in b/libgo/Makefile.in index cbdd379..2452f96 100644 --- a/libgo/Makefile.in +++ b/libgo/Makefile.in @@ -3081,7 +3081,7 @@ s-version: Makefile runtime_sysinfo.go: s-runtime_sysinfo; @true s-runtime_sysinfo: $(srcdir)/mkrsysinfo.sh gen-sysinfo.go - GOOS=$(GOOS) $(SHELL) $(srcdir)/mkrsysinfo.sh + GOARCH=$(GOARCH) GOOS=$(GOOS) $(SHELL) $(srcdir)/mkrsysinfo.sh $(SHELL) $(srcdir)/mvifdiff.sh tmp-runtime_sysinfo.go runtime_sysinfo.go $(STAMP) $@ diff --git a/libgo/go/runtime/lfstack_64bit.go b/libgo/go/runtime/lfstack_64bit.go index 213efb1..b314a3b 100644 --- a/libgo/go/runtime/lfstack_64bit.go +++ b/libgo/go/runtime/lfstack_64bit.go @@ -32,9 +32,18 @@ const ( // bottom, because node must be pointer-aligned, giving a total of 19 bits // of count. cntBits = 64 - addrBits + 3 + + // On sparc64-linux, user addresses are 52-bit numbers sign extended to 64. + // We shift the address left 12 to eliminate the sign extended part and make + // room in the bottom for the count. + sparcLinuxAddrBits = 52 + sparcLinuxCntBits = 64 - sparcLinuxAddrBits + 3 ) func lfstackPack(node *lfnode, cnt uintptr) uint64 { + if GOARCH == "sparc64" && GOOS == "linux" { + return uint64(uintptr(unsafe.Pointer(node)))<<(64-sparcLinuxAddrBits) | uint64(cnt&(1<<sparcLinuxCntBits-1)) + } return uint64(uintptr(unsafe.Pointer(node)))<<(64-addrBits) | uint64(cnt&(1<<cntBits-1)) } @@ -44,5 +53,8 @@ func lfstackUnpack(val uint64) *lfnode { // val before unpacking. return (*lfnode)(unsafe.Pointer(uintptr(int64(val) >> cntBits << 3))) } + if GOARCH == "sparc64" && GOOS == "linux" { + return (*lfnode)(unsafe.Pointer(uintptr(int64(val) >> sparcLinuxCntBits << 3))) + } return (*lfnode)(unsafe.Pointer(uintptr(val >> cntBits << 3))) } diff --git a/libgo/mkrsysinfo.sh b/libgo/mkrsysinfo.sh index a86e914..6ab80e6 100755 --- a/libgo/mkrsysinfo.sh +++ b/libgo/mkrsysinfo.sh @@ -83,7 +83,11 @@ if grep '^const _epoll_data_offset ' ${OUT} >/dev/null 2>&1; then if test "$val" = "4"; then echo 'type epollevent struct { events uint32; data [8]byte }' >> ${OUT} elif test "$val" = "8"; then - echo 'type epollevent struct { events uint32; pad [4]byte; data [8]byte }' >> ${OUT} + if test "$GOARCH" = "sparc64" -a "$GOOS" = "linux"; then + echo 'type epollevent struct { events uint32; pad [4]byte; data [8]byte; _align [0]int64 }' >> ${OUT} + else + echo 'type epollevent struct { events uint32; pad [4]byte; data [8]byte }' >> ${OUT} + fi else echo 1>&2 "unknown epoll data offset value ${val}" exit 1 |