Author Topic: UASM 2.51  (Read 5935 times)

nidud

  • Member
  • *****
  • Posts: 2212
    • https://github.com/nidud/asmc
Re: UASM 2.51
« Reply #30 on: March 20, 2021, 05:57:36 AM »
Hi,

I too have found this corrupt debugging info in one of my projects. 100 other test-cases and projects were fine.
I spent some time trying to nail it down, what was odd is that the error seemed to come and go depending on which lines of code I commented, ie. it looked like it was related to symbol positioning.
It was hard to follow in my one example where it occurred as the project is about 10k lines, having a smaller test-case that does this would help.

I'm not sure if Nidud has encountered this yet and maybe has some ideas?

Same here, however the last test case made also fails. From the looks of it section F4 (source file info) is misaligned. The section above (F3 - source filename string table) overflows the buffer, so the error depends on the number of files.
Code: [Select]
WIN32_LEAN_AND_MEAN equ 1
include windows.inc

.pragma comment(linker,"/DEFAULTLIB:libcmtd.lib")

.code

main proc
    ret
main endp

    end

It fails if WIN32_LEAN_AND_MEAN is removed.

nidud

  • Member
  • *****
  • Posts: 2212
    • https://github.com/nidud/asmc
Re: UASM 2.51
« Reply #31 on: March 20, 2021, 06:17:58 AM »
Found the (silly) bug.

Files where copied before the size-check.

void cv_write_debug_tables( struct dsym *symbols, struct dsym *types, void *pv )
      name = cv.currdir;
       }
       len = strlen( name ) + 1;
   -   memcpy( cv.ps, name, len );
       p = cv.ps;
       cv.ps = checkflush( cv.symbols, cv.ps, len, cv.param );
   +   memcpy( cv.ps, name, len );
       if ( p == cv.ps )
           cv.ps += len;
       cv.section->length += len;

KradMoonRa

  • Member
  • **
  • Posts: 80
Re: UASM 2.51
« Reply #32 on: March 21, 2021, 10:31:45 AM »
UASM 2.51.2

* regcall implementation for 64bits win/linux/mach, it follows the same principe off the base OS system convention. Now fixed the segfault using language convention with proto for linux/mac 64bits.
* regcall atempt implementation for 32bits win/linux. Now fixed the segfault using language convention with proto for all 32bits system's
* thiscal for 32 bits win.
* syscall linux kernel parameters, only the 6 arguments are implemented, the UASM user must be aware of the return address and system call number etc...
* Fix VPTESTMW VPTESTMM VPTESTNMW VPTESTMB.
* Fix dbgcv.c (_getcwd) to portable code.
* Fix dbgcv.c (_pgmptr) to portable code.
* Add getexec.c with code for get current executable directory path, heart of portable code for getExecutablePath().
* Striped macrolib to *.inc files, for better contribution without the need to recompile UASM, now executable low as 700kb win / 800kb linux.
* and added new macro lib utilities.
* Added Setup Project for windows, using the free version of Advanced Installer.
* Added ubuntu/debian package manager project.
* Small fix for elf64_relocations now using R_X86_64_GOTPCREL64 = 28, /* G + GOT - P + A */
* added option frame:none for linux/mac 64bits only and for manual procedure optimization.
* all code now is aligned for 64bits builds to 16 bytes, but the packed 1 byte code stays the same.
* Pull request Terraspace#138 define alloca only if not defined and not the proposed pointer casting changes it will break uasm.
* Pull request Terraspace#141 strlen() moved from the body for cycle.
* Pull request Terraspace#137 Allow overriding the SWITCHCHAR option by passing -DSWITCHCHAR=0/1 when building.
* Fix by @nidud dbgcv.c corrupted debug info.
* Updated debian package manager distribution for multiple build release and debug files.

Check setup installer for.

Windows Setup, add the necessary path environment variables, and MSBuild BuildCustomizations for VS2019.

Windows setup also installs uasmd debug version and also has 32 bits binaries.

windows:
 Win Setup
or
 Win binaries files

linux:
 Linux 64 bits binaries

Linux installs to /usr/bin/uasm and inc files to /usr/include/uasm

