[英]Putting a static address into a register with GNU AS (GAS) .intel_syntax?
.intel_syntax noprefix
.global _start
.text
_start:
mov eax, 4
mov ebx, 1
mov ecx, msg
mov edx, 15
int 0x80
mov eax, 1
mov ebx, 14
int 0x80
.data
msg:
.ascii "Hello, World!\n"
I am trying to compile the above code via GNU AS using the following commands: 我正在尝试使用以下命令通过GNU AS编译以上代码:
asad@Arcturus:~/Desktop/ZJNK$ as --32 -msyntax=intel code.S -o code.o
asad@Arcturus:~/Desktop/ZJNK$ ld -m elf_i386 code.o -o a.out
asad@Arcturus:~/Desktop/ZJNK$ ./a.out
asad@Arcturus:~/Desktop/ZJNK$
But I cannot get any output on the terminal. 但是我无法在终端上获得任何输出。 However, the exit code is still readable:
但是,退出代码仍然可读:
asad@Arcturus:~/Desktop/ZJNK$ echo $?
14
I am using 64-bit Linux and am able to run the above code via nasm after required changes. 我使用的是64位Linux,并且在进行了必要的更改后能够通过nasm运行以上代码。
What could have gone wrong? 可能出了什么问题?
要加载味精的地址,请使用
mov ecx, offset msg
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.