macaw-base
Copyright(c) Galois Inc 2015-2018
Maintainerjhendrix@galois.com
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Macaw.Memory.Symbols

Description

Defines constructors for precisely capturing symbol table information.

Synopsis

Symbols

data SymbolInfo Source #

This provides information about a symbol in the file.

Constructors

SymbolInfo 

Fields

  • symbolName :: !SymbolName

    The name of the symbol

    Symbols are used for many purposes in a file. Symbol names may not be unique, and may even be empty. For example, Elf files uses the empty name for section symbols. On ARM, "$a", "$d" and "$t" are used to indicate regions of ARM code, data, thumb.

  • symbolVersion :: !SymbolVersion

    Version information used to constrain when one symbol matches another.

  • symbolDef :: !SymbolBinding
     

data SymbolBinding Source #

This defines information about the symbol related to whether it is defined (and if so how it binds) or undefined (and if so what requiremens there are for a match).

Constructors

DefinedSymbol !SymbolPrecedence !SymbolDefType

The symbol is defined and globally visible.

The strong symbol flag controls the precedence. If true, then this definition must be used for the symbol with that name, and the linker is not allowed to replace the symbol. Is false, then the linker will use a strong symbol if it exists, and one of the weak symbols if it does not.

The address is the address the symbol was loaded at. It may not be a valid segment offset if the original binary used symbols at unexpected addresses.

SymbolSection !SectionIndex

The symbol denotes a section in an object file with the given index. These are primarily intended for relocations.

The symbol version should be UnversionedSymbol with this.

SymbolFile !ByteString

This symbol denotes a file name with the given string

The symbol version should be UnversionedSymbol with this.

UndefinedSymbol !SymbolRequirement !SymbolUndefType

An undefined symbol

The Boolean flag controls whether the symbol must be defined. If it is False and the linker cannot find a definition, then it just treats the symbol address as 0. If it is True and the linker cannot find a definition, then it must throw an error.

data SymbolVersion #

Instances

Instances details
Generic SymbolVersion 
Instance details

Defined in Data.BinarySymbols

Associated Types

type Rep SymbolVersion 
Instance details

Defined in Data.BinarySymbols

type Rep SymbolVersion = D1 ('MetaData "SymbolVersion" "Data.BinarySymbols" "binary-symbols-0.1.4-inplace" 'False) ((C1 ('MetaCons "UnversionedSymbol" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ObjectDefaultSymbol" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString))) :+: (C1 ('MetaCons "ObjectNonDefaultSymbol" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString)) :+: C1 ('MetaCons "VersionedSymbol" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString))))
Show SymbolVersion 
Instance details

Defined in Data.BinarySymbols

Eq SymbolVersion 
Instance details

Defined in Data.BinarySymbols

Ord SymbolVersion 
Instance details

Defined in Data.BinarySymbols

Hashable SymbolVersion 
Instance details

Defined in Data.BinarySymbols

type Rep SymbolVersion 
Instance details

Defined in Data.BinarySymbols

type Rep SymbolVersion = D1 ('MetaData "SymbolVersion" "Data.BinarySymbols" "binary-symbols-0.1.4-inplace" 'False) ((C1 ('MetaCons "UnversionedSymbol" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ObjectDefaultSymbol" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString))) :+: (C1 ('MetaCons "ObjectNonDefaultSymbol" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString)) :+: C1 ('MetaCons "VersionedSymbol" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString))))

Defined symbol information

data SymbolPrecedence Source #

Describes symbol precedence

Constructors

SymbolStrong

Symbol has high precedence

SymbolLocal

The symbol has high precedence, but only visible within the object file that created it.

SymbolWeak

Symbol has low precedence

data SymbolDefType Source #

This denotes type information associated with a defined

Constructors

SymbolDefUnknown

We do not know what type of object this refers to.

SymbolDefFunc

This symbol denotes a defined function.

SymbolDefObject

This symbol denotes a object.

SymbolDefThreadLocal

This symbol denotes a thread local identifier

SymbolDefIFunc

This symbol is a IFUNC (e.g., it calls a function to resolve the symbol)

SymbolDefNoType

This symbol does not have a specified type.

Undefined symbol infomration

data SymbolRequirement Source #

Describes whether an undefined symbol is required during linking.

Constructors

SymbolRequired

Undefined symbol must be found during linking

SymbolOptional

Undefined symbol treated as zero if not found during linking.

data SymbolUndefType Source #

Flags information about an undefined symbol.

Constructors

SymbolUndefThreadLocal

This symbol denotes data stored in a thread.

SymbolUndefNoType

This is stored globally for application, but otherwise has no type information.

Concretely we have seen this symbol type generated by gcc for external functions and data and _GLOBAL_OFFSET_TABLE_

SymbolUndefFunc

This symbol is intended to denote a function.

SymbolUndefObject

This symbol is intended to denote some data.