Rtld: Difference between revisions

Thog (talk | contribs)
m Add R_AARCH64_ABS32 relocation type
DCNick3 (talk | contribs)
m Fix link to MOD page
 
Line 1: Line 1:
rtld, short for “runtime link-editor”, is the first executable code belonging to the program that the system launches. This serves as the program entry point and crt0. rtld's entry point is defined to be the start of its .text section.
rtld, short for “runtime link-editor”, is the first executable code belonging to the program that the system launches. This serves as the program entry point and crt0. rtld's entry point is defined to be the start of its .text section.


rtld is tasked with relocating the [[NSO|NSOs]] that were loaded in to memory by the system loader, at a random base address. To do this, it requires that binaries include a [[NSO#MOD|module header]], and a pointer to it at offset +0x04 in the .text section.
rtld is tasked with relocating the [[NSO|NSOs]] that were loaded in to memory by the system loader, at a random base address. To do this, it requires that binaries include a [[MOD|module header]], and a pointer to it at offset +0x04 in the .text section.


rtld receives two parameters from the system, in X0 and X1. The first parameter should be null. The second parameter is the handle of the main thread. See the [[Homebrew_ABI#Entrypoint_Arguments|entrypoint arguments]] section.
rtld receives two parameters from the system, in X0 and X1. The first parameter should be null. The second parameter is the handle of the main thread. See the [[Homebrew_ABI#Entrypoint_Arguments|entrypoint arguments]] section.