jon.recoil.org

Module Build_igot_and_iplt

Build intermediate GOT and PLT sections from extracted relocations.

This module constructs synthetic IGOT and IPLT sections that allow code within a partition to reach external symbols via local, in-range entries rather than relying on the linker's default GOT/PLT placement.

The transformation converts:

Every PLT entry requires a corresponding GOT entry (since the PLT stub jumps through the GOT), so the IGOT contains entries for both PLT and GOT symbols.

type t

The result of building IGOT and IPLT sections.

Returns the built IGOT.

Returns the built IPLT.

val plt_symbols : Build_igot_and_iplt.t -> string list

Returns the original symbols that had PLT32 relocations (need IPLT entries).

val got_symbols : Build_igot_and_iplt.t -> string list

Returns the original symbols that had GOTPCRELX relocations (need IGOT entries, but not IPLT entries). These are in addition to the PLT symbols which also get IGOT entries.

val build : prefix:string -> Extract_relocations.t -> Build_igot_and_iplt.t

build ~prefix relocations builds IGOT and IPLT sections from the extracted relocations.

  • parameter prefix

    A unique prefix for this partition (e.g., "0", "1")

  • parameter relocations

    The relocations extracted from the partition's object files

val igot_symbol_for_got_reloc : Build_igot_and_iplt.t -> Extract_relocations.Relocation_entry.t -> string option

igot_symbol_for_plt_reloc t reloc returns the IGOT symbol name that should replace the original PLT32 relocation target, or None if the relocation doesn't need conversion.

Note: PLT32 relocations are redirected to IPLT entries, not directly to IGOT. Use iplt_symbol_for_plt_reloc instead.

val iplt_symbol_for_plt_reloc : Build_igot_and_iplt.t -> Extract_relocations.Relocation_entry.t -> string option

iplt_symbol_for_plt_reloc t reloc returns the IPLT symbol name that should replace the original PLT32 relocation target, or None if the relocation doesn't need conversion.