flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Linux > elf64 value out of range

Author
Thread Post new topic Reply to topic
funggong



Joined: 08 Nov 2016
Posts: 6
elf64 value out of range

Code:
format elf64 executable at 0x4000000000 as 'sys'
start:
cmp rdi,start

cmp rdi,start
errorvalue out of range.





anyone can tell me why this happened?
Post 08 Nov 2016, 08:46
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 14469
Location: ?                               Posts: 6699
The cmp instruction cannot support large immediate values >=2^31. It is a limitation of the x86-64 CPU.

To fix this you can use either lea for RIP relative offsets to "start", or use mov to get the absolute address (but this makes your code non-relocatable).


Last edited by revolution on 08 Nov 2016, 08:55; edited 1 time in total
Post 08 Nov 2016, 08:51
View user's profile Send private message Visit poster's website Reply with quote
funggong



Joined: 08 Nov 2016
Posts: 6

revolution wrote:
The cmp instruction cannot support large immediate values >=2^31. It is a limitation of the x86-64 CPU.

To fix this you can use either lea for RIP relative offsets to "start", or use mov to get the absolute address (but this makes your code non-relocatable).



thank you very much.
Post 08 Nov 2016, 09:05
View user's profile Send private message 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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.