NASM compiled and linked with ld executable always errors

Bug description:
when I compile my asm, which is this `
section .text
global _start
mov edx, 4
mov ecx, a
mov ebx, 1
mov eax, 4
int 0x80
mov eax, 1
int 0x80

section .data
a db “test”
and compile it using these commands

  • nasm -f elf64 out.asm -o out.nasm
  • ld out.nasm -o out.o
  • chmod +x out.o
    and then run it with ./out.o it just says Bad system call (core dumped)

Expected vs Current Behavior:
I expect it to print “test” and then exit

current behavior is it erroring with Bad system call (core dumped) even though it works in a non replit environment

Steps to reproduce:

  1. start a blank replit
  2. install nasm
  3. make file called out.asm with the code supplied above
  4. run the following command nasm -f elf64 out.asm -o out.nasm; ld out.nasm -o out.o; chmod +x out.o; rm -f out.asm; rm -f out.nasm
  5. run ./out.o

Bug appears at this link:

Browser/OS/Device: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Replit Profile:

1 Like