tools/binary_size/libsupersize/readelf.py
def SectionInfoFromElf(elf_path, tool_prefix):
  """Finds the address and size of all ELF sections

  Returns:
    A dict of section_name->(start_address, size).
  """
  args = [path_util.GetReadElfPath(tool_prefix), '-S', '--wide', elf_path]
  stdout = subprocess.check_output(args, encoding='ascii')
  section_ranges = {}
  # Matches  [ 2] .hash HASH 00000000006681f0 0001f0 003154 04   A  3   0  8
  for match in re.finditer(r'\[[\s\d]+\] (\..*)$', stdout, re.MULTILINE):
    items = match.group(1).split()
    section_ranges[items[0]] = (int(items[2], 16), int(items[4], 16))
  return section_ranges
Finds the address and size of all ELF sections

  Returns:
    A dict of section_name->(start_address, size).
  
Finds the address and size of all ELF sections
Finds the address and size of all ELF sections
def SectionInfoFromElf(elf_path, tool_prefix):
  args = [path_util.GetReadElfPath(tool_prefix), '-S', '--wide', elf_path]
  stdout = subprocess.check_output(args, encoding='ascii')
  section_ranges = {}
  for match in re.finditer(r'\[[\s\d]+\] (\..*)$', stdout, re.MULTILINE):
    items = match.group(1).split()
    section_ranges[items[0]] = (int(items[2], 16), int(items[4], 16))
  return section_ranges
def SectionInfoFromElf ( elf_path , tool_prefix ) : args = [ path_util . GetReadElfPath ( tool_prefix ) , '-S' , '--wide' , elf_path ] stdout = subprocess . check_output ( args , encoding = 'ascii' ) section_ranges = { } for match in re . finditer ( r'\[[\s\d]+\] (\..*)$' , stdout , re . MULTILINE ) : items = match . group ( 1 ) . split ( ) section_ranges [ items [ 0 ] ] = ( int ( items [ 2 ] , 16 ) , int ( items [ 4 ] , 16 ) ) return section_ranges
Finds the address and size of all ELF sections
Finds the address and size of all ELF sections
"""Finds the address and size of all ELF sections

  Returns:
    A dict of section_name->(start_address, size).
  """ # Matches  [ 2] .hash HASH 00000000006681f0 0001f0 003154 04   A  3   0  8
A dict of section_name->(start_address, size).
A dict of section_name - > ( start_address size ) .
elf_path
tool_prefix