On 2012-11-29, Francis Dos Santos <[email protected]> wrote: > ARCH: amd64 > > I'm trying to learn some asm, but can't get an executable running. To > start off I'm trying my hand on a hello world program > http://www.int80h.org/bsdasm/ section 4.5 and chapter 5 with slight > adaptations. > Issuing the following commands results in: > > $ yasm -f elf64 hello.s > $ ld -s -o hello hello.o > ld: hello.o: relocation R_X86_64_32 can not be used when making a shared > object; recompile with -fPIC > hello.o: could not read symbols: Bad value > $ readelf -r hello.o
If this is post 5.2 then something like -static -nopie in the linker command line might help. There are still some rough edges now that PIE (position independent executables) are now the default.. > Relocation section '.rela.text' at offset 0x64 contains 1 entries: > Offset Info Type Sym. Value Sym. Name > + Addend > 000000000006 00030000000a R_X86_64_32 0000000000000000 .data + 0 > $ ld -nopie -static -s -o hello hello.o > $ hello > hello: Exec format error. Binary file not executable. > $ file hello > hello: ELF 64-bit LSB executable, x86-64, version 1, statically linked, > stripped This isn't marked as an OpenBSD executable in the notes section otherwise it would say "for OpenBSD" in the file(1) output. Older versions of OpenBSD permitted running code without this anyway but IIRC current ones don't. http://www.exploit-db.com/papers/13219/ _______________________________________________ Openbsd-newbies mailing list [email protected] http://mailman.theapt.org/listinfo/openbsd-newbies
