Hi, vitsoft!
It seems to be an issue in the latest Version 20240831.
Minimal code to reproduce:
TestDLL.asm:
EUROASM CPU=X64
TestDLL PROGRAM FORMAT=DLL, MODEL=FLAT, WIDTH=64, ICONFILE=
align 16
EXPORT foo
foo PROC
RET
ENDP foo
ENDPROGRAM TestDLL
Attempt to build it as
>euroasm.exe TestDLL.asm
caused exception somewhere between first and second pass.
The last lines one the screen:
I0010 EuroAssembler version 20240831 started.
I0020 Current directory is "C:\Users\Andrey\Desk~~sembler_DLL_tEST\new".
I0070 Assembling global option file "C:\Users\Andrey\Desk~~tEST\new\euroasm.ini".
I0170 Assembling local option file "euroasm.ini".
I0180 Assembling source file "TestDLL.asm".
I0270 Assembling source "TestDLL".
I0310 Assembling source pass 1.
I0330 Assembling source pass 2 - final.
I0470 Assembling program "TestDLL". "TestDLL.asm"{2}
I0510 Assembling program pass 1. "TestDLL.asm"{2}
And no TestDLL.dll created.
Debugger screenshot:
But if this code "compiled" (I mean assembled) with previous Version 20190402 everything working properly.
And if I will remove "align 16" line from the source, then the latest version is also fine. But if "align 16" is present then only previous version is OK, the newest crashed.
Exception on attempt to build DLL with align 16
-
- Posts: 6
- Joined: 01 Jun 2023 09:11
- vitsoft
- Site Admin
- Posts: 51
- Joined: 04 Nov 2017 20:08
- Location: Vítkov, The Czech Republic
- Contact:
Re: Exception on attempt to build DLL with align 16
I have to praise you, Andrey, for the perfect minimal verificable example. Rather then WinDbg I am using OllyDbg for 32bit programs, see the enclosed snapshot.
It reveals that the the exception was raised by reading from NUL pointer at 0x0041497d in the procedure PseudoALIGN, below the instruction
MOV ESI,[EDI+PGM.CurrentSect] ; ALIGN does not change autosegment value.
which points at PGM.CurrentSect.
This happens in the beginning of your program when no segment has been specified yet and therefore [PGM.CurrentSect]=0 . You may align a segment/section but not the program itself.
Euroasm option AUTOSEGMENT does not help here, because no instruction was specified yet which could tell €ASM to switch to a code|data|bss segment.
The error will vanish if you put an explicit [.text] above align 16, or if you omit the alignment completely (all sections in €ASM are by default aligned to OWORD).
However, I recognize this as a bug. To fix this I added under the line "pseudo.htm"{193} the following two instructions:
It reveals that the the exception was raised by reading from NUL pointer at 0x0041497d in the procedure PseudoALIGN, below the instruction
MOV ESI,[EDI+PGM.CurrentSect] ; ALIGN does not change autosegment value.
which points at PGM.CurrentSect.
This happens in the beginning of your program when no segment has been specified yet and therefore [PGM.CurrentSect]=0 . You may align a segment/section but not the program itself.
Euroasm option AUTOSEGMENT does not help here, because no instruction was specified yet which could tell €ASM to switch to a code|data|bss segment.
The error will vanish if you put an explicit [.text] above align 16, or if you omit the alignment completely (all sections in €ASM are by default aligned to OWORD).
However, I recognize this as a bug. To fix this I added under the line "pseudo.htm"{193} the following two instructions:
TEST ESI JZ .90:but I don't think the bug is serious enough to ask for a new €ASM version. Let me wait until there is more errors accumulated
-
- Posts: 6
- Joined: 01 Jun 2023 09:11
Re: Exception on attempt to build DLL with align 16
You're welcome and thank you!
If I do like this then it works:
EUROASM CPU=X64
TestDLL PROGRAM FORMAT=DLL, MODEL=FLAT, WIDTH=64
EXPORT foo
foo PROC
RET
ENDP foo
align 16
EXPORT bar
bar PROC
RET
ENDP bar
ENDPROGRAM TestDLL
It is not very serious, but issue, because euroasm should not crash under any circumstances regardless from the content of the *.asm file (even if I'll put full garbage inside).
The WinDbg is what I have had in my hands on home pc, but usually I using x64dbg (x64dbg.com). Still remember old school OllyDbg, but didn't used since years.
Just one more thing which is slightly annoying for me.
By default you expect euroasm.ico and if I have just euroasm.exe and my asm file and compile it, then the error 7752 raised by default:
E7752 IconFile="euroasm.ico" was not found in LinkPath=".;./objlib;../objlib;". "TestDLL.asm"{19}
So, I have to place ICONFILE=, to the options in the header, or modify euroasm.ini accordingly.
Can you please remove euroasm.ico from IconFile="euroasm.ico" ; File name of the icon embedded to PE when no other resources are linked.?
Not a big deal, just my small wish.
Thank you again for great tool!
- vitsoft
- Site Admin
- Posts: 51
- Joined: 04 Nov 2017 20:08
- Location: Vítkov, The Czech Republic
- Contact:
Re: Exception on attempt to build DLL with align 16
It works, because at the time of align 16 €ASM already encountered code instructions foo PROC and RET, which autoswitched the current section from Undefined (0) to [.text].AndreyDmitriev wrote: ↑22 Nov 2024 11:00 If I do like this then it works:EUROASM CPU=X64 TestDLL PROGRAM FORMAT=DLL, MODEL=FLAT, WIDTH=64 EXPORT foo foo PROC RET ENDP foo align 16 EXPORT bar bar PROC RET ENDP bar ENDPROGRAM TestDLL
It is not very serious, but issue, because euroasm should not crash under any circumstances regardless from the content of the *.asm file (even if I'll put full garbage inside)
I totally agree.
I didn't find how to make windbg or x64dbg to load the table of symbols from COFF/PE/DLL file (OllyDbg does it with Ctrl-O), so the 64bit debuggers do not replace numeric addresses with symbol names in CPU window.
Windbg expects the symbol table in a poorly documented program database, whatever it is.
That's exactly what the global configuration file is for: in section [PROGRAM] let IconFile= be empty.Can you please remove euroasm.ico from IconFile="euroasm.ico" ; File name of the icon embedded to PE when no other resources are linked.? Not a big deal, just my small wish.
Or do you want to remove it from the factory defaults? I'm not sure about it. I wanted all Windows programs created by €ASM to look well when viewed in Explorer, instead of ugly default icon.
-
- Posts: 6
- Joined: 01 Jun 2023 09:11
Re: Exception on attempt to build DLL with align 16
Yes, exactly, I mean factory defaults for "cold start". So, if I downloaded new version, then don't need to adjust nothing. But this is my particular use case, I using EuroAssembler mostly for DLLs, and not for applications, so, having ICONFILE= time to to time disturb me, but it is really mnor thing.
Who is online
Users browsing this forum: No registered users and 0 guests