| 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 libc.so itself | 213 # script which references libc.so.<SHA1>. This means the lib.so itself |
| 214 # does not end up in the NEEDED section for glibc. | 214 # does not end up in the NEEDED section for glibc. However with bionic |
| 215 if name == 'libc.so': | 215 # the SONAME is actually libc.so. If we pass glibc's libc.so to objdump |
| 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: |
| 216 continue | 223 continue |
| 217 filename = os.path.join(dirname, name) | 224 filename = os.path.join(dirname, name) |
| 218 if os.path.exists(filename): | 225 if os.path.exists(filename): |
| 219 files.append(filename) | 226 files.append(filename) |
| 220 if not files: | 227 if not files: |
| 221 raise Error('cannot find library %s' % name) | 228 raise Error('cannot find library %s' % name) |
| 222 return files | 229 return files |
| 223 | 230 |
| 224 | 231 |
| 225 def _GetNeededStatic(main_files): | 232 def _GetNeededStatic(main_files): |
| 226 needed = {} | 233 needed = {} |
| 227 for filename in main_files: | 234 for filename in main_files: |
| 228 arch = elf.ParseElfHeader(filename)[0] | 235 arch = elf.ParseElfHeader(filename)[0] |
| 229 needed[filename] = arch | 236 needed[filename] = arch |
| 230 return needed | 237 return needed |
| OLD | NEW |