Class: ELFTools::Relocation

Inherits:
Object
  • Object
show all
Defined in:
lib/elftools/sections/relocation_section.rb

Overview

A relocation entry.

Can be either a REL or RELA relocation. XXX: move this to an independent file?

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(header, stream) ⇒ Relocation

Instantiate a ELFTools::Relocation object.



82
83
84
85
# File 'lib/elftools/sections/relocation_section.rb', line 82

def initialize(header, stream)
  @header = header
  @stream = stream
end

Instance Attribute Details

#headerELFTools::Structs::ELF_Rel, ELFTools::Structs::ELF_Rela (readonly)

Returns Rel(a) header.



78
79
80
# File 'lib/elftools/sections/relocation_section.rb', line 78

def header
  @header
end

#stream#pos=, #read (readonly)

Returns Streaming object.

Returns:

  • (#pos=, #read)

    Streaming object.



79
80
81
# File 'lib/elftools/sections/relocation_section.rb', line 79

def stream
  @stream
end

Instance Method Details

#r_info_symInteger Also known as: symbol_index

r_info contains sym and type, use two methods to access them easier.

Returns:

  • (Integer)

    sym infor.



90
91
92
# File 'lib/elftools/sections/relocation_section.rb', line 90

def r_info_sym
  header.r_info >> mask_bit
end

#r_info_typeInteger Also known as: type

r_info contains sym and type, use two methods to access them easier.

Returns:

  • (Integer)

    type infor.



98
99
100
# File 'lib/elftools/sections/relocation_section.rb', line 98

def r_info_type
  header.r_info & ((1 << mask_bit) - 1)
end