News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Odd error A2006, symbol not found

Started by jj2007, March 15, 2012, 08:57:15 PM

Previous topic - Next topic

jj2007

error A2006: undefined symbol : @@

It happens only if debug symbols are activated with /Zi, and for ML.exe version 6.15. Versions 8+ and JWasm assemble ok.
Has anybody stumbled over this behaviour?

P1

Quote from: jj2007 on March 15, 2012, 08:57:15 PM
error A2006: undefined symbol : @@

It happens only if debug symbols are activated with /Zi, and for ML.exe version 6.15. Versions 8+ and JWasm assemble ok.
Has anybody stumbled over this behaviour?
Vaguely.  I am not at my main MASM station, that have the Debug Options, for turned on.

I believe we need another option turned on. 

bldalld.bat@echo off

if not exist rsrc.rc goto over1
\masm32\bin\rc /v rsrc.rc
\masm32\bin\cvtres /machine:ix86 rsrc.res
:over1

if exist "%1.obj" del "%1.obj"
if exist "%1.exe" del "%1.exe"

\masm32\bin\ml /c /coff /Fl"%1.lst" /FR"%1.pdb" /Sa /Zd /Zf /Zi  "%1.asm" > "%1.txt"
if errorlevel 1 goto errasm

if not exist rsrc.obj goto nores

\masm32\bin\Link /SUBSYSTEM:WINDOWS /DEBUG /DEBUGTYPE:CV /PDB:"%1" "%1.obj" rsrc.obj
if errorlevel 1 goto errlink

dir "%1.*"
goto TheEnd

:nores
\masm32\bin\Link /SUBSYSTEM:WINDOWS /DEBUG /OPT:REF /DEBUGTYPE:CV /PDB:"%1" "%1.obj"
if errorlevel 1 goto errlink
dir "%1.*"
goto TheEnd

:errlink
echo _
echo Link error
goto TheEnd

:errasm
echo _
echo Assembly Error
goto TheEnd

:TheEnd

pause


\masm32\bin\ml /c /coff /Fl"%1.lst" /FR"%1.pdb" /Sa /Zd /Zf /Zi  "%1.asm" > "%1.txt"

Here is my build batch line.

I also seem to remember that white space on the line was an issue too.

Otherwise post a code snipet.

Regards,  P1  :8)

jj2007

Quote from: P1 on March 15, 2012, 09:51:57 PM
Otherwise post a code snippet.

Thanks, P1. Same result with your commandline settings.

Posting a "snippet" is a bit difficult, as the error won't show with short code, but I attach the necessary. Tmp_File.asm is the choking code.

There are no problems with ML 8.0+ and JWasm. I couldn't test it on ML 6.14 because the library requires 6.15+

BogdanOntanu

I am not sure but I do recall some problems with large files / files that contain too many @@ and/or local symbols in macros.

Apparently there is a maximum number of such things in a single translation unit (one OBJ)
It used to have a limit somewhere around 65535.

If you have more @@ or local symbols in macros then strange things/errors start to happen :D

The solution is to break the file into multiple OBJ's / modules in order to avoid reaching this internal limit.

Again, I am not sure IF this is the issue here (depends on the project and /or file size) ... but it might worth a try.
Ambition is a lame excuse for the ones not brave enough to be lazy.
http://www.oby.ro

P1

Quote from: jj2007 on March 16, 2012, 10:44:52 AMPosting a "snippet" is a bit difficult, as the error won't show with short code, but I attach the necessary. Tmp_File.asm is the choking code.
The quick solution is to change it to a standard label and move on.

Code structure within the file suggests an issue as well to the free form label definition.

Regards,  P1  :8)

dedndave

simple solution...
don't assemble it with 6.14/6.15   :P

Patient: Doc, it hurts when I do "this".
Doc: Don't do "that".

jj2007

Quote from: BogdanOntanu on March 16, 2012, 01:59:48 PM
It used to have a limit somewhere around 65535.
If you have more @@ or local symbols in macros then strange things/errors start to happen :D

Yes, that is one of the possible causes. But the project is not that big, actually.

Quote from: P1 on March 16, 2012, 03:18:42 PM
The quick solution is to change it to a standard label and move on.

Sure, that works. But I'd like to understand the cause - such bugs are difficult to chase...

Thanks anyway for the moral support, folks :bg

P1

Quote from: jj2007 on March 16, 2012, 04:57:00 PMSure, that works. But I'd like to understand the cause - such bugs are difficult to chase...
Then clean up the code structure in the file.  That is another cause of confusion to the assembler.

Regards,  P1   :8)

jj2007

Quote from: P1 on March 16, 2012, 05:12:23 PMThen clean up the code structure in the file.  That is another cause of confusion to the assembler.

Most assemblers seem to consider the code structure entirely legal. Even ml 6.15 does not choke unless /Zi or /Zd are set. JWasm chokes only for /Zi.

