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

Side by Side Diff: src/untrusted/pll_loader/pll_loader_main.cc

Issue 1743893002: PNaCl dynamic linking: Build an initial dynamically-linked newlib-based libc (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Review: rename library Created 4 years, 9 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 | « src/untrusted/pll_loader/nacl.scons ('k') | tests/pnacl_dynamic_loading/libc_entry.c » ('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) 2016 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 #include <stdint.h>
6 #include <stdio.h>
7
8 #include "native_client/src/include/elf32.h"
9 #include "native_client/src/include/elf_auxv.h"
10 #include "native_client/src/untrusted/nacl/nacl_irt.h"
11 #include "native_client/src/untrusted/pll_loader/pll_loader.h"
12
13
14 typedef void (*start_func_t)(int argc, char **argv, char **envp,
15 Elf32_auxv_t *auxv);
16
17 int main(int argc, char **argv, char **envp) {
18 // The PLL format does not include module dependencies yet, so all the
19 // modules must be specified on the command line.
20 if (argc <= 2) {
21 fprintf(stderr, "Usage: pll_loader <ELF file>...\n");
22 return 1;
23 }
24
25 ModuleSet modset;
26 for (int i = 1; i < argc; i++) {
27 modset.AddByFilename(argv[i]);
28 }
29 modset.ResolveRefs();
30
31 Elf32_auxv_t auxv[2];
32 auxv[0].a_type = AT_SYSINFO;
33 auxv[0].a_un.a_val = (uintptr_t) __nacl_irt_query;
34 auxv[1].a_type = AT_NULL;
35 auxv[1].a_un.a_val = 0;
36
37 start_func_t start_func =
38 (start_func_t) (uintptr_t) modset.GetSym("__libc_start");
39 if (start_func == NULL) {
40 fprintf(stderr, "Entry point symbol \"__libc_start\" not defined\n");
41 return 1;
42 }
43 start_func(argc, argv, envp, auxv);
44
45 return 0;
46 }
OLDNEW
« no previous file with comments | « src/untrusted/pll_loader/nacl.scons ('k') | tests/pnacl_dynamic_loading/libc_entry.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698