ubuntu apt package manager:
Instructions:
add the sign key to your trusted keys
Code: [Select]
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 10649EA8D069C51Dor
Code: [Select]
curl -fsSL https://apt.navegos.net/pub.key | sudo apt-key add -Source Links:
add package as sudo
Code: [Select]
sudo add-apt-repository "deb [arch=amd64] https://apt.navegos.net/ubuntu/uasm/ $(lsb_release -cs) main main/debug"or
Code: [Select]
echo "deb [arch=amd64] https://apt.navegos.net/ubuntu/uasm/ focal main main/debug" | sudo tee /etc/apt/sources.list.d/uasm.listclean, update and install
Code: [Select]
sudo apt-get update && sudo apt-get purge uasm && sudo apt-get install uasm uasmd
now you have both uasm release and debug versions, if you need debug symbols can be installed with
Code: [Select]
sudo apt-get install uasmd-dbgsym
Source:
 2.51.2.zip
 2.51.2.tar.gz
« Last Edit: March 21, 2021, 07:49:30 PM by KradMoonRa »

jj2007

  • Member
  • *****
  • Posts: 11550
  • Assembler is fun ;-)
    • MasmBasic
Re: UASM 2.51
« Reply #33 on: March 21, 2021, 10:56:31 AM »
Win7-64: fails for shlx eax, eax, edx: "illegal instruction"

Btw the msi installation takes ages...

KradMoonRa

  • Member
  • **
  • Posts: 80
Re: UASM 2.51
« Reply #34 on: March 21, 2021, 11:20:17 AM »
Win7-64: fails for shlx eax, eax, edx: "illegal instruction"

Btw the msi installation takes ages...

tested and shlx eax, eax, edx works in windows and linux assembling

try this:

linux way:
Code: [Select]
;.x64p
.sysv64
option casemap:none
option stackbase:rbp ;Default and the only possible for SYSV64
;option language:systemv ;Default we have regcall also
option frame:auto ;Default and now possible frame none, check below
option sysv64:7 ;The max possible for SYSV64
;option literals:on
;option vtable:on
;option framepreserveflags:on

.xmm
option arch:avx
option evex:1

include macrolib.inc

.code


windows way:
Code: [Select]
;.x64p
.win64
option casemap:none
option stackbase:rsp ;
;option language:vectorcall ; we have regcall also
option frame:auto ;Default
option win64:15 ;
;option literals:on
;option vtable:on
;option framepreserveflags:on

.xmm
option arch:avx
option evex:1

include macrolib.inc

.code

command line: change -Fo and .asm file for your needs.
Code: [Select]
linux enviroment
assemble linux object
uasm -c -Cp -archAVX -W0 -Gy -zf4 -mf -elf64 -pie -I /usr/include/uasm -Fo testlinux.o testlinux.asm

assemble windows object
uasm -c -Cp -archAVX -W0 -Gv -zf3 -mf -win64 -I /usr/include/uasm -Fo testwindows.obj testwindows.asm

windows enviroment
assemble linux object
command prompt
uasm -c -Cp -archAVX -W0 -Gy -zf4 -mf -elf64 -pie -I %UASM_INC_DIR% -Fo testlinux.o testlinux.asm
bash
uasm -c -Cp -archAVX -W0 -Gy -zf4 -mf -elf64 -pie -I $UASM_INC_DIR -Fo testlinux.o testlinux.asm

assemble windows object
command prompt
uasm -c -Cp -archAVX -W0 -Gv -zf3 -mf -win64 -I %UASM_INC_DIR% -Fo testwindows.obj testwindows.asm
bash
uasm -c -Cp -archAVX -W0 -Gv -zf3 -mf -win64 -I $UASM_INC_DIR -Fo testwindows.obj testwindows.asm

msi file do checks for current environments PATHS, yep slow with earlier version of windows

zip file also added above. Win binaries files

jj2007

  • Member
  • *****
  • Posts: 11550
  • Assembler is fun ;-)
    • MasmBasic
Re: UASM 2.51
« Reply #35 on: March 21, 2021, 11:43:28 AM »
tested and shlx eax, eax, edx works in windows and linux assembling

Sorry, misunderstanding: not my code crashes, but yours: UAsm itself crashes because my very, very old Core i5 doesn't understand shlx :cool:

KradMoonRa

  • Member
  • **
  • Posts: 80
