News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

UASM 2.57

Started by johnsa, August 11, 2024, 07:51:42 AM

Previous topic - Next topic

johnsa

Finally after a long hiatus.. UASM 2.57 is up!
Latest code in v2.57 branch on GitHub + Releases as well as binary packages on the web, https://www.terraspace.co.uk/uasm.html

Changes:
1. Added aam/aad imm8 missing instruction variant.
2. Added corrections for constant too large warnings and included >64bit size immediate errors.
3. Corrected a conflict between local and struct having the same name.
4. Updated the encoding of xchg eax,eax to not just be a NOP in 64bit code as a side effect is clearing the top half of RAX.
5. Reduced unnecessary REX prefixes in PROC prologue.
6. Cleaned up makefile names
7. Fixed a general failure on empty unions.
8. Applied typedef ptr fix in legacy codeview symbolic debugging info.
9. Noted string literal usage in manual.
10. Fixed a stack balancing regression leading to an umatched add/sub rsp,8 pair for Linux 64bit.
11. Prevented vmovd/vmovq from accepting ymm or zmm registes.
12. Prevent OR rax,64bit immediate and other instructions that aren't MOV.
13. Based on a patch to original Jwasm which may have entered an infinite loop if a structured variable wasn't
    defined (yet), but a member name matched a local name.
14. Included Vortex Def2Lib utility in the distribution with Import Definitions kindly supplied from MASM32.
    Can be run via MakeLib.bat or   
    def2lib *.def
    def2lib ntvdm.def -e

fearless


Biterider

#2
Hi Johnsa
Thank you very much for this update  :thumbsup:
I'm testing it now, but to get this version from the UASM site, I had to download the x64, x86 and Linux64 versions directly using:

https://www.terraspace.co.uk/uasm257_x64.zip
https://www.terraspace.co.uk/uasm257_x86.zip
https://www.terraspace.co.uk/uasm257_linux64.zip

I'm unsure if the github main is merged with the 257 branch
QuoteThis branch is 66 commits ahead of, 15 commits behind master.

Regards, Biterider
 

jj2007


johnsa

master branch isn't merged yet, the source is in the v2.57 release branch still.

Strange that you had do d/l directly, releases should be on the GitHub page as well as via the website?

Biterider

Hi John
Checking the UASM webpage again and now is is shown correctly with version 2.57. 
Maybe a cache issue...

Biterider

Vortex


mabdelouahab

Thank you, Johnsa. The problem has been resolved  :thumbsup:
But the floating-point bug that I mentioned in this topic Floating point arguments still remains. I hope you can fix it in future updates. Thanks anyway.

mabdelouahab

Hello Johnsa

I've noticed that the '-Fo' option, which is documented to set object file name, does not seem to be working as expected. When I try to use this option, the assembler doesn't produce the desired output, and the functionality appears to be broken or unsupported on Linux.

Could you please investigate this issue and provide a fix or guidance on how to use this option correctly in a Linux environment?

Best regards

johnsa

Quote from: mabdelouahab on August 11, 2024, 07:34:47 PMThank you, Johnsa. The problem has been resolved  :thumbsup:
But the floating-point bug that I mentioned in this topic Floating point arguments still remains. I hope you can fix it in future updates. Thanks anyway.
I've logged this one to have a look at!

daydreamer

my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

rsala

Hi Johnsa,

UASM64 is the compiler used to build Easy Code v2 64-bit and I must say that the IDE works perfectly well with that last version of UASM. Congratulations and thanks for your good work!
EC coder

Biterider

Hi John
I just wanted to give you a quick heads-up on the latest UASM version 2.57. 

I've been using it since it was released and haven't had any issues.  :thumbsup:

I've also recompiled about 70 projects on Windows and 2 on Linux, and everything's gone smoothly. 
On Linux, I came across the -Fo issue that mabdelouahab mentioned, but it's not a big deal since it can be handled in a compilation script.

Many thanks, John, for this fantastic job!  :thup:

Biterider



mabdelouahab

