Hi, I'm having problems running a program I wrote. I wrote this program that should just exit with exitcode 44:
// prog.S #include <sys/syscall.h> .text .globl _start _start: subl $8, %esp pushl $44 movl $SYS_exit, %eax pushl $0 int $0x80 I compiled with $ cc prog.S -nostdlib -o a.out and run $./a.out Doing so on FreeBSD 13.0-RELEASE i386 (clang 11.0.1) worked fine. In fact, the executable runs and the exit code of the program is 44 as it should be. However, doing the same on OpenBSD 7.0 GENERIC.MP#5 i386 and on NetBSD 9.2 i386 (gcc 7.5.0), the kernel refused to execute the code and it was passed to the shell, which of course failed: openbsd$ ./a.out ./a.out[1]: syntax error: `(' unexpected openbsd$ file a.out a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, not stripped openbsd$ objdump -d a.out a.out: file format elf32-i386 Disassembly of section .text: 00001184 <_start>: 1184: 83 ec 08 sub $0x8,%esp 1187: 6a 2c push $0x2c 1189: b8 01 00 00 00 mov $0x1,%eax 118e: 6a 00 push $0x0 1190: cd 80 int $0x80 I saw, however, that changing _start to main and compiling without -nostdlib worked fine. What am I doing wrong?