Merge "Generate per-architecture version scripts." am: 578d949e8d
am: b420ddd27e
* commit 'b420ddd27e1ce0becf0e57c0fc0efe9ec726ab21':
Generate per-architecture version scripts.
This commit is contained in:
@@ -1385,7 +1385,12 @@ LOCAL_CLANG := $(use_clang)
|
||||
LOCAL_REQUIRED_MODULES := tzdata
|
||||
LOCAL_ADDITIONAL_DEPENDENCIES := \
|
||||
$(libc_common_additional_dependencies) \
|
||||
$(LOCAL_PATH)/libc.map \
|
||||
$(LOCAL_PATH)/libc.arm.map \
|
||||
$(LOCAL_PATH)/libc.arm64.map \
|
||||
$(LOCAL_PATH)/libc.mips.map \
|
||||
$(LOCAL_PATH)/libc.mips64.map \
|
||||
$(LOCAL_PATH)/libc.x86.map \
|
||||
$(LOCAL_PATH)/libc.x86_64.map \
|
||||
|
||||
# Leave the symbols in the shared library so that stack unwinders can produce
|
||||
# meaningful name resolution.
|
||||
@@ -1413,7 +1418,12 @@ LOCAL_CXX_STL := none
|
||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
||||
|
||||
# Don't re-export new/delete and friends, even if the compiler really wants to.
|
||||
LOCAL_LDFLAGS := -Wl,--version-script,$(LOCAL_PATH)/libc.map
|
||||
LOCAL_LDFLAGS_arm := -Wl,--version-script,$(LOCAL_PATH)/libc.arm.map
|
||||
LOCAL_LDFLAGS_arm64 := -Wl,--version-script,$(LOCAL_PATH)/libc.arm64.map
|
||||
LOCAL_LDFLAGS_mips := -Wl,--version-script,$(LOCAL_PATH)/libc.mips.map
|
||||
LOCAL_LDFLAGS_mips64 := -Wl,--version-script,$(LOCAL_PATH)/libc.mips64.map
|
||||
LOCAL_LDFLAGS_x86 := -Wl,--version-script,$(LOCAL_PATH)/libc.x86.map
|
||||
LOCAL_LDFLAGS_x86_64 := -Wl,--version-script,$(LOCAL_PATH)/libc.x86_64.map
|
||||
|
||||
# We'd really like to do this for all architectures, but since this wasn't done
|
||||
# before, these symbols must continue to be exported on LP32 for binary
|
||||
|
||||
1448
libc/libc.arm.map
Normal file
1448
libc/libc.arm.map
Normal file
File diff suppressed because it is too large
Load Diff
1178
libc/libc.arm64.map
Normal file
1178
libc/libc.arm64.map
Normal file
File diff suppressed because it is too large
Load Diff
1303
libc/libc.mips.map
Normal file
1303
libc/libc.mips.map
Normal file
File diff suppressed because it is too large
Load Diff
1178
libc/libc.mips64.map
Normal file
1178
libc/libc.mips64.map
Normal file
File diff suppressed because it is too large
Load Diff
1302
libc/libc.x86.map
Normal file
1302
libc/libc.x86.map
Normal file
File diff suppressed because it is too large
Load Diff
1178
libc/libc.x86_64.map
Normal file
1178
libc/libc.x86_64.map
Normal file
File diff suppressed because it is too large
Load Diff
55
libc/tools/genversion-scripts.py
Executable file
55
libc/tools/genversion-scripts.py
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# This tool is used to generate the version scripts for libc and libm
|
||||
# for every architecture.
|
||||
|
||||
import atexit
|
||||
import os.path
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
|
||||
all_arches = ["arm", "arm64", "mips", "mips64", "x86", "x86_64"]
|
||||
bionic_libc_root = os.path.join(os.environ["ANDROID_BUILD_TOP"], "bionic/libc")
|
||||
bionic_libm_root = os.path.join(os.environ["ANDROID_BUILD_TOP"], "bionic/libm")
|
||||
libc_script = os.path.join(bionic_libc_root, "libc.map.txt")
|
||||
libm_script = os.path.join(bionic_libm_root, "libm.map.txt")
|
||||
|
||||
# TODO (dimity): generate architecture-specific version scripts as part of build
|
||||
|
||||
# temp directory where we store all intermediate files
|
||||
bionic_temp = tempfile.mkdtemp(prefix="bionic_genversionscripts")
|
||||
# Make sure the directory is deleted when the script exits.
|
||||
atexit.register(shutil.rmtree, bionic_temp)
|
||||
|
||||
bionic_libc_root = os.path.join(os.environ["ANDROID_BUILD_TOP"], "bionic/libc")
|
||||
|
||||
warning = "Generated by genversionscripts.py. Do not edit."
|
||||
|
||||
|
||||
class VersionScriptGenerator(object):
|
||||
|
||||
def run(self):
|
||||
for script in [libc_script, libm_script]:
|
||||
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)
|
||||
|
||||
|
||||
generator = VersionScriptGenerator()
|
||||
generator.run()
|
||||
|
||||
Reference in New Issue
Block a user