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

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

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/build.sh ('k') | ports/nacl-spawn/elf_reader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef NACL_SPAWN_ELF_READER_
6 #define NACL_SPAWN_ELF_READER_
7
8 #include <elf.h>
9 #include <stdio.h>
10
11 #include <string>
12 #include <vector>
13
14 // An ELF reader which extracts shared objects which are necessary to
15 // run the specified binary (DT_NEEDED). As no NaCl binary in the NaCl
16 // SDK does not have DT_RPATH and DT_RUNPATH (as of Jan. 2014), we do
17 // not support them.
18 class ElfReader {
19 public:
20 explicit ElfReader(const char* filename);
21
22 bool is_valid() const { return is_valid_; }
23 bool is_static() const { return is_static_; }
24 Elf64_Half machine() const { return machine_; }
25 const std::vector<std::string>& neededs() const { return neededs_; }
26
27 private:
28 bool ReadHeaders(FILE* fp, std::vector<Elf64_Phdr>* phdrs);
29 bool ReadDynamic(FILE* fp, const std::vector<Elf64_Phdr>& phdrs,
30 Elf64_Addr* straddr, size_t* strsize,
31 std::vector<int>* neededs);
32 bool ReadStrtab(FILE* fp, const std::vector<Elf64_Phdr>& phdrs,
33 Elf64_Addr straddr, size_t strsize,
34 std::string* strtab);
35 void PrintError(const char* fmt, ...);
36
37 const char* filename_;
38 bool is_valid_;
39 bool is_static_;
40 Elf64_Half machine_;
41 unsigned char elf_class_;
42 std::vector<std::string> neededs_;
43 };
44
45 #endif // NACL_SPAWN_ELF_READER_
OLDNEW
« no previous file with comments | « ports/nacl-spawn/build.sh ('k') | ports/nacl-spawn/elf_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698