News:

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

Limit on number of symbols

Started by Vektor, December 12, 2007, 10:27:52 AM

Previous topic - Next topic

Vektor

In one of my projects i have reached the default limit on number of symbols. If i add a few more lines of code, i get this:
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

Assembling: HeXHub.asm
tzari.h(973) : error A2005: symbol redefinition : @C0001
tzari.h(973) : error A2005: symbol redefinition : @C0005
tzari.h(974) : error A2005: symbol redefinition : @C0003
tzari.h(975) : error A2005: symbol redefinition : @C0008
tzari.h(975) : error A2005: symbol redefinition : @C0007
tzari.h(980) : error A2005: symbol redefinition : @C000B
tzari.h(987) : error A2005: symbol redefinition : @C000D
tzari.h(987) : error A2005: symbol redefinition : @C0010
tzari.h(989) : error A2005: symbol redefinition : @C0017
tzari.h(993) : error A2005: symbol redefinition : @C001A
tzari.h(996) : error A2005: symbol redefinition : @C0018
tzari.h(996) : error A2005: symbol redefinition : @C001C
tzari.h(1001) : error A2005: symbol redefinition : @C001D
tzari.h(1005) : error A2005: symbol redefinition : @C0024
tzari.h(1008) : error A2005: symbol redefinition : @C002A
tzari.h(1008) : error A2005: symbol redefinition : @C0028
tzari.h(1008) : error A2005: symbol redefinition : @C0026
tzari.h(1009) : error A2005: symbol redefinition : @C0023
tzari.h(1011) : error A2005: symbol redefinition : @C0034
tzari.h(1011) : error A2005: symbol redefinition : @C0032
tzari.h(1011) : error A2005: symbol redefinition : @C0031
tzari.h(1015) : error A2005: symbol redefinition : @C0038
tzari.h(1015) : error A2005: symbol redefinition : @C003B
tzari.h(1015) : error A2005: symbol redefinition : @C003A
tzari.h(1020) : error A2005: symbol redefinition : @C0036
tzari.h(1021) : error A2005: symbol redefinition : @C002B
tzari.h(1026) : error A2005: symbol redefinition : @C0041
tzari.h(1032) : error A2005: symbol redefinition : @C0042
tzari.h(1032) : error A2005: symbol redefinition : @C0044
tzari.h(1035) : error A2005: symbol redefinition : @C0045
tzari.h(1036) : error A2005: symbol redefinition : @C0011
tzari.h(1036) : error A2005: symbol redefinition : @C004C
tzari.h(1036) : error A2005: symbol redefinition : @C004B
tzari.h(1046) : error A2005: symbol redefinition : @C004E
tzari.h(1059) : error A2005: symbol redefinition : @C0050


So i have to move some procedures to libraries to be able to add more code to the main project. This is not a real solution, but so far it works.
Is there a way to adjust this limit on number of symbols ?

Biterider

hi
the only practical solution is to use global symbols (and reuse them) and not local ones, since the last are not removed from the internal database.

regards,

biterider

Adamanteus

I'm thinking exist more one, it to suppose that this names not appear in program it could be system fault. On me experience ml could give such on file not less then 2500 lines, so maybe try to reinstall everything.

Vektor

The problem is not the system nor the number of lines of code.
For example, i can add these as many as i want:
inc eax
But i can add only a few more of these (less than 100):
.if eax
inc eax
.endif

