Comment by monocasa

1 day ago

Not on modern archs that provide decent support for PIE (position independent executables).

How do you think position independent code can call functions from other .so's without being patched with their addresses?

They can't, so even PIC code still has to have a relocation table that gets patched. It's in a different page than the code though, so code does still get reused.

  • That's not really patching though, any more than any use of function pointers is patching.

    • There's a part of the .so ELF file (the Global Offset Table aka GOT) that has to be modified with all the addresses of the functions being imported, which of course vary from process to process.

      If not patching, what exactly would you call modifying part of the file?

      1 reply →