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

Unified Diff: runtime/bin/main.cc

Issue 1771423002: Qualify the precompiled shared library name with the snapshot directory instead of using LD_LIBRARY… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/precompilation/test_linux.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/main.cc
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc
index d0b05065b34c9cd5ce31f4564f653ec120265bf0..33d4ba5762b4ea0d7d03856ebc257a252fd1ce29 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -1142,10 +1142,22 @@ static void ReadSnapshotFile(const char* snapshot_directory,
}
-static void* LoadLibrarySymbol(const char* libname, const char* symname) {
- void* library = Extensions::LoadExtensionLibrary(libname);
+static void* LoadLibrarySymbol(const char* snapshot_directory,
+ const char* libname,
+ const char* symname) {
+ char* concat = NULL;
+ const char* qualified_libname;
+ if ((snapshot_directory != NULL) && strlen(snapshot_directory) > 0) {
+ intptr_t len = snprintf(NULL, 0, "%s/%s", snapshot_directory, libname);
+ concat = new char[len + 1];
+ snprintf(concat, len + 1, "%s/%s", snapshot_directory, libname);
+ qualified_libname = concat;
+ } else {
+ qualified_libname = libname;
+ }
+ void* library = Extensions::LoadExtensionLibrary(qualified_libname);
if (library == NULL) {
- Log::PrintErr("Error: Failed to load library '%s'\n", libname);
+ Log::PrintErr("Error: Failed to load library '%s'\n", qualified_libname);
Platform::Exit(kErrorExitCode);
}
void* symbol = Extensions::ResolveSymbol(library, symname);
@@ -1153,6 +1165,9 @@ static void* LoadLibrarySymbol(const char* libname, const char* symname) {
Log::PrintErr("Error: Failed to load symbol '%s'\n", symname);
Platform::Exit(kErrorExitCode);
}
+ if (concat != NULL) {
+ delete concat;
+ }
return symbol;
}
@@ -1587,10 +1602,12 @@ void main(int argc, char** argv) {
const uint8_t* data_snapshot = NULL;
if (run_precompiled_snapshot) {
instructions_snapshot = reinterpret_cast<const uint8_t*>(
- LoadLibrarySymbol(kPrecompiledLibraryName,
+ LoadLibrarySymbol(precompiled_snapshot_directory,
+ kPrecompiledLibraryName,
kPrecompiledInstructionsSymbolName));
data_snapshot = reinterpret_cast<const uint8_t*>(
- LoadLibrarySymbol(kPrecompiledLibraryName,
+ LoadLibrarySymbol(precompiled_snapshot_directory,
+ kPrecompiledLibraryName,
kPrecompiledDataSymbolName));
ReadSnapshotFile(precompiled_snapshot_directory,
kPrecompiledVmIsolateName,
« no previous file with comments | « no previous file | tools/precompilation/test_linux.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698