Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: ports/nacl-spawn/elf_reader.cc

Issue 627103003: Add shared library version of libcli_main Base URL: https://chromium.googlesource.com/external/naclports.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ports/nacl-spawn/elf_reader.h ('k') | ports/nacl-spawn/include/bsd_spawn.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ports/nacl-spawn/elf_reader.h ('k') | ports/nacl-spawn/include/bsd_spawn.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698