Class: Rubycc::IR::GlobalReloc

Inherits:
Data
  • Object
show all
Defined in:
lib/rubycc/ir/ir.rb

Overview

One relocation inside a global's .data image. offset is the byte offset of the 8-byte pointer slot within that global. kind is :symbol for the address of another file-scope object — symbol names it, resolved as an absolute 64-bit address (a "&global" or a decayed global array) — or :string for a string literal, where string_id indexes the translation unit's string pool and the compiler resolves it to a .rodata offset. The unused field is nil for each kind. addend is a constant byte displacement added to the base address (0 for a bare "&global" or string, non-zero for a computed address constant such as "&arr", "arr + n" or "&rec.member"); it becomes the R_X86_64_64 relocation's r_addend.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(offset:, kind:, symbol:, string_id:, addend: 0) ⇒ GlobalReloc

Returns a new instance of GlobalReloc.



387
388
389
# File 'lib/rubycc/ir/ir.rb', line 387

def initialize(offset:, kind:, symbol:, string_id:, addend: 0)
  super
end

Instance Attribute Details

#addendObject (readonly)

Returns the value of attribute addend

Returns:

  • (Object)

    the current value of addend



386
387
388
# File 'lib/rubycc/ir/ir.rb', line 386

def addend
  @addend
end

#kindObject (readonly)

Returns the value of attribute kind

Returns:

  • (Object)

    the current value of kind



386
387
388
# File 'lib/rubycc/ir/ir.rb', line 386

def kind
  @kind
end

#offsetObject (readonly)

Returns the value of attribute offset

Returns:

  • (Object)

    the current value of offset



386
387
388
# File 'lib/rubycc/ir/ir.rb', line 386

def offset
  @offset
end

#string_idObject (readonly)

Returns the value of attribute string_id

Returns:

  • (Object)

    the current value of string_id



386
387
388
# File 'lib/rubycc/ir/ir.rb', line 386

def string_id
  @string_id
end

#symbolObject (readonly)

Returns the value of attribute symbol

Returns:

  • (Object)

    the current value of symbol



386
387
388
# File 'lib/rubycc/ir/ir.rb', line 386

def symbol
  @symbol
end