flat assembler
Message board for the users of flat assembler.
Index
> Main > Can't perform calculations on addresses? |
Author |
|
Tomasz Grysztar 30 Oct 2003, 01:04
Such thing happens when you use output format that uses the relocatable labels, like PE. If you are using PE and don't plan to include the relocations in your program, you can use the solution that was provided here: http://board.flatassembler.net/topic.php?t=37#395.
|
|||
30 Oct 2003, 01:04 |
|
Plue 18 Nov 2007, 11:03
I have this problem with an ELF file that I don't need to be relocated. However, format ELF at 0x00100000 gives me "extra characters on line". What can I do?
|
|||
18 Nov 2007, 11:03 |
|
LocoDelAssembly 18 Nov 2007, 13:30
If possible use "format elf executable" instead. I think there is no solution for object ELF since fasm always construct them relocatable.
Well, there is one, but no idea if you can trust the calculated address on run-time Code: format elf section 'text' executable _start: ; a = _start xor $deadbeef Fuck! we can't do that virtual at 0 dd _start load b dword from 0 end virtual a = b xor $deadbeef ; Now we can |
|||
18 Nov 2007, 13:30 |
|
vid 18 Nov 2007, 13:46
Code: virtual at 0 dd _start load b dword from 0 end virtual good catch! "load" shouldn't be allowed from relocated data. But i am not sure if this is possible in current FASM |
|||
18 Nov 2007, 13:46 |
|
Plue 18 Nov 2007, 13:54
> If possible use "format elf executable" instead.
Then sections doesn't seem to work. But never mind, I just fill in the data at run time. |
|||
18 Nov 2007, 13:54 |
|
LocoDelAssembly 18 Nov 2007, 14:30
Plue, but you can use segments instead, no?
vid, that trick is ancient, I even robbed it from cris' assembly listing generator. I think it would be very painfull for fasm to keep tracking of memory content to check when load can be allowed so this "backdoor" will hardly dissapear. And looking at the FAQ I see another much simpler method (but disables relocations completely) Code: format elf section 'text' executable org $8040000 _start: a = _start xor $deadbeef; Now works! But how do you ensure that section 'text' will be loaded at $8040000 is the question... |
|||
18 Nov 2007, 14:30 |
|
vid 18 Nov 2007, 15:20
Quote: But how do you ensure that section 'text' will be loaded at $8040000 is the question... at runtime, "call / pop eax" and check address, no? |
|||
18 Nov 2007, 15:20 |
|
LocoDelAssembly 18 Nov 2007, 15:38
But then, for what was useful to precalc the XOR operation if then it must be corrected by a delta?
You can also check and exit if the address is not the desired one but that is not a very descent program and would be better to calculate operations with labels at run-time instead. |
|||
18 Nov 2007, 15:38 |
|
vid 18 Nov 2007, 16:01
Quote: But then, for what was useful to precalc the XOR operation if then it must be corrected by a delta? not corrected. Quote: You can also check and exit if the address is not the desired one but that is not a very descent program and would be better to calculate operations with labels at run-time instead. that is what i meant. and of course, it is a stupid idea |
|||
18 Nov 2007, 16:01 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.