我目前正在尝试学习我的Trisquel发行版(我猜是在引擎盖下使用Ubuntu?)上的程序集。出于某种原因,我被困在创建和执行程序集片段的第一步。bash,无法执行二进制文件
.section data
.section text
.globl _start
_start:
movl $1, %eax # syscall for exiting a program
movl $0, %ebx # status code to be returned
int $0x80
当我尝试汇编和链接它创建一个可执行文件并运行可执行文件,我得到的是这样的:
> as myexit.s -o myexit.o && ld myexit.o -o myexit
> ./myexit
bash: ./myexit: cannot execute binary file
我不知道究竟是怎么回事。在四处搜索后,似乎通常会在尝试在64位操作系统上执行32位可执行文件时弹出此错误,反之亦然,但这种情况并非如此。
这里是file
输出和uname
命令:
$ file myexit
myexit: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, not stripped
$ uname -a
Linux user 2.6.35-28-generiC#50trisquel2-Ubuntu SMP Tue May 3 00:54:52 UTC 2011 i686 GNU/Linux
有人可以帮助我了解究竟是怎么回事错在这里?谢谢。
可执行位在那里,对吗? – 2012-01-08 19:17:48
@Uku:是的,否则它通常会给予'拒绝的权限'错误 – sasuke 2012-01-08 19:23:39
我自己这么想,但只是检查。 – 2012-01-08 19:25:13