macaw-base
Safe HaskellNone
LanguageHaskell2010

Data.Macaw.Memory.ElfLoader.PLTStubs

Description

Functionality for computing the names and addresses of PLT stub functions in a dynamically linked ELF binary.

Note that the API in this library is somewhat experimental, and as we further develop the underlying heuristics involved (see Note [PLT stub names]), we may need to change the API accordingly.

Synopsis

Documentation

data PLTStubInfo reloc Source #

Heuristics about how large (in bytes) the sizes of PLT-related stub functions are. See Note [PLT stub names] for more information. These heuristics are tailored to each architecture's dynamic relocations, which is why this is parameterized by a reloc type.

For more information about how to add your own value of type PLTStubInfo, see Note [Creating a new PLTStubInfo value].

Constructors

PLTStubInfo 

Fields

  • pltFunSize :: Integer

    The size of the .plt function, which is the first function in the .plt section in most cases.

  • pltStubSize :: Integer

    The size of each PLT stub in the .plt section.

  • pltGotStubSize :: Integer

    The size of each PLT stub in the .plt.got section. Note that not all architectures put stubs in a .plt.got section, so it is permissible to implement this using error on those architectures.

pltStubSymbols Source #

Arguments

:: forall reloc (w :: Nat). (w ~ RelocationWidth reloc, MemWidth w, IsRelocationType reloc) 
=> PLTStubInfo reloc

Heuristics about how large PLT stubs should be.

-> LoadOptions

Options configuring how to load the address of each PLT stub.

-> ElfHeaderInfo w

The dynamically linked ELF binary.

-> Map (MemWord w) (VersionedSymbol (ElfWordType w)) 

Match up names to PLT stub entries in a dynamically linked ELF binary.

Calls to functions in shared libraries are issued through PLT stubs. These are short sequences included in the binary by the compiler that jump to the *real* function implementation in the shared library via the Global Offset Table. The GOT is populated by the dynamic loader.

See Note [PLT stub names] for more details.

data NoRelocationType (w :: Nat) Source #

A dummy relocation type that is used for architectures that do not yet have a dynamic relocation type defined in elf-edit. The corresponding IsRelocationType instance will simply error.

Constructors

NoRelocationType 

Instances

Instances details
Show (NoRelocationType w) Source # 
Instance details

Defined in Data.Macaw.Memory.ElfLoader.PLTStubs

Show (ElfWordType w) => IsRelocationType (NoRelocationType w) Source #

A dummy IsRelocationType instance that will simply error if used.

Instance details

Defined in Data.Macaw.Memory.ElfLoader.PLTStubs

Associated Types

type RelocationWidth (NoRelocationType w) 
Instance details

Defined in Data.Macaw.Memory.ElfLoader.PLTStubs

type RelocationWidth (NoRelocationType w) = w
type RelocationWidth (NoRelocationType w) Source # 
Instance details

Defined in Data.Macaw.Memory.ElfLoader.PLTStubs

type RelocationWidth (NoRelocationType w) = w