flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > a bug with macro

Author
Thread Post new topic Reply to topic
litwr



Joined: 23 Aug 2005
Posts: 11
Location: Moscow, Russia
litwr 07 Nov 2014, 19:08
Code:
format ELF64 executable 3
macro instring s {
        mov     rdx,str#s#maxlen
}
        instring 1
string1 rb      256
string2 rb      128
str1maxlen equ string2-string1    

This doesn't work (error: undefined symbol 'str1maxlen') Sad but this
Code:
str1maxlen equ string2-string1
macro instring s {
        mov     rdx,str#s#maxlen
}
        instring 1
string1 rb      256
string2 rb      128    

works... IMHO this maybe resolved by more passes.
Post 07 Nov 2014, 19:08
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20461
Location: In your JS exploiting you and your system
revolution 07 Nov 2014, 19:37
Use "str1maxlen = string2-string1" instead of equ. This way the you use the assembler to compute the value instead of the preprocessor to define a symbol.
Post 07 Nov 2014, 19:37
View user's profile Send private message Visit poster's website Reply with quote
litwr



Joined: 23 Aug 2005
Posts: 11
Location: Moscow, Russia
litwr 08 Nov 2014, 06:04
Thanks! Smile
Post 08 Nov 2014, 06:04
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.