Closed
Description
What version of Go are you using (go version
)?
$ go version go version go1.12.7 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GOARCH="amd64" GOBIN="" GOCACHE="/Users/purewhite/Library/Caches/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/purewhite/go" GOPROXY="" GORACE="" GOROOT="/usr/local/Cellar/go/1.12.7/libexec" GOTMPDIR="" GOTOOLDIR="/usr/local/Cellar/go/1.12.7/libexec/pkg/tool/darwin_amd64" GCCGO="gccgo" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/gr/t7x82cps0w563940rhk76_400000gn/T/go-build992278676=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
I'm studying go asm, and want to write a demo to get the *g.
According to the doc, I should be able to get *g using code like this:
#include "textflag.h"
#include "go_asm.h"
TEXT ·getg(SB),NOSPLIT,$0-8
get_tls(CX)
MOVQ g(CX), AX
MOVQ AX, ret+0(FP)
RET
What did you expect to see?
Successfully get current g's address.
What did you see instead?
$ go build .
# local/study/getg
./getg.s:5: unrecognized instruction "get_tls"
./getg.s:6: expected pseudo-register; found CX
./getg.s:7: expected pseudo-register; found AX
asm: assembly of ./getg.s failed