Error While linking file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

   I was just tring the simple "hello world" assembly program in linux. First time I was able to compile and link the file.
   I just changed something in that file, I got the following error while linking it.

    test.o: file not recognized: File format not recognized

   I am not able tounderstand what is the exact problem with it.

   I had used the following two commands to compile nad link the progam.

    nasm -f aout test.asm
    ld -e _start -o test test.o
 
    my program looks as follows

  section .text
    global _start                       ;must be declared for linker (ld)

_start:                                 ;tell linker entry point

        mov     edx,len ;message length
        mov     ecx,msg ;message to write
        mov     ebx,1   ;file descriptor (stdout)
        mov     eax,4   ;system call number (sys_write)
        int     0x80    ;call kernel

        mov     eax,1   ;system call number (sys_exit)
        int     0x80    ;call kernel

section .data

msg     db      'Hello, world!',0xa     ;our dear string
len     equ     $ - msg                 ;length of our dear string

what might be the problem here?

Regards
Manjunath


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux