Class ElfRelocationHandler

  • All Implemented Interfaces:
    ExtensionPoint

    public abstract class ElfRelocationHandler
    extends java.lang.Object
    implements ExtensionPoint
    ElfRelocationHandler provides the base class for processor specific ELF relocation handlers.
    • Constructor Detail

      • ElfRelocationHandler

        public ElfRelocationHandler()
    • Method Detail

      • canRelocate

        public abstract boolean canRelocate​(ElfHeader elf)
      • getRelrRelocationType

        public int getRelrRelocationType()
        Get the architecture-specific relative relocation type which should be applied to RELR relocations. The default implementation returns 0 which indicates RELR is unsupported.
        Returns:
        RELR relocation type
      • createRelocationContext

        public ElfRelocationContext createRelocationContext​(ElfLoadHelper loadHelper,
                                                            ElfRelocationTable relocationTable,
                                                            java.util.Map<ElfSymbol,​Address> symbolMap)
        Relocation context for a specific Elf image and relocation table. The relocation context is used to process relocations and manage any data required to process relocations.
        Parameters:
        loadHelper - Elf load helper
        relocationTable - Elf relocation table
        symbolMap - Elf symbol placement map
        Returns:
        relocation context or null if unsupported
      • isUnsupportedExternalRelocation

        public static boolean isUnsupportedExternalRelocation​(Program program,
                                                              Address relocationAddress,
                                                              Address symbolAddr,
                                                              java.lang.String symbolName,
                                                              long adjustment,
                                                              MessageLog log)
        Determine if symbolAddr is contained within the EXTERNAL block. If so, relocationAddress will be marked with a error bookmark. NOTE: This method should only be invoked when the symbol offset will be adjust with a non-zero value (i.e., addend).
        Parameters:
        program -
        relocationAddress - relocation address to be bookmarked if EXTERNAL block relocation
        symbolAddr - symbol address correspondng to relocation (may be null)
        symbolName - symbol name (may not be null if symbolAddr is not null)
        adjustment - relocation symbol offset adjustment/addend
        log - import log
        Returns:
        true if symbolAddress contained within EXTERNAL block.
      • markAsUnhandled

        public static void markAsUnhandled​(Program program,
                                           Address relocationAddress,
                                           long type,
                                           long symbolIndex,
                                           java.lang.String symbolName,
                                           MessageLog log)
        Generate error log entry and bookmark at relocationAddress indicating an unhandled relocation.
        Parameters:
        program -
        relocationAddress - relocation address to be bookmarked
        type - relocation type
        symbolIndex - associated symbol index within symbol table
        symbolName - associated symbol name
        log - import log
      • markAsUnsupportedRelr

        public static void markAsUnsupportedRelr​(Program program,
                                                 Address relocationAddress)
        Generate error log entry and bookmark at relocationAddress indicating an unsupported RELR relocation.
        Parameters:
        program -
        relocationAddress - relocation address to be bookmarked
      • markAsUninitializedMemory

        public static void markAsUninitializedMemory​(Program program,
                                                     Address relocationAddress,
                                                     long type,
                                                     long symbolIndex,
                                                     java.lang.String symbolName,
                                                     MessageLog log)
        Generate error log entry and bookmark at relocationAddress where import failed to transition block to initialized while processing relocation.
        Parameters:
        program -
        relocationAddress - relocation address to be bookmarked
        type - relocation type
        symbolIndex - associated symbol index within symbol table
        symbolName - associated symbol name
        log - import log
      • markAsError

        public static void markAsError​(Program program,
                                       Address relocationAddress,
                                       long type,
                                       java.lang.String symbolName,
                                       java.lang.String msg,
                                       MessageLog log)
        Generate error log entry and bookmark at relocationAddress where import failed to be applied.
        Parameters:
        program -
        relocationAddress - relocation address to be bookmarked
        type - relocation type
        symbolName - associated symbol name
        log - import log
      • markAsError

        public static void markAsError​(Program program,
                                       Address relocationAddress,
                                       java.lang.String type,
                                       java.lang.String symbolName,
                                       java.lang.String msg,
                                       MessageLog log)
        Generate error log entry and bookmark at relocationAddress where import failed to be applied.
        Parameters:
        program -
        relocationAddress - relocation address to be bookmarked
        type - relocation type
        symbolName - associated symbol name
        msg - additional error message
        log - import log
      • markAsWarning

        public static void markAsWarning​(Program program,
                                         Address relocationAddress,
                                         java.lang.String type,
                                         java.lang.String msg,
                                         MessageLog log)
        Generate warning log entry and bookmark at relocationAddress where import issue occurred.
        Parameters:
        program -
        relocationAddress - relocation address to be bookmarked
        type - relocation type
        msg - message associated with warning
        log - import log
      • markAsWarning

        public static void markAsWarning​(Program program,
                                         Address relocationAddress,
                                         java.lang.String type,
                                         java.lang.String symbolName,
                                         long symbolIndex,
                                         java.lang.String msg,
                                         MessageLog log)
        Generate warning log entry and bookmark at relocationAddress where import issue occurred.
        Parameters:
        program -
        relocationAddress - relocation address to be bookmarked
        type - relocation type
        symbolName - symbol name
        symbolIndex - symbol index
        msg - message associated with warning
        log - import log