Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Unified Diff: tools/nacl_elf_constants.py

Issue 4181005: Fixes some bugs with memory setup and halt-sled allocation and... (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/elf_patcher.py ('k') | tools/set_abi_version.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/nacl_elf_constants.py
===================================================================
--- tools/nacl_elf_constants.py (revision 0)
+++ tools/nacl_elf_constants.py (revision 0)
@@ -0,0 +1,32 @@
+#!/usr/bin/python
+
+# Copyright 2010 The Native Client Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can
+# be found in the LICENSE file.
+
+import re
+
+def GetNaClElfConstants(header_file):
+
+ symbols = [ 'ELFOSABI_NACL',
+ 'EF_NACL_ALIGN_MASK',
+ 'EF_NACL_ALIGN_16',
+ 'EF_NACL_ALIGN_32',
+ 'EF_NACL_ALIGN_LIB',
+ 'EF_NACL_ABIVERSION',
+ ]
+
+ extractors = [ r'#\s*define\s+%s\s+([x\d]+)' % s
+ for s in symbols ]
+
+ nfas = [ re.compile(extractor) for extractor in extractors ]
+ results = len(extractors) * [ -1 ]
+ for line in open(header_file):
+ for ix, nfa in enumerate(nfas):
+ m = nfa.search(line)
+ if m is not None:
+ results[ix] = int(m.group(1), 0)
+ continue
+ if -1 in results:
+ raise RuntimeError, 'Could not parse header file %s' % header_file
+ return dict(zip(symbols, results))
Property changes on: tools/nacl_elf_constants.py
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « tools/elf_patcher.py ('k') | tools/set_abi_version.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698