0

Assembly code:

section .text

global _start

_start:
  mov eax, 4
  mov ebx, 1
  mov ecx, message
  mov edx, message_len
  int 0x80
  
section .data
  message db "Hello, World!", 0x0a
  message_len equ $-message

compiling code:

rm Lab.o
rm lab
nasm -f elf -F dwarf -g Lab.asm
ld -m elf_i386 -o lab Lab.o

This is a basic Hello World program (called Lab.asm.)
When I compile the code and run it I get the following error: Bad system call (core dumped).
I can't seem to find the core dump to do gdb debugging, and I've tried compiling it in different ways. Any ideas what is going wrong here?

  • Your program has no ending. See [here about how to add one](https://stackoverflow.com/a/19760081/547981). Also make sure you are using 32 bit environment. – Jester Jan 10 '23 at 19:46
  • Turns out my environment is 64 bit. How do I edit these programs to make it work? @Jester – Cheesebellies Jan 10 '23 at 19:51
  • [Sample 64 bit hello world](https://stackoverflow.com/q/19743373/547981) – Jester Jan 10 '23 at 19:52

0 Answers0