Chromium Code Reviews| 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 21 matching lines...) Expand all Loading... | |
| 32 'elf32-i386': 'x86-32', | 32 'elf32-i386': 'x86-32', |
| 33 'elf32-little': 'arm', | 33 'elf32-little': 'arm', |
| 34 'elf32-littlearm': 'arm', | 34 'elf32-littlearm': 'arm', |
| 35 # Names returned by old x86_64-nacl-objdump: | 35 # Names returned by old x86_64-nacl-objdump: |
| 36 'elf64-nacl': 'x86-64', | 36 'elf64-nacl': 'x86-64', |
| 37 'elf32-nacl': 'x86-32', | 37 'elf32-nacl': 'x86-32', |
| 38 # Names returned by new x86_64-nacl-objdump: | 38 # Names returned by new x86_64-nacl-objdump: |
| 39 'elf64-x86-64-nacl': 'x86-64', | 39 'elf64-x86-64-nacl': 'x86-64', |
| 40 'elf32-x86-64-nacl': 'x86-64', | 40 'elf32-x86-64-nacl': 'x86-64', |
| 41 'elf32-i386-nacl': 'x86-32', | 41 'elf32-i386-nacl': 'x86-32', |
| 42 'elf32-littlearm-nacl': 'arm', | |
| 42 } | 43 } |
| 43 | 44 |
| 44 # The proper name of the dynamic linker, as kept in the IRT. This is | 45 # The proper name of the dynamic linker, as kept in the IRT. This is |
| 45 # excluded from the nmf file by convention. | 46 # excluded from the nmf file by convention. |
| 46 LD_NACL_MAP = { | 47 LD_NACL_MAP = { |
| 47 'x86-32': 'ld-nacl-x86-32.so.1', | 48 'x86-32': 'ld-nacl-x86-32.so.1', |
| 48 'x86-64': 'ld-nacl-x86-64.so.1', | 49 'x86-64': 'ld-nacl-x86-64.so.1', |
| 49 'arm': None, | 50 'arm': None, |
| 50 } | 51 } |
| 51 | 52 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 '''Finds the set of libraries matching |name| within lib_path | 195 '''Finds the set of libraries matching |name| within lib_path |
| 195 | 196 |
| 196 Args: | 197 Args: |
| 197 name: name of library to find | 198 name: name of library to find |
| 198 lib_path: A list of paths to search for shared libraries. | 199 lib_path: A list of paths to search for shared libraries. |
| 199 | 200 |
| 200 Returns: | 201 Returns: |
| 201 A list of system paths that match the given name within the lib_path''' | 202 A list of system paths that match the given name within the lib_path''' |
| 202 files = [] | 203 files = [] |
| 203 for dirname in lib_path: | 204 for dirname in lib_path: |
| 205 # The libc.so files in the the glibc toolchain is actually a linker | |
|
binji
2014/04/07 20:16:56
File a bug for this and reference it here.
Sam Clegg
2014/04/07 20:41:35
Done.
| |
| 206 # script which references libc.so.<SHA1>. This means the lib.so itself | |
| 207 # does not end up in the NEEDED section for glibc. However with bionic | |
| 208 # the SONAME is actually libc.so. If we pass glibc's libc.so to objdump | |
| 209 # if fails to parse it, os this filters out libc.so expept for within | |
| 210 # the bionic toolchain. | |
| 211 # TODO(noelallen): Remove this once the SONAME in bionic is made to be | |
| 212 # unique in the same it is under glibc. | |
| 213 if name == 'libc.so' and 'bionic' not in dirname: | |
| 214 continue | |
| 204 filename = os.path.join(dirname, name) | 215 filename = os.path.join(dirname, name) |
| 205 if os.path.exists(filename): | 216 if os.path.exists(filename): |
| 206 files.append(filename) | 217 files.append(filename) |
| 207 if not files: | 218 if not files: |
| 208 raise Error('cannot find library %s' % name) | 219 raise Error('cannot find library %s' % name) |
| 209 return files | 220 return files |
| 210 | 221 |
| 211 | 222 |
| 212 def _GetNeededStatic(main_files): | 223 def _GetNeededStatic(main_files): |
| 213 needed = {} | 224 needed = {} |
| 214 for filename in main_files: | 225 for filename in main_files: |
| 215 arch = elf.ParseElfHeader(filename)[0] | 226 arch = elf.ParseElfHeader(filename)[0] |
| 216 needed[filename] = arch | 227 needed[filename] = arch |
| 217 return needed | 228 return needed |
| OLD | NEW |