64 bit assembler > ASMC Development

Linux and LIBC

(1/2) > >>

nidud:
I've added _LINUX and _WIN64 to switch -elf, -elf64, and -win64

-elf --> _LINUX = 1
-elf64 --> _LINUX = 2 + _WIN64 = 1
-win64 --> _WIN64 = 1

libc.inc use SYSCALL if elf is defined.

--- Code: ---ifdef _LINUX
_CType equ <syscall>
_CDecl equ <syscall>
__cdecl equ <syscall>

--- End code ---

This enables use of the include files for LIBC functions.

Test case used for 64-bit:

--- Code: ---include stdio.inc

    .code

main proc argc:SINT, argv:ptr

    .for r12d=argc, r13=argv, ebx=0: r12d: r12d--, ebx++, r13+=size_t
       
    printf("[%d]: %s\n", ebx, [r13])
    .endf
    xor eax,eax
    ret
main endp

    end

--- End code ---

Output:

--- Code: ---nidud@nidud-VB ~/asmc $ ./asmc -q -Iinclude -elf64 arg64.asm
nidud@nidud-VB ~/asmc $ gcc -o arg64 arg64.o
nidud@nidud-VB ~/asmc $ ./arg64 1 2 3
[0]: ./arg64
[1]: 1
[2]: 2
[3]: 3

--- End code ---

Test case used for 32-bit:

--- Code: ---include stdio.inc

    .code

main proc argc:SINT, argv:ptr

    .for ebx=argc, esi=argv, edi=0: ebx: ebx--, edi++, esi+=size_t

    printf("[%d]: %s\n", edi, [esi])
    .endf
    xor eax,eax
    ret
main endp

    end

--- End code ---

Output:

--- Code: ---nidud@nidud-VB ~ $ cd asmc
nidud@nidud-VB ~/asmc $ ./asmc -elf -Iinclude arg32.asm
Asmc Macro Assembler Version 2.24
Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved.

 Assembling: arg32.asm
nidud@nidud-VB ~/asmc $ gcc arg32.o -o arg32
nidud@nidud-VB ~/asmc $ ./arg32
[0]: ./arg32
nidud@nidud-VB ~/asmc $ ./arg32 1 2 3
[0]: ./arg32
[1]: 1
[2]: 2
[3]: 3

--- End code ---

I also changed the default size of indirect addressing using register in 64-bit. This was 4 but now 8. This effect :VARARG arguments using -elf64 and -win64.

--- Code: ---     printf("[%d]: %s\n", ebx, [r13])

--- End code ---

Greenhorn:
Hi nidud,

I'm trying to get ASMC working for me, but it throws an error "A2005: symbol redefinition : _WIN64".
After removing the switch /D"_WIN64" from command line and quoted out the one and only conditional definition of _WIN64 in my header files, I still get that error. Now I'm at a loss about that and don't know what to do to get it working.

In my opinion the definition of such macros shoul be the responsibility of the toolset where it is needed. In this case the windows header files or it should be the programmer's responsibility.

However, keep on the good work on ASMC.

Kind Regards
Greenhorn

nidud:
I ended up writing quite a few of these command lines:
asmc -q -win64 -D_WIN64 -ws -D_UNICODE $*.asm

So the logic here is:
-win64 defines _WIN64
-ws defines _UNICODE
-elf defines _LINUX=1
-elf64 defines _LINUX=2

However, the first version created a problem if the symbol was already defined. This is fixed in later versions so the Linux version needs an update. The development is currently done in assembler so the C source to build an updated version is currently missing.

EDIT:
Added version 2.27J-Linux to the download page.

Greenhorn:
Hi,

thanks for your quick reply.

The problem occurs with using Windows. I've got ASMC working with Visual Studio 2010.

Command line is:

--- Code: ---asmc.exe /c -win64 -Zp8 /nologo /ws /Sg /Zi /Fo"x64\Debug\%(FileName).obj" /D"WIN32" /D"_DEBUG" /D"_WINDOWS" /D"_UNICODE" /D"UNICODE" /Fl"x64\Debug\%(Filename).lst" /I"D:\Win7Inc\include" /Cp /W2 /win64 /Zp8
--- End code ---

The only possible definition of _WIN64 is in Winasm.inc (originally from Japhet's WinInc files).
So I've quoted out:

--- Code: ---ifndef _WIN64
if near eq 0ff08h   ;64-bit enabled?
;_WIN64 equ <>
endif
endif

--- End code ---

Downloaded version 2.27J from today and unfortunately the error still occurs.
Seems that I'm too stupid. Cannot find the error. Searched all files for _WIN64 ... *sigh*


Regards

Greenhorn:
Sorry, and yes, I'm definitely too stupid !

The command line contains: -win64 and -Zp8, which is doubled defined in command line. But it's not generated by Visual Studio. VS uses "/" and not "-" as switch prefix. So this is also generated by ASMC ?

Now I'm a little bit confused, but at first I'll go and rubbing the tomatoes out of my eyes ...

Edit:
Mmmh, "-win64 -Zp8" appears in project settings command line, so ... mmh.   :icon_confused:

Edit:
Aaargh, got it. I've modified Japhet's VS2010 Cunstom Build Rule files to create the ASMC build files. Japhet predefind in *.props file -win64 -Zp8 for x64 build.

Sorry for stealing your time, nidud.

Navigation

[0] Message Index

[#] Next page

Go to full version