flat assembler
Message board for the users of flat assembler.
  
|  Index
      > Linux > Custom object loader (ELF64). LEA vs MOV | 
| Author | 
 | 
| system error 31 Mar 2016, 07:57 Mom? | |||
|  31 Mar 2016, 07:57 | 
 | 
| JohnFound 31 Mar 2016, 08:00 "mov rsi, x" works here as well as "lea". | |||
|  31 Mar 2016, 08:00 | 
 | 
| system error 31 Mar 2016, 08:15 John, it doesn't work on my machine. Maybe you missed the fact that it is a loaded object, and not a linked / executable file. Of course both work if it was in an executable / linked object. That means I can't properly execute a string code which is addressed using MOV, this way? | |||
|  31 Mar 2016, 08:15 | 
 | 
| Tomasz Grysztar 31 Mar 2016, 12:51 LEA in this case uses RIP-relative addressing and therefore does not need relocation (unless it refers to an address in some other section), while the opcode of MOV contains an absolute address that has to be relocated. So the fact that LEA works in your case but MOV doesn't, means that your loader has not applied the relocations correctly. | |||
|  31 Mar 2016, 12:51 | 
 | 
| system error 31 Mar 2016, 22:35 Thanks Tomasz. Sounds like there's more to it than it seemed. I'll check that out. | |||
|  31 Mar 2016, 22:35 | 
 | 
| < Last Thread | Next Thread > | 
| Forum Rules: 
 | 
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.