简体   繁体   English

我无法在ubuntu中执行二进制文件。 它给出错误:bash,无法执行二进制文件

[英]i am unable to execute binary file in ubuntu. it gives error: bash, cant execute binary file

$file as1 as1: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped $ file as1 as1:ELF 64位LSB可执行文件,x86-64,版本1(SYSV),静态链接,未剥离

$file /bin/ls /bin/ls: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped $ file / bin / ls / bin / ls:用于GNU / Linux 2.6.15的ELF 32位LSB可执行文件,英特尔80386版本1(SYSV),动态链接(使用共享库),

how do i run the binary? 我如何运行二进制文件?

Code: 码:

  SECTION .data
msg1 db "HELLO WORLD !!!",0ah   ;msg to be print
msg1len equ $-msg1
SECTION .bss

SECTION .text
GLOBAL _start
_start:
mov rax,1                       ;system read call
mov rdi,1
mov rsi,msg1
mov rdx,msg1len
syscall

mov eax,60          ;system end call
mov edi,0
syscall

I assume as1 is your compiled assembley file. 我假设as1是您的已编译汇编文件。 You seem to be running a 32-bit system according to the result of file /bin/ls . 根据file /bin/ls的结果,您似乎正在运行32位系统。 You can confirm you have an 32 bit kernel using uname -m . 您可以使用uname -m确认您拥有32位内核。 In that case it's impossible to run your program since you seem to be using the 64 bit registers rax ... 在这种情况下,由于您似乎正在使用64位寄存器rax ,因此无法运行程序。

you can either setup a 64-bit system or rewrite your program to use only 32-stuff. 您可以设置64位系统,也可以重写程序以仅使用32位的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM