On 25/11/2018 14:58, Jonas Maebe wrote:
On 25/11/18 13:51, Florian Klämpfl wrote:
I am not aware that somewhere a fixed offset is applied. All info is read from the auxiliary data and the header.

You can have a load address offset in case there is a PT_PHDR. From http://www.gabriel.urdhr.fr/2015/01/22/elf-linking/ :

// Simplified code from the GNU dynamic linker source code:
for (ph = phdr; ph < &phdr[phnum]; ++ph)
   if (ph->p_type == PT_PHDR)
     main_map->l_addr = (ElfW(Addr)) phdr - ph->p_vaddr;

There doesn't seem to be one in Colin's program though.


Jonas
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Somehow this thread reminds my one open bug : https://bugs.freepascal.org/view.php?id=34475

I have found out that you need to have either linked against libc or have small binary stub generated from assembler source (like 64-bit pascal programs/libraries have that doesn't link against libc) linked against your 32-bit program so it can access PHDR structure without crashing on access violation exception.

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to