| OLD | NEW |
| 1 // Copyright (c) 2014 The Native Client Authors. All rights reserved. | 1 // Copyright (c) 2014 The Native Client 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 #include "elf_reader.h" | 5 #include "elf_reader.h" |
| 6 | 6 |
| 7 #include <assert.h> | 7 #include <assert.h> |
| 8 #include <elf.h> | 8 #include <elf.h> |
| 9 #include <errno.h> | 9 #include <errno.h> |
| 10 #include <stdarg.h> | 10 #include <stdarg.h> |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 ScopedFile fp(fopen(filename, "rb")); | 34 ScopedFile fp(fopen(filename, "rb")); |
| 35 if (!fp.get()) { | 35 if (!fp.get()) { |
| 36 PrintError("failed to open file"); | 36 PrintError("failed to open file"); |
| 37 return; | 37 return; |
| 38 } | 38 } |
| 39 | 39 |
| 40 std::vector<Elf64_Phdr> phdrs; | 40 std::vector<Elf64_Phdr> phdrs; |
| 41 if (!ReadHeaders(fp.get(), &phdrs)) | 41 if (!ReadHeaders(fp.get(), &phdrs)) |
| 42 return; | 42 return; |
| 43 | 43 |
| 44 bool dynamic_found = false; | |
| 45 Elf64_Addr straddr = 0; | 44 Elf64_Addr straddr = 0; |
| 46 size_t strsize = 0; | 45 size_t strsize = 0; |
| 47 std::vector<int> neededs; | 46 std::vector<int> neededs; |
| 48 if (!ReadDynamic(fp.get(), phdrs, &straddr, &strsize, &neededs)) | 47 if (!ReadDynamic(fp.get(), phdrs, &straddr, &strsize, &neededs)) |
| 49 return; | 48 return; |
| 50 | 49 |
| 51 std::string strtab; | 50 std::string strtab; |
| 52 if (!ReadStrtab(fp.get(), phdrs, straddr, strsize, &strtab)) | 51 if (!ReadStrtab(fp.get(), phdrs, straddr, strsize, &strtab)) |
| 53 return; | 52 return; |
| 54 | 53 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 return 1; | 268 return 1; |
| 270 | 269 |
| 271 for (size_t i = 0; i < elf_reader.neededs().size(); i++) { | 270 for (size_t i = 0; i < elf_reader.neededs().size(); i++) { |
| 272 if (i) | 271 if (i) |
| 273 printf(" "); | 272 printf(" "); |
| 274 printf("%s", elf_reader.neededs()[i].c_str()); | 273 printf("%s", elf_reader.neededs()[i].c_str()); |
| 275 } | 274 } |
| 276 } | 275 } |
| 277 | 276 |
| 278 #endif // DEFINE_ELF_READER_MAIN | 277 #endif // DEFINE_ELF_READER_MAIN |
| OLD | NEW |