Re: Problem with nasm
Brian Raiter <[email protected]>
| Newsgroups | org.kernel.vger.linux-assembly |
|---|---|
| Message-ID | <[email protected]> |
> bash-2.05b# cat exit.s > global _start: > > _start: > xor ebx, ebx > mov eax, 1 > int 80h > > > $ uname -srp > Linux 2.6.11-gentoo-r3 AMD Duron(tm) Processor I tried your file (both with and without the erroneous colon) and it worked fine. This was on a 2.4 Linux, however, using Nasm 0.98.38. > bash-2.05b# nasm -f elf -o exit.o exit.s > bash-2.05b# ld -o exit exit.o Try compiling with "gcc -nostartfiles -o exit exit.o" instead, and see if you get different results. If so, then gcc probably knows of some extra arguments that ld needs to produce a proper executable. Whenever feasible, you should let gcc do the linking for you instead of invoking ld directly. ld can take a lot of cmdline arguments. The "-nostartfiles" option will tell gcc not to supply a _start routine, and not to link in the usual C libraries. You will probably still get a slightly bigger executable than if you invoked ld directly, but not by much. b