Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 21994

Unable to run asm program on macos

$
0
0

I am trying to run this asm file on my MacBook but I am getting the following warnings and errors:

ld: warning: option -s is obsolete and being ignored
ld: warning: platform not specified
ld: warning: -arch not specified
ld: warning: No platform min-version specified on command line
ld: warning: ignoring file ass1.o, building for -unknown but attempting to link with file 
built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 )
Undefined symbols for architecture unknown:
"_main", referenced from:
 implicit entry/start for main executable
 ld: symbol(s) not found for architecture unknown

my asm code is:

    section .data
        welmsg db 10, 'welcome to count +ve & -ve numbers in an array', 10
        welmsg_len equ $-welmsg

        pmsg db 10,'count of +ve numbers'
        pmsg_len equ $-pmsg

        nmsg db 10, 'count of -ve numbers'
        nmsg_len equ $-nmsg




        array dw 850h, 90ffh,87h,88h,89fh,0adh,02h
        arrcnt equ 7

        pcnt db 0
        ncnt db 0

section .bss
        dispbuff resb 2

    %macro print 2
        mov eax, 4
        mov ebx, 1
        mov ecx, %1
        mov edx, %2
        int 80h
    %endmacro


section .text
        global _start
        _start:
            print welmsg, welmsg_len
        mov esi, array
        mov ecx,arrcnt
        up1:
            bt word[esi],15
            jnc pnxt
            inc byte[ncnt]
            jmp pskip

        pnxt: inc byte[pcnt]

        pskip:inc esi   
              inc esi
        loop up1

        print pmsg, pmsg_len
        mov bl,[pcnt]
        call disp8num

        print nmsg,nmsg_len
        mov bl,[ncnt]
        call disp8num



exit:
        mov eax, 01
        mov ebx,0
        int 80h


disp8num:

        mov ecx,2
        mov edi,dispbuff

    dup1:
        rol bl,4
        mov al,bl
        and al,0fh
        cmp al,09
        jbe dskip
        add al,07h

    dskip:
        add al,30h
        mov[edi],al
        inc edi 
        loop dup1
        print dispbuff, 2

        ret 

I am running NASM 2.14 version. So can anyone help me to solve this error... thanks in advance


Viewing all articles
Browse latest Browse all 21994

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>