Hi John
I encountered an issue with the latest version of uasm (2.57). Instead of generating 'add rsp, 0x10', it generated 'add rsp, 0x8'. This issue appears to be specific to this updated version and causes the program to stop. Could you please look into this?

    mysql_real_connect(r11,r12,r13,r14,r15, 0, 0, 0)

    0x00402cc4      mov     rdi, r11
    0x00402cc7      mov     rsi, r12
    0x00402cca      mov     rdx, r13
    0x00402ccd      mov     rcx, r14
    0x00402cd0      mov     r8, r15
    0x00402cd3      xor     r9, r9
    0x00402cd6      push    0        <---------
    0x00402cd8      push    0        <---------
    0x00402cda      xor     eax, eax
    0x00402cdc      call    mysql_real_connect ; sym.imp.mysql_real_connect
    0x00402ce1      add     rsp, 8


As a temporary workaround to keep the program running correctly, I manually added the line 'add rsp, 8' after the function:

    mysql_real_connect(r11,r12,r13,r14,r15, 0, 0, 0)
    add     rsp, 8

 :biggrin:


mineiro

Thank you sir johnsa;

Please can you investigate this?
I was not able to create shared library that have inside a call to external functions.
So I changed in elf.c file line bellow:
;//            elftype = R_X86_64_PC32;
;              elftype = R_X86_64_PLT32;
Compile module.asm with uasm not modified, compile plugin.asm with modified uasm.

module.asm
;uasm -elf64 module.asm
;gcc -o module module.o -fno-pie -no-pie `pkg-config --cflags --libs glib-2.0 gmodule-2.0`

.X64
option casemap:none
option literals:on
option language:systemv

gtk_init proto :vararg
g_module_supported proto :vararg
g_module_build_path proto :vararg
g_module_open proto :vararg
g_module_make_resident proto :vararg
g_module_symbol proto :vararg
g_module_close proto :vararg
g_free proto :vararg

dlsym proto :vararg
printf proto :vararg

G_MODULE_BIND_LAZY equ 1
RTLD_DEFAULT equ 0

.data
align 16
public version
version db "version 0.0.0",0


.code
align 16
main PROC argc:dword, pargv:ptr

local asm_argc:dword
local asm_argv:qword

local module:qword
local module_path:qword
local function_addr:qword

mov  asm_argc,argc
mov  asm_argv,pargv

.if g_module_supported()
mov module_path,g_module_build_path("./","libplugin")
.if g_module_open(module_path,G_MODULE_BIND_LAZY)
mov module,rax
; g_module_make_resident(module) ;-fPIC option used in command line? uncomment this line
.if g_module_symbol(module,"asm_plugin",&function_addr)
call function_addr
.endif
g_module_close(module)
.endif
g_free(module_path)
.endif

xor eax,eax
ret
main ENDP


align 16
public asm_get_address
asm_get_address proc (pointer) uses r12 r13 r14 r15 rbx _var_name:ptr
local var_name:qword

mov var_name,_var_name
dlsym(RTLD_DEFAULT,var_name)
ret
asm_get_address endp


align 16
public show_this
show_this proc uses r12 r13 r14 r15 rbx _var_name1:ptr
local var_name:qword

mov var_name,_var_name1
printf(CStr("%s",10),var_name)
ret
show_this endp


end main


plugin.asm
;uasm elf.c changed, commented and changed to (only one occurrence):
;//            elftype = R_X86_64_PC32;
;              elftype = R_X86_64_PLT32;

;uasm -elf64 plugin.asm

;gcc -shared -o libplugin.so plugin.o
;or
;gcc -shared -fPIC -o libplugin.so plugin.o

.X64
option casemap:none
option literals:on

printf proto :vararg
asm_get_address proto :ptr
;show_this proto :ptr

.data
version db "version 0.0.1",0

.code
align 16
public asm_plugin
asm_plugin proc uses r12 r13 r14 r15 rbx _GtkBuilder_:qword

asm_get_address("version")
.if rax
printf(CStr("%s",10),rax)
.endif

asm_get_address("show_this")
.if rax
lea rdi,version
call rax
.endif

ret
asm_plugin endp

align 16
g_module_check_init proc
printf(CStr("g_module_check_init",10))
xor eax,eax
ret
g_module_check_init endp

align 16
g_module_unload proc
printf(CStr("g_module_unload",10))
xor eax,eax
ret
g_module_unload endp

end

again, thank you for your efforts.
I'd rather be this ambulant metamorphosis than to have that old opinion about everything