Hi I had to write a AT&T x86 assembly to Intel assembly.
.section .data
str: .ascii "Hello world!\n"
strlen = . - str
num: .long 1337
.section .text
.global _start
_start:
movl $4, %eax
movl $1, %ebx
movl $str, %ecx
movl $strlen, %edx
int $0x80
movl $1, %eax
movl $0, %ebx
int $0x80
That's AT&T
.intel_syntax noprefix
.section .data
str: .ascii "Hello world!\n"
strlen = . - str
num: .long 1337
.section .text
.global _start
_start:
mov eax, 4
mov ebx, 1
mov ecx, offset str
mov edx, strlen
int 0x80
mov eax, 1
mov ebx, 0
int 0x80
Why do I need this offset. I found it in another Stack Overflow question.
Compiling with:
as --32 -o hello.o helloworld-a.asm
ld -m elf_i386 -o hello hello.o
./hello
When I don't use it, I have no output on console.
Thanks :)