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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 203 |
204 Args: | 204 Args: |
205 name: name of library to find | 205 name: name of library to find |
206 lib_path: A list of paths to search for shared libraries. | 206 lib_path: A list of paths to search for shared libraries. |
207 | 207 |
208 Returns: | 208 Returns: |
209 A list of system paths that match the given name within the lib_path''' | 209 A list of system paths that match the given name within the lib_path''' |
210 files = [] | 210 files = [] |
211 for dirname in lib_path: | 211 for dirname in lib_path: |
212 # The libc.so files in the the glibc toolchain is actually a linker | 212 # The libc.so files in the the glibc toolchain is actually a linker |
213 # script which references libc.so.<SHA1>. This means the lib.so itself | 213 # script which references libc.so.<SHA1>. This means the libc.so itself |
214 # does not end up in the NEEDED section for glibc. However with bionic | 214 # does not end up in the NEEDED section for glibc. |
215 # the SONAME is actually libc.so. If we pass glibc's libc.so to objdump | 215 if name == 'libc.so': |
216 # if fails to parse it, os this filters out libc.so expept for within | |
217 # the bionic toolchain. | |
218 # TODO(bradnelson): Remove this once the SONAME in bionic is made to be | |
219 # unique in the same it is under glibc: | |
220 # https://code.google.com/p/nativeclient/issues/detail?id=3833 | |
221 rel_dirname = os.path.relpath(dirname, SDK_DIR) | |
222 if name == 'libc.so' and 'bionic' not in rel_dirname: | |
223 continue | 216 continue |
224 filename = os.path.join(dirname, name) | 217 filename = os.path.join(dirname, name) |
225 if os.path.exists(filename): | 218 if os.path.exists(filename): |
226 files.append(filename) | 219 files.append(filename) |
227 if not files: | 220 if not files: |
228 raise Error('cannot find library %s' % name) | 221 raise Error('cannot find library %s' % name) |
229 return files | 222 return files |
230 | 223 |
231 | 224 |
232 def _GetNeededStatic(main_files): | 225 def _GetNeededStatic(main_files): |
233 needed = {} | 226 needed = {} |
234 for filename in main_files: | 227 for filename in main_files: |
235 arch = elf.ParseElfHeader(filename)[0] | 228 arch = elf.ParseElfHeader(filename)[0] |
236 needed[filename] = arch | 229 needed[filename] = arch |
237 return needed | 230 return needed |
OLD | NEW |