flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Bug in FASM v1.69.37

Author
Thread Post new topic Reply to topic
CandyMan



Joined: 04 Sep 2009
Posts: 311
Location: film "CandyMan" directed through Bernard Rose OR Candy Shop
CandyMan
format MS64 COFF

section '.text' executable

virtual at 0
SortReverse db ?
end virtual

ReturnRDX:
lea rdx,[SortReverse] ;error: invalid use of symbol
ret
Post 14 Feb 2012, 01:24
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7725
Location: Kraków, Poland
Tomasz Grysztar
It is actually due to a bugfix - previous fasm versions incorrectly allowed "lea rdx,[0]" (this is what it is, the "virtual" thing is not an important detail here) to be assembled in such context, and it generated incorrect opcode. Because in 64-bit mode address that has no size prefix is declared to be always RIP-relative, and it is not possible to generate relocation to address absolute "0" relative to RIP. It is like writing "lea rdx,[rip-$+0]", which in turn fails for the same reason as "dd 0-$" does.
To generate a correct instruction which will load absolute value into RDX, you need to use construction like:
Code:
lea rdx,[dword SortReverse]    
Post 14 Feb 2012, 01:37
View user's profile Send private message Visit poster's website Reply with quote
SFeLi



Joined: 03 Nov 2004
Posts: 140
Location: Severodvinsk, Russia
SFeLi
Is something wrong with this code or with the fasm itself?
Code:
repeat 2
  virtual at 0
    db 'aa'
    db 'zz'
    ; UNCOMMENT_ME = 1
    load foo from %-1
    load bar from %-1+2
  end virtual
  baz = foo + bar
end repeat    
Post 18 Feb 2012, 22:27
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7725
Location: Kraków, Poland
Tomasz Grysztar
Yes, this is a correct code and should be working. I'm uploading the correction as 1.69.38.
Post 18 Feb 2012, 23:23
View user's profile Send private message Visit poster's website Reply with quote
SFeLi



Joined: 03 Nov 2004
Posts: 140
Location: Severodvinsk, Russia
SFeLi
So fast! Thank you)
Post 18 Feb 2012, 23:56
View user's profile Send private message Visit poster's website ICQ Number 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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.