On Mon, Sep 9, 2019 at 8:09 AM Zhang Chao <zchao1...@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/CAOyqgcWrC8aGn7XqshfZbThvQuW04MQzfwWL-O0-1MuoQxngcw%40mail.gmail.com.

Reply via email to