flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > 'invalid use of symbol', please explain too |
Author |
|
Tomasz Grysztar 02 Mar 2009, 22:04
This error may occur in many different situations, but in general it means, that you're trying to do some calculations on the relocatable symbol, that are not possible, because there's no type of relocation entry for a given output format, that would allow such operations.
Thus you will most likely see such error in case, when the output format is one of the relocatable ones, like object (COFF/ELF), or relocatable PE (the one that has fixups data defined to be put somewhere). The simplest example: Code: format COFF alpha: beta: test_1 = alpha - beta ; OK test_2 = alpha + beta ; invalid use of symbol The definition "test_1" works correctly, because substracting two relocatable symbols relative to the same base (in this case the same section) gives an absolute value as a result. The "test_2" causes an error, because adding two relocatable symbols would make a symbol, that would need to have base address added twice to it at the linking stage, and there is no such relocation type. For the same reason this error will happen, when you try to use a relocatable value in a place, where absolute value is expected. For example: Code: format PE start: data fixups ; make the PE reloctable end data stack start ; trying to use relocatable symbol for stack size (which has to be absolute value) Same error would happen if you tried to use relocatable value as a counter for REPEAT or TIMES, etc. There is also another class of events, that cause this error message. It's when you try to use one of the special labels (like $ or %) in context, where only a regular label is allowed. Two examples: Code: format COFF public $ ; this special symbol cannot be made public ; (as it has no fixed value) Code: $=0 ; you cannot define value of $ either ; (though some people suggested this as an alias for ORG directive) |
|||
02 Mar 2009, 22:04 |
|
IronFelix 02 Mar 2009, 22:16
Again you have my great thanks Tomasz. In my case error arises in relocatable PE - now it is clear for me what to do. Thank for your quick and clear answers.
|
|||
02 Mar 2009, 22:16 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.