Class: Bfd::Section

Inherits:
Object
  • Object
show all
Defined in:
lib/BFD.rb

Constant Summary collapse

FLAG_ALLOC =

From bfd.h: ‘Tells the OS to allocate space for this section when loading.

This is clear for a section containing debug information only.'
'ALLOC'
FLAG_LOAD =

From bfd.h: ‘Tells the OS to load the section from the file when loading. This is clear for a .bss section.’

'LOAD'
FLAG_RELOC =

From bfd.h: ‘The section contains data still to be relocated, so there is some relocation information too.’

'RELOC'
FLAG_RO =

From bfd.h: ‘A signal to the OS that the section contains read only data.’

'READONLY'
FLAG_CODE =

From bfd.h: ‘The section contains code only.’

'CODE'
FLAG_DATA =

From bfd.h: ‘The section contains data only.’

'DATA'
FLAG_CTOR =

From bfd.h: ‘The section contains constructor information. This section type is used by the linker to create lists of constructors and destructors used by <<g++>>. When a back end sees a symbol which should be used in a constructor list, it creates a new section for the type of name (e.g., <<CTOR_LIST>>), attaches the symbol to it, and builds a relocation. To build the lists of constructors, all the linker has to do is catenate all the sections called <<CTOR_LIST>> and relocate the data contained within - exactly the operations it would peform on standard data.’

'CONSTRUCTOR'
FLAG_LOCAL =

From bfd.h: ‘The section contains thread local data.’

'THREAD_LOCAL'
FLAGS =

Section flags. Defined in /usr/include/bfd.h : typedef struct bfd_section

{ 0x00000001 => FLAG_ALLOC,
        0x00000002 => FLAG_LOAD,
        0x00000004 => FLAG_RELOC,
        0x00000008 => FLAG_RO,
        0x00000010 => FLAG_CODE,
        0x00000020 => FLAG_DATA,
        0x00000040 => 'ROM',
        0x00000080 => FLAG_CTOR,
        0x00000100 => 'HAS_CONTENTS',
        0x00000200 => 'NEVER_LOAD',
        0x00000400 => FLAG_LOCAL,
        0x00000800 => 'HAS_GOT_REF',
        0x00001000 => 'IS_COMMON',
        0x00002000 => 'DEBUGGING',
        0x00004000 => 'IN_MEMORY',
        0x00008000 => 'EXCLUDE',
        0x00010000 => 'SORT_ENTRIES',
        0x00020000 => 'LINK_ONCE',
        0x00040000 => 'LINK_DUPLICATES_ONE_ONLY',
        0x00080000 => 'LINK_DUPLICATES_SAME_SIZE',
        0x00100000 => 'LINKER_CREATED',
        0x00200000 => 'KEEP',
        0x00400000 => 'SMALL_DATA',
        0x00800000 => 'MERGE',
        0x01000000 => 'STRINGS',
        0x02000000 => 'GROUP',
        0x04000000 => 'COFF_SHARED_LIBRARY',
        0x08000000 => 'COFF_SHARED',
        0x10000000 => 'TIC54X_BLOCK',
        0x20000000 => 'TIC54X_CLINK',
        0x40000000 => 'COFF_NOREAD' 
}

Instance Method Summary collapse

Instance Method Details

#flagsObject

Return an array of the names of the bit-flags that are set in Section. See raw_flags.



336
337
338
339
340
# File 'lib/BFD.rb', line 336

def flags()
  f = []
  FLAGS.each { |k,v| f << v if (@raw_flags & k > 0) }
  return f
end

#inspectObject



346
347
348
349
# File 'lib/BFD.rb', line 346

def inspect
  spec = "%X (%X), %X" % [ @vma, @file_pos, @size ]
  "[#{@id}] #{@name} #{spec}, #{flags.join('|')}"
end

#to_sObject



342
343
344
# File 'lib/BFD.rb', line 342

def to_s
  @name
end