加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 在ubuntu上运行汇编代码

发布时间:2020-12-14 02:20:41 所属栏目:Linux 来源:网络整理
导读:我试图运行的代码是吼叫. 我使用nasm util将其转换为目标文件.当我试图执行它时说“无法执行二进制文件”. 我运行命令: nasm -f elf -o helloworld.o helloworld.asm segment .datamsg db "Hello,world!",10len equ $- msgsegment .textglobal _start_start
我试图运行的代码是吼叫.
我使用nasm util将其转换为目标文件.当我试图执行它时说“无法执行二进制文件”.

我运行命令:
nasm -f elf -o helloworld.o helloworld.asm

segment .data
msg  db   "Hello,world!",10
len  equ  $- msg

segment .text
global _start

_start:
   mov  eax,4
   mov  ebx,1
   mov  ecx,msg
   mov  edx,len
   int  80h

   mov  eax,1
   mov  ebx,0
   int  80h

这是我的第一个程序集,我没有使用ubuntu除了编译一些
基本的c程序.我需要一些帮助,谢谢大家.

解决方法

它对我来说非常适合您的代码.

你链接了最终的目标文件了吗?

试试这个:ld helloworld.o -o helloworld

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读