From 5724656acb2058c6adb6bd4040fb0867576c6353 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 4 Jan 2018 23:33:07 +0100 Subject: [PATCH] android/build.py: enable function/data sections in static libraries .. and make all library symbols hidden by default. Saves big amounts of .text section size with --gc-sections, because only this allows discarding unused functions from those (static) third-party libraries. --- android/build.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/android/build.py b/android/build.py index fab6ecb49..edabccf01 100755 --- a/android/build.py +++ b/android/build.py @@ -73,6 +73,8 @@ class AndroidNdkToolchain: self.cxx = os.path.join(llvm_bin, 'clang++') common_flags += ' -target ' + llvm_triple + ' -integrated-as -gcc-toolchain ' + toolchain_path + common_flags += ' -fvisibility=hidden -fdata-sections -ffunction-sections' + self.ar = os.path.join(toolchain_bin, arch + '-ar') self.ranlib = os.path.join(toolchain_bin, arch + '-ranlib') self.nm = os.path.join(toolchain_bin, arch + '-nm')