OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Helper script to close over all transitive dependencies of a given .nexe | 5 """Helper script to close over all transitive dependencies of a given .nexe |
6 executable. | 6 executable. |
7 | 7 |
8 e.g. Given | 8 e.g. Given |
9 A -> B | 9 A -> B |
10 B -> C | 10 B -> C |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 199 |
200 Args: | 200 Args: |
201 name: name of library to find | 201 name: name of library to find |
202 lib_path: A list of paths to search for shared libraries. | 202 lib_path: A list of paths to search for shared libraries. |
203 | 203 |
204 Returns: | 204 Returns: |
205 A list of system paths that match the given name within the lib_path''' | 205 A list of system paths that match the given name within the lib_path''' |
206 files = [] | 206 files = [] |
207 for dirname in lib_path: | 207 for dirname in lib_path: |
208 # The libc.so files in the the glibc toolchain is actually a linker | 208 # The libc.so files in the the glibc toolchain is actually a linker |
209 # script which references libc.so.<SHA1>. This means the lib.so itself | 209 # script which references libc.so.<SHA1>. This means the libc.so itself |
210 # does not end up in the NEEDED section for glibc. However with bionic | 210 # does not end up in the NEEDED section for glibc. |
211 # the SONAME is actually libc.so. If we pass glibc's libc.so to objdump | 211 if name == 'libc.so': |
212 # if fails to parse it, os this filters out libc.so expept for within | |
213 # the bionic toolchain. | |
214 # TODO(bradnelson): Remove this once the SONAME in bionic is made to be | |
215 # unique in the same it is under glibc: | |
216 # https://code.google.com/p/nativeclient/issues/detail?id=3833 | |
217 rel_dirname = os.path.relpath(dirname, SDK_DIR) | |
218 if name == 'libc.so' and 'bionic' not in rel_dirname: | |
219 continue | 212 continue |
220 filename = os.path.join(dirname, name) | 213 filename = os.path.join(dirname, name) |
221 if os.path.exists(filename): | 214 if os.path.exists(filename): |
222 files.append(filename) | 215 files.append(filename) |
223 if not files: | 216 if not files: |
224 raise Error('cannot find library %s' % name) | 217 raise Error('cannot find library %s' % name) |
225 return files | 218 return files |
226 | 219 |
227 | 220 |
228 def _GetNeededStatic(main_files): | 221 def _GetNeededStatic(main_files): |
229 needed = {} | 222 needed = {} |
230 for filename in main_files: | 223 for filename in main_files: |
231 arch = elf.ParseElfHeader(filename)[0] | 224 arch = elf.ParseElfHeader(filename)[0] |
232 needed[filename] = arch | 225 needed[filename] = arch |
233 return needed | 226 return needed |
OLD | NEW |