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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 lib.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. However with bionic |
211 # the SONAME is actually libc.so. If we pass glibc's libc.so to objdump | 211 # the SONAME is actually libc.so. If we pass glibc's libc.so to objdump |
212 # if fails to parse it, os this filters out libc.so expept for within | 212 # if fails to parse it, os this filters out libc.so expept for within |
213 # the bionic toolchain. | 213 # the bionic toolchain. |
214 # TODO(noelallen): Remove this once the SONAME in bionic is made to be | 214 # TODO(bradnelson): Remove this once the SONAME in bionic is made to be |
215 # unique in the same it is under glibc: | 215 # unique in the same it is under glibc: |
216 # https://code.google.com/p/nativeclient/issues/detail?id=3833 | 216 # https://code.google.com/p/nativeclient/issues/detail?id=3833 |
217 rel_dirname = os.path.relpath(dirname, SDK_DIR) | 217 rel_dirname = os.path.relpath(dirname, SDK_DIR) |
218 if name == 'libc.so' and 'bionic' not in rel_dirname: | 218 if name == 'libc.so' and 'bionic' not in rel_dirname: |
219 continue | 219 continue |
220 filename = os.path.join(dirname, name) | 220 filename = os.path.join(dirname, name) |
221 if os.path.exists(filename): | 221 if os.path.exists(filename): |
222 files.append(filename) | 222 files.append(filename) |
223 if not files: | 223 if not files: |
224 raise Error('cannot find library %s' % name) | 224 raise Error('cannot find library %s' % name) |
225 return files | 225 return files |
226 | 226 |
227 | 227 |
228 def _GetNeededStatic(main_files): | 228 def _GetNeededStatic(main_files): |
229 needed = {} | 229 needed = {} |
230 for filename in main_files: | 230 for filename in main_files: |
231 arch = elf.ParseElfHeader(filename)[0] | 231 arch = elf.ParseElfHeader(filename)[0] |
232 needed[filename] = arch | 232 needed[filename] = arch |
233 return needed | 233 return needed |
OLD | NEW |