The MASM Forum

64 bit assembler => UASM Assembler Development => Topic started by: johnsa on October 26, 2022, 07:21:22 AM

Title: UASM 2.56 is available
Post by: johnsa on October 26, 2022, 07:21:22 AM
Hi all,

Packages are on the site, as always the latest code+tests are in Github, v2.56 branch.
Title: Re: UASM 2.56 is available
Post by: jj2007 on October 26, 2022, 08:11:42 AM
For 32-bit code, all is fine, tested with over 2MB of sources :thumbsup:
Title: Re: UASM 2.56 is available
Post by: learn64bit on October 26, 2022, 04:41:50 PM
Now github also have binaries. Are  they the same? (both sites did not have sha1sum)
Title: Re: UASM 2.56 is available
Post by: mabdelouahab on October 26, 2022, 05:30:36 PM
For linux  :thumbsup:
Title: Re: UASM 2.56 is available
Post by: Biterider on October 26, 2022, 07:26:44 PM
Hi
Epic version number  :cool:
Tested here and all is fine.  :thumbsup:

Biterider
Title: Re: UASM 2.56 is available
Post by: johnsa on October 26, 2022, 10:28:19 PM
the binaries on Github are the same release as the website packages.
Title: Re: UASM 2.56 is available
Post by: Vortex on October 27, 2022, 04:32:20 AM
Hi John,

Thanks for the update :thumbsup:
Title: Re: UASM 2.56 is available
Post by: rsala on October 27, 2022, 07:33:49 PM
Hi John,

Thanks for your good work!  :thumbsup:
Easy Code compiles and works fine with this last version of UASM. :eusa_clap:
Title: Re: UASM 2.56 is available
Post by: lucho on October 28, 2022, 03:51:25 AM
Thank you for all your good work and for releasing version 2.56!

When I downloaded https://github.com/Terraspace/UASM/archive/refs/tags/v2.56.tar.gz , it turned out that all file dates are 16 March 2022 and _UASM_VERSION_STR_ and _UASM_VERSION_INT_ in H/globals.h are 2.53 and 253, respectively. I wondered why this is so, but changed them to 2.56 and 256 and managed to build macOS and FreeBSD versions using the patch below. But it turned out that the ELF ABI generated by the FreeBSD version is still GNU/Linux, as it was in the older versions. Didn't you pack version 2.53 instead of 2.56 in that archive by mistake?

--- H/globals.h- 2022-03-16 19:54:47.000000000 +0200
+++ H/globals.h 2022-10-27 13:37:01.000000000 +0300
@@ -202,11 +202,11 @@

/* Uasm version info */
#ifdef _WIN64
-#define _UASM_VERSION_STR_ "2.53"
+#define _UASM_VERSION_STR_ "2.56"
#else
-#define _UASM_VERSION_STR_ "2.53"
+#define _UASM_VERSION_STR_ "2.56"
#endif
-#define _UASM_VERSION_INT_ 253
+#define _UASM_VERSION_INT_ 256
#define _UASM_VERSION_SUFFIX_ "pre"
#define _UASM_VERSION_ _UASM_VERSION_STR_ //_UASM_VERSION_SUFFIX_

--- dbgcv.c- 2022-03-16 19:54:47.000000000 +0200
+++ dbgcv.c 2022-10-27 13:03:08.000000000 +0300
@@ -17,7 +17,14 @@
#include <fixup.h>
#include <dbgcv.h>
#include <linnum.h>
-#include <direct.h>
+#ifdef _WIN32
+ #include <direct.h>
+#else
+ #include <unistd.h>
+ #define _MAX_PATH 256
+ #define _getcwd getcwd
+ #define _pgmptr "uasm"
+#endif
#include <picohash.h>

#define SIZE_CV_SEGBUF ( MAX_LINE_LEN * 4 )
@@ -1575,12 +1582,12 @@
len = strlen(p) + 1;
s = strcpy(s, p) + len;
*s++ = '\0';
- EnvBlock->reclen = (unsigned short)(s - cv.ps - 2);
+ EnvBlock->reclen = (unsigned short)(s - (char *)cv.ps - 2);
cv.ps = s;

/* length needs to be added for each symbol */

