I want to write an ELF file manually. How can I make my elven call standard library c

I want to write an ELF file manually. How can I make my elven call standard library c. I know about the kernel search for the PT_INTERP program header and read "/lib/ld-linux.so.2", and I know about the global offset table (GOT) and the procedure binding table (PLT).

But I don’t know how the ELF file with PT_INTERP phdr, GOT, PLT will be executed and will call the C library. I need to know this in binary format to help me create a handmade ELF.

+4
source share
1 answer

What happens ::

  • ​​ VAS ( );

  • ​​ ;

  • (DT_NEEDED) shared-objects VAS

    • DT_NEEDED libc, .
  • :

    • GOT libc;

    • PLT libc ( .PLT0), GOT;

    • GOT;

    • libc funtion () ;

    • DT_RELA, DT_REL, DT_RELASZ, DT_RELSZ, DT_RELAENT, DT_RELENT, DL_PLTREL, PLTRELSZ, DT_JMPREL;

    • PLT.

  • .

0

Source: https://habr.com/ru/post/1656552/


All Articles