On Mon, Sep 9, 2019 at 7:57 PM Zhang Chao <zchao1...@gmail.com> wrote: > > Thanks for your interpretation. So is there any workaround?
Don't try to call an internal runtime package function. Call a Go function defined in your own package that calls the print builtin. Ian > On Tuesday, September 10, 2019 at 10:55:00 AM UTC+8, Ian Lance Taylor wrote: >> >> On Mon, Sep 9, 2019 at 8:09 AM Zhang Chao <zcha...@gmail.com> wrote: >> > >> > I'm trying to write a tiny go program with a SayHello function written by >> > assembly. >> > When I build it, the go build command giving me an error message: >> > >> > # bar >> > main.asmSayHello: relocation target runtime.printstring not defined for >> > ABI0 (but is defined for ABIInternal) >> > >> > Here are the codes. >> > >> > main.go: >> > >> > package main >> > >> > func main() { asmSayHello() } >> > >> > func asmSayHello() >> > >> > and main_amd64.s: >> > >> > #include "textflag.h" >> > #include "funcdata.h" >> > >> > // "Hello, World\n" >> > DATA text<>+0(SB)/8,$"Hello Wo" >> > DATA text<>+8(SB)/8,$"rld!\n" >> > GLOBL text<>(SB),NOPTR,$16 >> > >> > // func asmSayHello() >> > TEXT ·asmSayHello(SB), $16-0 >> > NO_LOCAL_POINTERS >> > MOVQ $text<>+0(SB), AX >> > MOVQ AX, (SP) >> > MOVQ $16, 8(SP) >> > CALL runtime·printstring(SB) >> > RET >> > >> > The go facility version information: >> > >> > # go version >> > go version go1.12.5 linux/amd64 >> > >> > Anyone who can help me to solve this weird problem (at least for me :) )? >> >> You are trying to reach into the runtime package to run an internal >> function. That isn't permitted. It's never been permitted, although >> it used to work. Now it doesn't work. >> >> For more information see >> https://github.com/golang/proposal/blob/master/design/27539-internal-abi.md#compatibility >> . >> >> Ian > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/9d2517e2-0992-4631-a4dc-e854433423a4%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcUoLoC0G%2BesHAvOyhRpWgsWy2D%2BymLshePO0opNWONaLg%40mail.gmail.com.