Skip to content
This repository has been archived by the owner on Sep 15, 2021. It is now read-only.

Commit

Permalink
Bug 579131: Script to count number of global initializers in .so file…
Browse files Browse the repository at this point in the history
…s. r=bhearsum
  • Loading branch information
Chris AtLee committed Jul 19, 2010
1 parent 71df273 commit e05967d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions buildfarm/utils/count_ctors.py
@@ -0,0 +1,14 @@
#!/usr/bin/python
import subprocess, re
def count_ctors(filename):
proc = subprocess.Popen(['readelf', '-W', '-S', filename], stdout=subprocess.PIPE)

for line in proc.stdout:
m = re.search("\.ctors\s+PROGBITS\s+[0-9a-f]+\s+[0-9a-f]+\s+([0-9a-f]+)", line)
if m:
return int(m.group(1), 16)

if __name__ == '__main__':
import sys
for f in sys.argv[1:]:
print "%s\t%s" % (count_ctors(f), f)

0 comments on commit e05967d

Please sign in to comment.