So far the only way i found to resolve those errors was to move other procedures to libraries (doesn't care which ones i move).

Adamanteus

#4
 Just such done - 15000 times worked :   :wink

    REPT 15000
    MOV    EAX, 1
    .IF EAX
        INC    EAX
        PRINT sCommandLine
    .ENDIF
    ENDM

hutch--

If I remember correctly the limit is 32k of symbols. I found this limit in a test piece years ago and the only solution is to split the source file up into smaller parts as each source file that is seperately assembled has the same limit.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

MichaelW

The limit seems to be different for different types of symbols. If I create a source file that contains a million code labels:

jmp L1
L1:
jmp L2
L2:
…


Then the file assembles OK (eventually). If I create a source file that contains repeated IF blocks:

.if eax
  inc eax
.endif


MASM assigns code labels @C0001, @C0003, @C0005, etc, up to @C7FFF, and then it starts over at @C0001. So 16384 blocks assemble OK, and then the symbol redefinition errors start with next block.

If I forgo the high-level syntax and use something like this:

or  eax, eax
jz  L1
  inc eax
L1:
Or  eax, eax
jz  L2
  inc eax
L2:
…


Then a source with one million blocks assembles OK (eventually). So based on this I think one (difficult) solution would be to replace the .IF directives with macros that had a wider range of symbols available, taking the pressure off of the limited symbol set that the .IF directives share with the .WHILE, .REPEAT, and similar directives.
eschew obfuscation

Adamanteus

How's you detailed unfixed ml, simple amazing. I have such macros (recorded sometime and attached now - only comments russian), but that was on ml 5.0 and now I even not sopposed that be need to somebody.  I'm view only 80 labels in you first listing, so maybe it's better to check again corruption of all disk files, it maybe and in distributive than go back on twenty years in programming.

[attachment deleted by admin]

Vektor

#8
Quote from: hutch-- on December 14, 2007, 01:29:37 AM
I found this limit in a test piece years ago and the only solution is to split the source file up into smaller parts as each source file that is seperately assembled has the same limit.

I was looking for a better solution, like something i missed or misunderstood while reading the documentation. I prefer to do something usefull instead of rewriting everything just to compensate a  compiler limitation.

Quote from: MichaelW on December 14, 2007, 09:45:56 AM
MASM assigns code labels @C0001, @C0003, @C0005, etc, up to @C7FFF, and then it starts over at @C0001. So 16384 blocks assemble OK, and then the symbol redefinition errors start with next block.

You're right, MASM does this for some macros like .if, .while and .repeat, the limit is 32767 (7FFF).

[code removed because of license limitations]

Offtopic: Adamanteus you're joking, right ?

Quote from: Adamanteus on December 12, 2007, 06:16:11 PM
it could be system fault. On me experience ... maybe try to reinstall everything.
Quote from: Adamanteus on December 14, 2007, 07:58:33 PM
I'm view only 80 labels in you first listing, so maybe it's better to check again corruption of all disk files

Yes, you should do that. The following quotes may look the same to you (because of data corruption, of course :bg) but to others they don't:

Quote from: Vektor on December 12, 2007, 10:27:52 AM
Microsoft (R) Macro Assembler Version 6.14.8444
Quote from: Adamanteus on December 14, 2007, 07:58:33 PM
but that was on ml 5.0 and now I even not sopposed that be need to somebody.

MichaelW

QuoteYou're right, MASM does this for some macros like .if, .while and .repeat, the limit is 32767 (7FFF). I was reading the license i found no restrictions related to disassembling or applying patches to ml.exe so i assume posting a patch for ml.exe does not break this forum's rules (if i'm wrong, delete this post).

You are reading the MASM32 license, not the Microsoft license for the DDK components that are distributed with the MASM32 project. The license for those should be in \masm32\licence.
Quote
You may not reverse-engineer, decompile, or disassemble the SOFTWARE PRODUCT, except and only to the extent that such activity is expressly permitted by applicable law notwithstanding this limitation.
eschew obfuscation

Adamanteus

 
QuoteSo 16384 blocks assemble OK
- he counted one result, but get another experementaly ! About what it's saying ? :boohoo:

MichaelW

In my results, which tested only the .IF directive, there is the question of what happened to the even-numbered labels. In the post at the top of this thread there are some even-numbered labels, so there must be some circumstances under which MASM generates them.
eschew obfuscation

Vektor

That was before moving a full procedure in a library. The procedure has many .if/.else/.endif/.while/ etc.
Microsoft (R) Macro Assembler Version 6.14.8444     12/15/07 12:45:30
test.asm      Page 1 - 1


.386
.model flat,stdcall
option casemap:none


00000000 .data

00000000 .data?

00000000 .code
00000000 start:
.if eax
00000000  0B C0    *     or eax, eax
00000002  74 01    *     je     @C0001
00000004    *@C0002:
00000004  40 inc eax
.endif
00000005    *@C0001:
.if eax
00000005  0B C0    *     or eax, eax
00000007  74 03    *     je     @C0003
00000009    *@C0004:
00000009  40 inc eax
.else
0000000A  EB 01    *     jmp    @C0005
0000000C    *@C0003:
0000000C  48 dec eax
.endif
0000000D    *@C0005:
0000000D  C3 ret

end start
Microsoft (R) Macro Assembler Version 6.14.8444     12/15/07 12:45:30
test.asm      Symbols 2 - 1

Some labels are useless.

Adamanteus

And this even useless, labels of 16384 quantity that is MASM limit ?

hutch--

Guys,

The answer is very simple, I had to do the research years ago for an automated code generator that was capable of producing hundreds of thousands of branches and when I tested the first version using the block .IF notation I found the 32k limit.

I converted the code design to direct mnemonics using jumps and labels and it easily handles much larger branch counts.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php