Link with 'ld'. You can do just about anything you'd like. It's not quite clear to me what you want to do exactly (and I'd guess it would give away your secret cunning plan to tell), but you can move the text segment where you'd like with "-Ttext 0xADDRESS".It seems that an executable in Linux always starts at virtual address 0x8000. Is there any way of changing this? I don't mind hacking the ELF or the compiler, I just want it to start at a different address, as it's screwing up my exceedingly cunning plan...
Thanks for the replies - I can't use a branch as I need the compiler to ensure the code is built to run at the new address.
I'll try what DZZ suggests and see if it works. Ideally, I'd like to relocate the text segment to something like 0x10000000 instead of 0x00008000.
Thanks for the replies - I can't use a branch as I need the compiler to ensure the code is built to run at the new address.
I'll try what DZZ suggests and see if it works. Ideally, I'd like to relocate the text segment to something like 0x10000000 instead of 0x00008000.
HH trampoline?
Link with 'ld'. You can do just about anything you'd like. It's not quite clear to me what you want to do exactly (and I'd guess it would give away your secret cunning plan to tell), but you can move the text segment where you'd like with "-Ttext 0xADDRESS".
Glad you got it working! I had done a quick test using ld with the -Ttext and objdump indicated that it was putting stuff where I told it to, but that was a pretty simple application.Link with 'ld'. You can do just about anything you'd like. It's not quite clear to me what you want to do exactly (and I'd guess it would give away your secret cunning plan to tell), but you can move the text segment where you'd like with "-Ttext 0xADDRESS".
Ok, -Ttext 0xADDRESS didn't work too well. ld completely ignored me
Try with "--section-start" as well, but the same result
However, feeding ld a linkerscript with:
PROVIDE (__executable_start = 0x10000000); . = 0x10000000 + SIZEOF_HEADERS;
Seems to work just fine
Now... next job is to patch into the Linux SWI handler
Thanks for the replies - I can't use a branch as I need the compiler to ensure the code is built to run at the new address.
I'll try what DZZ suggests and see if it works. Ideally, I'd like to relocate the text segment to something like 0x10000000 instead of 0x00008000.
HH trampoline?
Nope! The program still runs needs to be able to run under Linux after the entry point modification has taken place.
I just need to reserve a large portion of the lower memory for something h34r:
Binary (de)compressors don't need to take over the software interrupt (SWI) handler... h34r:
Binary (de)compressors don't need to take over the software interrupt (SWI) handler... h34r:
dang you are right...
hmm.. that way could move the text/data segment into a cacheable/uncacheble region... could be for the demo compo then...