flat assembler
Message board for the users of flat assembler.

Index > Linux > elf64 value out of range

Author
Thread Post new topic Reply to topic
funggong



Joined: 08 Nov 2016
Posts: 6
funggong 08 Nov 2016, 08:46
Code:
format elf64 executable at 0x4000000000 as 'sys'
start:
cmp rdi,start

cmp rdi,start
error: value 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: 20631
Location: In your JS exploiting you and your system
revolution 08 Nov 2016, 08:51
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
funggong 08 Nov 2016, 09:05
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


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

Website powered by rwasa.