linux – 没有使用库的Hello world
发布时间:2020-12-13 19:44:46 所属栏目:Linux 来源:网络整理
导读:这是一个现场采访问题,我很困惑. 我被要求为linux编写一个Hello世界程序 而不使用系统中的任何库.我想我必须使用 系统调用或某些东西..代码应该使用-nostdlib和 -nostartfiles选项.. 如果有人可以帮助,会很好 解决方法 $cat hwa.Swrite = 0x04exit = 0xfc.te
这是一个现场采访问题,我很困惑.
我被要求为linux编写一个Hello世界程序 如果有人可以帮助,会很好 解决方法$cat > hwa.S write = 0x04 exit = 0xfc .text _start: movl $1,%ebx lea str,%ecx movl $len,%edx movl $write,%eax int $0x80 xorl %ebx,%ebx movl $exit,%eax int $0x80 .data str: .ascii "Hello,world!n" len = . -str .globl _start $as -o hwa.o hwa.S $ld hwa.o $./a.out Hello,world! (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |