OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "native_client/src/trusted/plugin/pnacl_coordinator.h" | 5 #include "native_client/src/trusted/plugin/pnacl_coordinator.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "native_client/src/include/portability_io.h" | 10 #include "native_client/src/include/portability_io.h" |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
402 } | 402 } |
403 } | 403 } |
404 | 404 |
405 ////////////////////////////////////////////////////////////////////// | 405 ////////////////////////////////////////////////////////////////////// |
406 // Helper functions for loading native libs. | 406 // Helper functions for loading native libs. |
407 // Done here to avoid hacking on the manifest parser further... | 407 // Done here to avoid hacking on the manifest parser further... |
408 | 408 |
409 namespace { | 409 namespace { |
410 | 410 |
411 // Fake filename for the object file generated by llvm. | 411 // Fake filename for the object file generated by llvm. |
412 const nacl::string kGeneratedObjectFileName = | 412 nacl::string kGeneratedObjectFileName() { |
Mark Mentovai
2011/11/06 14:09:02
No longer a constant, get rid of the k.
Nico
2011/11/06 17:30:38
Done.
| |
413 nacl::string("___PNACL_GENERATED"); | 413 return nacl::string("___PNACL_GENERATED"); |
414 } | |
414 | 415 |
415 string_vector LinkResources(const nacl::string& sandbox_isa, | 416 string_vector LinkResources(const nacl::string& sandbox_isa, |
416 bool withGenerated) { | 417 bool withGenerated) { |
417 string_vector results; | 418 string_vector results; |
418 nacl::string base_dir = "pnacl_support/" + sandbox_isa; | 419 nacl::string base_dir = "pnacl_support/" + sandbox_isa; |
419 | 420 |
420 // NOTE: order of items == link order. | 421 // NOTE: order of items == link order. |
421 if (withGenerated) { | 422 if (withGenerated) { |
422 results.push_back(kGeneratedObjectFileName); | 423 results.push_back(kGeneratedObjectFileName()); |
423 } | 424 } |
424 results.push_back(base_dir + "/libcrt_platform.a"); | 425 results.push_back(base_dir + "/libcrt_platform.a"); |
425 results.push_back(base_dir + "/libgcc.a"); | 426 results.push_back(base_dir + "/libgcc.a"); |
426 results.push_back(base_dir + "/libgcc_eh.a"); | 427 results.push_back(base_dir + "/libgcc_eh.a"); |
427 return results; | 428 return results; |
428 } | 429 } |
429 | 430 |
430 } // namespace | 431 } // namespace |
431 | 432 |
432 ////////////////////////////////////////////////////////////////////// | 433 ////////////////////////////////////////////////////////////////////// |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
505 ld_subprocess, | 506 ld_subprocess, |
506 "AddArg", | 507 "AddArg", |
507 "C", | 508 "C", |
508 &dummy_params, | 509 &dummy_params, |
509 link_file.c_str())) { | 510 link_file.c_str())) { |
510 AbortLinkThread(p, | 511 AbortLinkThread(p, |
511 "PnaclCoordinator linker AddArg(" + | 512 "PnaclCoordinator linker AddArg(" + |
512 link_file + ") failed."); | 513 link_file + ") failed."); |
513 } | 514 } |
514 // Also map the file name to descriptor. | 515 // Also map the file name to descriptor. |
515 if (i->compare(kGeneratedObjectFileName) == 0) { | 516 if (i->compare(kGeneratedObjectFileName()) == 0) { |
516 SrpcParams dummy_params2; | 517 SrpcParams dummy_params2; |
517 if (!PnaclSrpcLib::InvokeSrpcMethod(browser_interface, | 518 if (!PnaclSrpcLib::InvokeSrpcMethod(browser_interface, |
518 ld_subprocess, | 519 ld_subprocess, |
519 "AddFileWithSize", | 520 "AddFileWithSize", |
520 "Chi", | 521 "Chi", |
521 &dummy_params2, | 522 &dummy_params2, |
522 link_file.c_str(), | 523 link_file.c_str(), |
523 p->obj_wrapper->desc(), | 524 p->obj_wrapper->desc(), |
524 p->obj_len)) { | 525 p->obj_len)) { |
525 AbortLinkThread(p, | 526 AbortLinkThread(p, |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
748 // Finally, actually schedule the downloads. | 749 // Finally, actually schedule the downloads. |
749 for (size_t i = 0; i < downloads.size(); ++i) { | 750 for (size_t i = 0; i < downloads.size(); ++i) { |
750 if (!ScheduleDownload(downloads[i].first, downloads[i].second)) { | 751 if (!ScheduleDownload(downloads[i].first, downloads[i].second)) { |
751 break; // error should have been reported by ScheduleDownload. | 752 break; // error should have been reported by ScheduleDownload. |
752 } | 753 } |
753 } | 754 } |
754 downloads.clear(); | 755 downloads.clear(); |
755 } | 756 } |
756 | 757 |
757 } // namespace plugin | 758 } // namespace plugin |
OLD | NEW |