- cv.section->length += (s - start);
+ cv.section->length += (s - (char *)start);

}
else {
--- gccLinux64.mak- 2022-03-16 19:54:47.000000000 +0200
+++ gccLinux64.mak 2022-10-27 13:32:05.000000000 +0300
@@ -1,5 +1,5 @@

-# This makefile creates the UASM Elf binary for Linux/FreeBSD.
+# This makefile creates the UASM binary for Linux/FreeBSD/macOS.

TARGET1=uasm

@@ -19,7 +19,13 @@
OUTD=GccUnixD
endif

-c_flags =-D __UNIX__ $(extra_c_flags)
+c_flags =-D __UNIX__ $(extra_c_flags) -fcommon
+
+ifeq ($(MAKE_VERSION), 3.81) # macOS
+ MAPFLAG=-map
+else
+ MAPFLAG=-Map
+endif

CC = gcc

@@ -40,9 +46,9 @@

$(OUTD)/$(TARGET1) : $(OUTD)/main.o $(proj_obj)
ifeq ($(DEBUG),0)
- $(CC) -D __UNIX__ $(CFLAGS) $(OUTD)/main.o $(proj_obj) -s -o $@ -Wl,-Map,$(OUTD)/$(TARGET1).map $(LDFLAGS)
+ $(CC) -D __UNIX__ $(CFLAGS) $(OUTD)/main.o $(proj_obj) -s -o $@ -Wl,$(MAPFLAG),$(OUTD)/$(TARGET1).map $(LDFLAGS)
else
- $(CC) -D __UNIX__ $(CFLAGS) $(OUTD)/main.o $(proj_obj) -o $@ -Wl,-Map,$(OUTD)/$(TARGET1).map $(LDFLAGS)
+ $(CC) -D __UNIX__ $(CFLAGS) $(OUTD)/main.o $(proj_obj) -o $@ -Wl,$(MAPFLAG),$(OUTD)/$(TARGET1).map $(LDFLAGS)
endif

$(OUTD)/msgtext.o: msgtext.c H/msgdef.h
@@ -54,6 +60,6 @@
######

clean:
- rm $(OUTD)/$(TARGET1)
- rm $(OUTD)/*.o
- rm $(OUTD)/*.map
+ rm -f $(OUTD)/$(TARGET1)
+ rm -f $(OUTD)/*.o
+ rm -f $(OUTD)/*.map
Title: Re: UASM 2.56 is available
Post by: johnsa on October 28, 2022, 04:17:48 AM
Nope, I have no idea wtf Github is doing. I created the 2.56 release and attached the binary packages for 2.56, it then somehow went ahead and made it's own tag which seems to be pointing at the wrong version :( Will trying and sort it out, if needs be, just download the archive directly from the v2.56 branch.
Title: Re: UASM 2.56 is available
Post by: johnsa on October 28, 2022, 04:35:40 AM
The tags/releases on Github should be correct now.
I've also updated all the packages, repo code+releases to solve a bug that JJ discovered (spotting award to him!).
Latest releases dated today 27th Oct.

Regards,
John
Title: Re: UASM 2.56 is available
Post by: lucho on October 28, 2022, 06:17:50 AM
Ah, this time it's OK! Thank you very much! Then here's what has left from my patch:

--- gccLinux64.mak-     2022-10-27 20:25:27.000000000 +0300
+++ gccLinux64.mak      2022-10-28 09:27:33.664379007 +0300
@@ -1,5 +1,5 @@

-# This makefile creates the UASM Elf binary for Linux/FreeBSD.
+# This makefile creates the UASM binary for Linux/FreeBSD/macOS/Solaris.

TARGET1=uasm

@@ -19,8 +19,16 @@
OUTD=GccUnixD
endif

-c_flags =-D __UNIX__ $(extra_c_flags)
+c_flags =-D __UNIX__ $(extra_c_flags) -fcommon

+ifeq ($(MAKE_VERSION), 3.81)   # macOS
+ MAPFLAG=-map,
+else ifeq ($(MAKE_HOST), x86_64-pc-solaris2.11)
+ MAPFLAG=-m>
+else
+ MAPFLAG=-Map,
+endif
+
#From CLANG 11+, default has changed from allowing global variables to be defined in the headers (-fcommon) to not allowing it (-fno-common)."   USE: make CC="clang -fcommon" -f gccLinux64.mak
CC = gcc

@@ -41,9 +49,9 @@

$(OUTD)/$(TARGET1) : $(OUTD)/main.o $(proj_obj)
ifeq ($(DEBUG),0)
-       $(CC) -D __UNIX__ $(CFLAGS) $(OUTD)/main.o $(proj_obj) -s -o $@ -Wl,-Map,$(OUTD)/$(TARGET1).map $(LDFLAGS)
+       $(CC) -D __UNIX__ $(CFLAGS) $(OUTD)/main.o $(proj_obj) -s -o $@ -Wl,$(MAPFLAG)$(OUTD)/$(TARGET1).map $(LDFLAGS)
else
-       $(CC) -D __UNIX__ $(CFLAGS) $(OUTD)/main.o $(proj_obj) -o $@ -Wl,-Map,$(OUTD)/$(TARGET1).map $(LDFLAGS)
+       $(CC) -D __UNIX__ $(CFLAGS) $(OUTD)/main.o $(proj_obj) -o $@ -Wl,$(MAPFLAG)$(OUTD)/$(TARGET1).map $(LDFLAGS)
endif

$(OUTD)/msgtext.o: msgtext.c H/msgdef.h
@@ -55,6 +63,6 @@
######

clean:
-       rm $(OUTD)/$(TARGET1)
-       rm $(OUTD)/*.o
-       rm $(OUTD)/*.map
+       rm -f $(OUTD)/$(TARGET1)
+       rm -f $(OUTD)/*.o
+       rm -f $(OUTD)/*.map


If needed, I could upload here (as a ZIP attachment) the FreeBSD, macOS and Solaris binaries built using GCC after applying this patch. (For macOS, GCC is available after installing "gfortran", which can be found at https://github.com/fxcoudert/gfortran-for-macOS/releases .) Let me know if that would be helpful...
Title: Re: UASM 2.56 is available
Post by: johnsa on October 28, 2022, 06:45:52 AM
That would be great, I can add them to the site (I no longer have access to build MacOS versions, and I sort of lost interest when I learnt of their plans to move to ARM.. blegh)
Title: Re: UASM 2.56 is available
Post by: daydreamer on October 28, 2022, 05:33:57 PM
Thanks johnsa  :thumbsup:
Title: Re: UASM 2.56 is available
Post by: lucho on October 28, 2022, 06:13:58 PM
Quote from: johnsa on October 28, 2022, 06:45:52 AM
That would be great, I can add them to the site (I no longer have access to build MacOS versions, and I sort of lost interest when I learnt of their plans to move to ARM.. blegh)
OK, see the attached ZIP files in my next messages. (For Solaris, I had to modify the makefile again, so I updated the patch in my previous message today.)

As far as I know, Mac Pros still have an x86-64 CPUs, including the Mac Pro Server. As long as this is true, Hackintoshes will still be created...  :biggrin:
BTW, it'd be interesting to port UASM to generate ARM and/or ARM64 code, but that would be a so big effort that hardly anybody would ever make it.
Title: Re: UASM 2.56 is available
Post by: lucho on October 28, 2022, 06:17:24 PM
macOS binary attached.
Title: Re: UASM 2.56 is available
Post by: lucho on October 28, 2022, 06:21:12 PM
FreeBSD binary attached.
Title: Re: UASM 2.56 is available
Post by: lucho on October 28, 2022, 06:24:23 PM
Solaris binary attached.
Title: Re: UASM 2.56 is available
Post by: johnsa on October 28, 2022, 10:30:56 PM
Big thanks for the archives! I will package those up and add them to the site!

I had though about ARM/ARM64 support before, it's so fundamentally different and UASM has so much x86 specific stuff in it that we might as well build a totally new assembler for it. That would be a big job, and I have to say the existing ARM assemblers are awful, it could certainly be made a lot easier with a decent ASM that has proper invoke/HLL/stack-frame support etc.
Title: Re: UASM 2.56 is available
Post by: TimoVJL on October 28, 2022, 11:39:22 PM
Big thanks John
Its important to have an UAsm, to share best ways for special purboses, where C won't ever serve in best way :thumbsup:
Title: Re: UASM 2.56 is available
Post by: mineiro on November 15, 2022, 08:28:17 AM
Hello sir johnsa; I faced a problem.
Code bellow worked in version 255 but not in 256, please, can you check. Thanks.
Linux x86_64, stack unbalanced.

;uasm -elf64 test.asm
;gcc test.o -no-pie -fno-pie -lc -o test
;./test
.X64
option casemap:none

InitializeRandoms proto
srand proto :dword
exit proto :dword

.code
main proc uses rbx rbp r12 r13 r14 r15 _argc:dword,_argv:ptr

local argc:dword
local argv:ptr

mov argc,_argc
mov argv,_argv

invoke InitializeRandoms
invoke exit,0
main endp

;-------------------------------------------------------------
;no locals
align 16
InitializeRandoms proc
;sub rsp,8 ok
    invoke srand,4711
    ;add rsp,8 !!!    <--------------|
ret
InitializeRandoms endp
;-------------------------------------------------------------

end main

I do not have a github account, so, I'm posting here.
Title: Re: UASM 2.56 is available
Post by: johnsa on November 16, 2022, 04:48:55 AM
Thanks, will check it out. I made some changes to correct a few other issues with Linux stack balancing, so this might be a regression there.
Title: Re: UASM 2.56 is available
Post by: mineiro on November 16, 2022, 07:17:34 AM
Thank you sir johnsa;