Re: UASM 2.51
« Reply #36 on: March 21, 2021, 12:04:34 PM »
Quote
Sorry, misunderstanding: not my code crashes, but yours: UAsm itself crashes because my very, very old Core i5 doesn't understand shlx :cool:

RIP i5  :rofl:

jj2007

  • Member
  • *****
  • Posts: 11550
  • Assembler is fun ;-)
    • MasmBasic
Re: UASM 2.51
« Reply #37 on: March 21, 2021, 12:09:16 PM »
No problem, version v2.51 of Feb 27 works perfectly on my stone age hardware :tongue:
Code: [Select]
Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz (MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX)

TimoVJL

  • Member
  • ****
  • Posts: 723
Re: UASM 2.51
« Reply #38 on: March 21, 2021, 06:45:25 PM »
Is this branch v2.51.2 in Git too ?

Windows 7:
UASM Assembler has stopped working
May the source be with you

KradMoonRa

  • Member
  • **
  • Posts: 80
Re: UASM 2.51
« Reply #39 on: March 21, 2021, 07:56:22 PM »
Sorry guys, not everyone has AVX2, my mistake  :biggrin:

Rebuild defaults no AVX or higher.

windows:
 Win Setup Uninstall and Install again.
or
 Win binaries files Copy hover.

Source:
 2.51.2.zip
 2.51.2.tar.gz

TimoVJL

  • Member
  • ****
  • Posts: 723
Re: UASM 2.51
« Reply #40 on: March 21, 2021, 08:35:50 PM »
Thanks, we will test it :thumbsup:

Speedtest
17.546s       uasm-2.51.2.exe
9.390s        uasm64.exe
5.335s        asmc.exe   2.30.35
May the source be with you

jj2007

  • Member
  • *****
  • Posts: 11550
  • Assembler is fun ;-)
    • MasmBasic
Re: UASM 2.51
« Reply #41 on: March 21, 2021, 08:45:49 PM »
Some glitches to resolve... attached example works fine with MASM 6.14 and others.

LiaoMi

  • Member
  • ****
  • Posts: 922
Re: UASM 2.51
« Reply #42 on: March 21, 2021, 09:36:58 PM »
Hi John,

I managed to identify a bug that was not present in the previous version 2.50. The bug occurs on large projects when there are too many include files. An error and an unexpected stop always occur in a different place. I have attached a test case, I can consistently repeat this error.



Code: [Select]
UASM v2.51, Feb 27 2021, Masm-compatible assembler.
Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.


***********
ASCII build
***********

C:\masm32\include\winspool.inc(597) : Fatal error A1105: Out of Memory
Microsoft (R) Incremental Linker Version 14.28.29337.0
Copyright (C) Microsoft Corporation.  All rights reserved.

LINK : fatal error LNK1181: cannot open input file 'Test_x86.obj'
Press any key to continue . . .
or
Code: [Select]
UASM v2.51, Feb 27 2021, Masm-compatible assembler.
Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.


***********
ASCII build
***********

C:\masm32\include\winspool.inc(574) : Fatal error A1105: Out of Memory
Microsoft (R) Incremental Linker Version 14.28.29337.0
Copyright (C) Microsoft Corporation.  All rights reserved.

LINK : fatal error LNK1181: cannot open input file 'Test_x86.obj'
Press any key to continue . . .


LiaoMi

  • Member
  • ****
  • Posts: 922
Re: UASM 2.51
« Reply #43 on: March 21, 2021, 09:39:56 PM »
Thanks, we will test it :thumbsup:

Speedtest
17.546s       uasm-2.51.2.exe
9.390s        uasm64.exe
5.335s        asmc.exe   2.30.35

Why is there a big difference in timing ?!  :dazzled:

LiaoMi

  • Member
  • ****
  • Posts: 922
Re: UASM 2.51
« Reply #44 on: March 21, 2021, 09:48:13 PM »
Sorry guys, not everyone has AVX2, my mistake  :biggrin:

Rebuild defaults no AVX or higher.

windows:
 Win Setup Uninstall and Install again.
or
 Win binaries files Copy hover.

Source:
 2.51.2.zip
 2.51.2.tar.gz

Hi KradMoonRa,

could You please add a version for AVX2 to the releases folder? It can be separately marked as AVX2. What options are required in Visual Studio for AVX2, to compile with optimization?