On 2012-10-13, Chris Bennett <ch...@bennettconstruction.us> wrote:
> I am getting errors with nasm.
>
> # nasm -f aoutb hello.asm       
> # ld -e _start -o hello hello.o 
> ld: warning: cannot find entry symbol _start; defaulting to 1c000114
> # ./hello                       
> ./hello[1]: syntax error: `(' unexpected
>
> or 
>
> # nasm -f aout  hello.asm   
> # ld -s -o hello hello.o     
> hello.o: file not recognized: File format not recognized
>
> or
>
> # nasm -f elf  hello.asm                         
> # ld -s -o hello hello.o                         
> ld: warning: cannot find entry symbol _start; defaulting to 1c000120
> # ./hello                                        
> ./hello[1]: syntax error: `(' unexpected
>
> I have never had a problem previously.
> This is the latest version of nasm-2.10.04
>
> I am running:
>
> OpenBSD 5.2-current (GENERIC) #22: Mon Sep 24 18:31:52 MDT 2012
>     t...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
> cpu0: Intel(R) Pentium(R) III Mobile CPU 1000MHz ("GenuineIntel" 686-class) 1 
> GHz
> cpu0: 
> FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PSE36,MMX,FXSR,SSE
>
>

As of sys/kern/exec_elf.c r1.88 OpenBSD requires the binary to be
tagged as being for OpenBSD - add a .note.openbsd.ident elf(5) note
section, see http://www.exploit-db.com/papers/13219/ for more info.
(note that the method described later in the file in "We can execute
bin's without the use of the .note section if we brand the file
using olf2elf" is no longer possible).

Specifically, if file(1) does not say "for OpenBSD" then the file
can not be executed.

Reply via email to