tools/cygprofile/compare_orderfiles.py
def ParseOrderfile(filename):
  """Parses an orderfile into a list of symbols.

  Args:
    filename: (str) Path to the orderfile.

  Returns:
    [str] List of symbols.
  """
  symbols = []
  lines = []
  already_seen = set()
  with open(filename, 'r') as f:
    lines = [line.strip() for line in f]

  # The (new) orderfiles that are oriented at the LLD linker contain only symbol
  # names (i.e. not prefixed with '.text'). The (old) orderfiles aimed at the
  # Gold linker were patched by duplicating symbols prefixed with '.text.hot.',
  # '.text.unlikely.' and '.text.', hence the appearance of '.text' on the first
  # symbol indicates such a legacy orderfile.
  if not lines[0].startswith('.text.'):
    for entry in lines:
      symbol_name = entry.rstrip('\n')
      assert symbol_name != '*' and symbol_name != '.text'
      already_seen.add(symbol_name)
      symbols.append(symbol_name)
  else:
    for entry in lines:
      # Keep only (input) section names, not symbol names (only rare special
      # symbols contain '.'). We could only keep symbols, but then some even
      # older orderfiles would not be parsed.
      if '.' not in entry:
        continue
      # Example: .text.startup.BLA
      symbol_name = entry[entry.rindex('.'):]
      if symbol_name in already_seen or symbol_name == '*' or entry == '.text':
        continue
      already_seen.add(symbol_name)
      symbols.append(symbol_name)
  return symbols
Parses an orderfile into a list of symbols.

  Args:
    filename: (str) Path to the orderfile.

  Returns:
    [str] List of symbols.
  
Parses an orderfile into a list of symbols.
Parses an orderfile into a list of symbols .
def ParseOrderfile(filename):
  symbols = []
  lines = []
  already_seen = set()
  with open(filename, 'r') as f:
    lines = [line.strip() for line in f]
  if not lines[0].startswith('.text.'):
    for entry in lines:
      symbol_name = entry.rstrip('\n')
      assert symbol_name != '*' and symbol_name != '.text'
      already_seen.add(symbol_name)
      symbols.append(symbol_name)
  else:
    for entry in lines:
      if '.' not in entry:
        continue
      symbol_name = entry[entry.rindex('.'):]
      if symbol_name in already_seen or symbol_name == '*' or entry == '.text':
        continue
      already_seen.add(symbol_name)
      symbols.append(symbol_name)
  return symbols
def ParseOrderfile ( filename ) : symbols = [ ] lines = [ ] already_seen = set ( ) with open ( filename , 'r' ) as f : lines = [ line . strip ( ) for line in f ] if not lines [ 0 ] . startswith ( '.text.' ) : for entry in lines : symbol_name = entry . rstrip ( '\n' ) assert symbol_name != '*' and symbol_name != '.text' already_seen . add ( symbol_name ) symbols . append ( symbol_name ) else : for entry in lines : if '.' not in entry : continue symbol_name = entry [ entry . rindex ( '.' ) : ] if symbol_name in already_seen or symbol_name == '*' or entry == '.text' : continue already_seen . add ( symbol_name ) symbols . append ( symbol_name ) return symbols
Parses an orderfile into a list of symbols.
Parses an orderfile into a list of symbols .
"""Parses an orderfile into a list of symbols.

  Args:
    filename: (str) Path to the orderfile.

  Returns:
    [str] List of symbols.
  """ # The (new) orderfiles that are oriented at the LLD linker contain only symbol # names (i.e. not prefixed with '.text'). The (old) orderfiles aimed at the # Gold linker were patched by duplicating symbols prefixed with '.text.hot.', # '.text.unlikely.' and '.text.', hence the appearance of '.text' on the first # symbol indicates such a legacy orderfile. # Keep only (input) section names, not symbol names (only rare special # symbols contain '.'). We could only keep symbols, but then some even # older orderfiles would not be parsed. # Example: .text.startup.BLA
[str] List of symbols.
[ str ] List of symbols .
filename
(str) Path to the orderfile.
( str ) Path to the orderfile .