mlv10 /nologo /c /coff  /Fl /Sn ... 0 warnings, 0 errors
mlv9 /nologo /c /coff  /Fl /Sn ... 0 warnings, 0 errors
mlv8 /nologo /c /coff  /Fl /Sn ... 0 warnings, 0 errors
mlv615 /nologo /c /coff  /Fl /Sn ... 0 warnings, 0 errors
JWasm .. 613 lines, 3 passes, 610 ms, 0 warnings, 0 errors

mlv10 /nologo /c /coff  /Fl /Sn ... 0 warnings, 0 errors
mlv9 /nologo /c /coff /Zi  ... 0 warnings, 0 errors
mlv8 /nologo /c /coff /Zi  ... 0 warnings, 0 errors
mlv615 /nologo /c /coff /Zi ... error A2006
mlv615 /nologo /c /coff /Zd ... error A2006
JWasm ... /nologo /c /coff /Zd ... 0 warnings, 0 errors
JWasm .. /nologo /c /coff /Zi ... Error A2168: General Failure

Besides, changing a testbed to work around an unsolved problem is not a good solution.

@Hutch: I tried with a 2008 Masm32 installation and got the same problem. So it is not linked to the Unicode stuff :U

P1

Quote from: jj2007 on March 16, 2012, 08:13:22 PMmlv10 /nologo /c /coff  /Fl /Sn ... 0 warnings, 0 errors
mlv9 /nologo /c /coff /Zi  ... 0 warnings, 0 errors
mlv8 /nologo /c /coff /Zi  ... 0 warnings, 0 errors
mlv615 /nologo /c /coff /Zi ... error A2006
mlv615 /nologo /c /coff /Zd ... error A2006
JWasm ... /nologo /c /coff /Zd ... 0 warnings, 0 errors
JWasm .. /nologo /c /coff /Zi ... Error A2168: General Failure
So M$ is not perfect, who knew ???   :dazzled:

The research I did suggested that "endp" was placed in a wrong spot, causing A2006 error.  Which is why I suggested to structure your code better.

But that does not limit the problem to an internal issue with ml.exe either.

The evidence you produced suggests to code around the issue and move on.

Regards,  P1   :8)

jj2007

Quote from: P1 on March 16, 2012, 08:44:48 PM
The research I did suggested that "endp" was placed in a wrong spot, causing A2006 error.  Which is why I suggested to structure your code better.

Hi P1,
Can you elaborate on that point? proc/endp are balanced throughout (otherwise the other assemblers would choke, too).
The same for the procs embedded in ife Noprocs ... endif.

Around line 440 is the offending bit. The behaviour is erratic, to say the least:
            .if sword ptr ax>=0
               if 0
                   .data
                   Hash8a db "#", 8, 0
                   .code
                   invoke StdOut, offset Hash8a      ; E2006
               elseif 1
                   invoke StdOut, offset Hash8      ; works (Hash8 defined above)
               else
                   Print Chr$("#", 8)         ; E2006
               endif
            .endif

Regards,
jj

hutch--

JJ,

Long ago I found all sorts of strange limitations in ML with auto-generated very large source files. .IF blocks nesting, include file line count limits etc .... I found that if a very large source only contains bare mnemonics it will usually build OK, as soon as you start using the HLL constructs you start to get size limits with a single source being assembled into an object module. There is yet another limit in ML that is extremely hard to track down and it has to do with the pre-processor, some macros that are loaded get lost or damaged when multiple macro files are loaded. The crappy work around is to reload the macro file again if it starts to misbehave.

It sounds like a data structure in the guts of ML is being overwritten after a certain number of macros are loaded from external files and it is a genuine joy to track down. This is one of the effects that makes GOTO in macros unreliable.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

jj2007

Quote from: hutch-- on March 16, 2012, 10:12:57 PM
JJ,

Long ago I found all sorts of strange limitations in ML with auto-generated very large source files....

Yeah, MASM is a pig. Like driving a Ferrari - one wrong move, and bang!
The good news is while the 600 lines of the testbed misbehave, the 13,000 lines of the RichMasm source have no problems. Over 1,000 .ifs, 137 .Repeat loops, and MasmBasic macros all over the place. No problem with /Zi and ml 6.15... ::)

mineiro

Hello Sr jj2007
I take a look at your code, and because I do not fully understand macros, I do not know if this is viable.
I suspected about line:
;Print Chr$("#",8)
and changed it to:
Print Str$("#",8)
and have worked.

But, in other hands, appear to be one fault in ml, or maybe mine when trying with /Zi option, v615:
;.386
.model flat,stdcall
option casemap:none
.code
start: ;@@:
nop ;comment this nop
@@:
xor eax,eax
jnz @B
ret
end start ;end @@


jj2007

Wow :U

.386
.model flat,stdcall
option casemap:none

.code
start:

@@:
xor eax,eax
jnz @B
ret

end start


(too many macros and HLL constructs, I suppose :bdg)