[英]Error “16434 illegal hardware instruction ./a.out” when running x86 executable
I'm learning the basics of x86 via this free book . 我正在通过这本免费书籍学习x86的基础知识。
Keep in mind this is specific to macOS x86 compared to Linux x86. 请记住,与Linux x86相比,这特定于macOS x86。
Its made for GNU Linux, so I have to change some of the code which is probably where I went wrong. 它是为GNU Linux设计的,因此我必须更改一些代码,这可能是我出错的地方。 I took this code snippet: 我使用了以下代码片段:
.section .data
.section .text
.globl _start
_start:
movl $1, %eax
movl $0, %ebx
int $0x80
After a bit of googling about x86 on macOS I turned that bit of code into this: 在macOS上对x86进行了一些搜索之后,我将这段代码变成了:
.data
.text
.globl _main
_main:
movl $1, %eax
movl $0, %ebx
int $0x80
I compiled this using gcc test.s
which compiles it into a.out
. 我使用gcc test.s
文件编译为a.out
。 When trying to run it using ./a.out
I get the error [1] 17301 illegal hardware instruction ./a.out
. 尝试使用./a.out
运行它时,出现错误[1] 17301 illegal hardware instruction ./a.out
。
Any help is appreciated, thanks! 任何帮助表示赞赏,谢谢!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.