platform_bionic/tools/generate-version-script.py
Elliott Hughes 28a644594b s/riscv/riscv64/
Unlike the kernel script (where plain "riscv" was correct because that's
what the kernel uses, making no distinction between riscv32 and riscv64
in the uapi header directories), this should say "riscv64" because
that's what our build system uses.

(This wasn't caught because we haven't wired up the .bp file yet.)

Test: treehugger
Change-Id: I086aaa89e69bf4ddc484a7e93a6c413fd8c719ff
2022-10-05 20:17:41 +00:00

30 lines
834 B
Python
Executable file

#!/usr/bin/env python3
# This tool is used to generate the version scripts for libc, libm, libdl,
# and libstdc++ for every architecture.
# usage: generate-version-script.py ARCH INPUT OUTPUT
import sys
def has_arch_tags(tags):
for arch in ["arm", "arm64", "riscv64", "x86", "x86_64"]:
if arch in tags:
return True
return False
def GenerateVersionScript(arch, in_filename, out_filename):
with open(out_filename, "w") as fout:
with open(in_filename, "r") as fin:
for line in fin:
index = line.find("#")
if index != -1:
tags = line[index+1:].split()
if arch not in tags and has_arch_tags(tags):
continue
fout.write(line)
arch = sys.argv[1]
in_filename = sys.argv[2]
out_filename = sys.argv[3]
GenerateVersionScript(arch, in_filename, out_filename)