Note that there are some explanatory texts on larger screens.

plurals
  1. POElegant way to set base address of ELF image with Linux binutils?
    primarykey
    data
    text
    <p>For a personal project, I need to write an executable that loads at a non-default memory address. From <a href="https://stackoverflow.com/questions/8116648/why-is-the-elf-entry-point-0x8048000-not-changeable">this SO question</a>, I know I can set the entry address for an ELF and modify the section addresses manually so that the executable is effectively based at some address I choose. However, the answer suggests that this is only works if I don't glibc initialization (which I need for this project), and setting section memory addresses every time I compile would be difficult (not to mention tedious).</p> <p>It seems like there should be a better way to set a base address for an ELF when building, though I'll resort to doing it manually with a script post-build if need be. This option for <code>ld</code> would be perfect if it wasn't specific to the PE port:</p> <pre><code>--image-base value Use value as the base address of your program or dll. This is the lowest memory location that will be used when your program or dll is loaded. To reduce the need to relocate and improve performance of your dlls, each should have a unique base address and not overlap any other dlls. The default is 0x400000 for executables, and 0x10000000 for dlls. [This option is specific to the i386 PE targeted port of the linker] </code></pre> <p>I haven't yet found an ELF equivalent. Does none exist? Parsing the ELF file myself wouldn't be the end of the world, but it seems like this feature should exist somewhere.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload