Skip to content

3.1.4 定义 main() 函数 无法编译 #443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
two opened this issue Jul 26, 2019 · 3 comments
Closed

3.1.4 定义 main() 函数 无法编译 #443

two opened this issue Jul 26, 2019 · 3 comments

Comments

@two
Copy link

two commented Jul 26, 2019

3.1.4 编译报错:
main.main: relocation target runtime.printstring not defined for ABI0 (but is defined for ABIInternal)
main.main: relocation target runtime.printnl not defined for ABI0 (but is defined for ABIInternal)

@chai2010
Copy link
Owner

参考 #427

主要原因是Go语言的内部ABI发生了变化,现在无法直接调用其它包内部函数。
一个临时解决方法是,在当前包用Go实现一个 println 或 printstring 函数,
然后 runtime·printstring 替换为 ·printstring

@two
Copy link
Author

two commented Jul 26, 2019

参考 #427

主要原因是Go语言的内部ABI发生了变化,现在无法直接调用其它包内部函数。
一个临时解决方法是,在当前包用Go实现一个 println 或 printstring 函数,
然后 runtime·printstring 替换为 ·printstring

已解决,多谢

@two two closed this as completed Jul 26, 2019
@bluesky9981
Copy link

failed

hello-main go build

Go-code/ch3.8/hello-main

./main_amd64.s:6: unexpected EOF
asm: assembly of ./main_amd64.s failed

在.s文件最后加一空行就行了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants