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

Side by Side Diff: tools/android_link.py

Issue 2364623002: Filter tcmalloc out of Android link (Closed)
Patch Set: Created 4 years, 2 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright (c) 2012 The Dart Authors. All rights reserved. 3 # Copyright (c) 2012 The Dart Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """ 7 """
8 This script performs the final link step for Android NDK executables. 8 This script performs the final link step for Android NDK executables.
9 Usage: 9 Usage:
10 ./android_link {arm,arm64,ia32} {executable,library,shared_library} 10 ./android_link {arm,arm64,ia32} {executable,library,shared_library}
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 'platforms', 'android-14', 'arch-x86') 125 'platforms', 'android-14', 'arch-x86')
126 if target_arch == 'x64': 126 if target_arch == 'x64':
127 android_ndk_sysroot = os.path.join(android_ndk_root, 127 android_ndk_sysroot = os.path.join(android_ndk_root,
128 'platforms', 'android-21', 'arch-x86_64') 128 'platforms', 'android-21', 'arch-x86_64')
129 libdir = 'lib64' 129 libdir = 'lib64'
130 CheckDirExists(android_ndk_sysroot, 'Android sysroot') 130 CheckDirExists(android_ndk_sysroot, 'Android sysroot')
131 android_ndk_lib = os.path.join(android_ndk_sysroot, 'usr', libdir) 131 android_ndk_lib = os.path.join(android_ndk_sysroot, 'usr', libdir)
132 crtend_android = os.path.join(android_ndk_lib, 'crtend_android.o') 132 crtend_android = os.path.join(android_ndk_lib, 'crtend_android.o')
133 133
134 if link_target == 'target': 134 if link_target == 'target':
135 # We meddle with the android link command line here because gyp does not
136 # allow configurations to modify link_settings, or set variables.
137
135 # Add and remove libraries as listed in configurations_android.gypi 138 # Add and remove libraries as listed in configurations_android.gypi
136 libs_to_rm = ['-lrt', '-lpthread', '-lnss3', '-lnssutil3', '-lsmime3', 139 libs_to_rm = ['-lrt', '-lpthread',]
137 '-lplds4', '-lplc4', '-lnspr4',]
138 libs_to_add = ['-lstlport_static', android_libgcc, '-lc', '-ldl', 140 libs_to_add = ['-lstlport_static', android_libgcc, '-lc', '-ldl',
139 '-lstdc++', '-lm',] 141 '-lstdc++', '-lm',]
140 142
141 # Add crtend_android to end if we are linking an executable. 143 # Add crtend_android to end if we are linking an executable.
142 if link_type == 'executable': 144 if link_type == 'executable':
143 libs_to_add.extend(['-llog', '-lz', crtend_android]) 145 libs_to_add.extend(['-llog', '-lz', crtend_android])
144 146
147 # Filter out -l libs and add the right Android ones.
145 link_args = [i for i in link_args if i not in libs_to_rm] 148 link_args = [i for i in link_args if i not in libs_to_rm]
146 link_args.extend(libs_to_add) 149 link_args.extend(libs_to_add)
147 150
151 # Filter out tcmalloc.
152 link_args = [i for i in link_args if "tcmalloc" not in i]
153
148 link_args.insert(0, android_linker) 154 link_args.insert(0, android_linker)
149 else: 155 else:
150 link_args.extend(['-ldl', '-lrt']) 156 link_args.extend(['-ldl', '-lrt'])
151 link_args.insert(0, 'g++') 157 link_args.insert(0, 'g++')
152 158
153 sys.exit(execute(link_args)) 159 sys.exit(execute(link_args))
154 160
155 if __name__ == '__main__': 161 if __name__ == '__main__':
156 main() 162 main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698