summaryrefslogtreecommitdiff
path: root/libc/tools/genversion-scripts.py
diff options
context:
space:
mode:
authorDimitry Ivanov <dimitry@google.com>2015-12-14 14:07:52 -0800
committerDimitry Ivanov <dimitry@google.com>2015-12-14 14:23:06 -0800
commit585e9598493d3b4a0e545dad35c0f361d4ad2d3e (patch)
tree5d1a2a01cc4566ea0a6ea7941147924276b186bd /libc/tools/genversion-scripts.py
parenta3dd076126df616b75b4fc4484f4750e0e3e6a7f (diff)
Generate libc version-script for brillo
Brillo doesn't use the ndk cruft, so we need separate set of version scripts. Added new "nobrillo" tag to mark such symbols in *.map.txt files. Bug: http://b/26164862 Change-Id: Iaee1b7119f75b68c2971679fc32817e6df29fd94
Diffstat (limited to 'libc/tools/genversion-scripts.py')
-rwxr-xr-xlibc/tools/genversion-scripts.py34
1 files changed, 20 insertions, 14 deletions
diff --git a/libc/tools/genversion-scripts.py b/libc/tools/genversion-scripts.py
index 37fb5e928..e15c04e5f 100755
--- a/libc/tools/genversion-scripts.py
+++ b/libc/tools/genversion-scripts.py
@@ -36,20 +36,26 @@ class VersionScriptGenerator(object):
basename = os.path.basename(script)
dirname = os.path.dirname(script)
for arch in all_arches:
- name = basename.split(".")[0] + "." + arch + ".map"
- tmp_path = os.path.join(bionic_temp, name)
- dest_path = os.path.join(dirname, name)
- with open(tmp_path, "w") as fout:
- with open(script, "r") as fin:
- fout.write("# %s\n" % warning)
- for line in fin:
- index = line.find("#")
- if index != -1:
- arches = line[index+1:].split()
- if arch not in arches:
- continue
- fout.write(line)
- shutil.copyfile(tmp_path, dest_path)
+ for brillo in [False, True]:
+ has_nobrillo = False
+ name = basename.split(".")[0] + "." + arch + (".brillo" if brillo else "") + ".map"
+ tmp_path = os.path.join(bionic_temp, name)
+ dest_path = os.path.join(dirname, name)
+ with open(tmp_path, "w") as fout:
+ with open(script, "r") as fin:
+ fout.write("# %s\n" % warning)
+ for line in fin:
+ index = line.find("#")
+ if index != -1:
+ tags = line[index+1:].split()
+ if arch not in tags:
+ continue
+ if brillo and "nobrillo" in tags:
+ has_nobrillo = True
+ continue
+ fout.write(line)
+ if not brillo or has_nobrillo:
+ shutil.copyfile(tmp_path, dest_path)
generator = VersionScriptGenerator()