mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:39:49 +00:00
Qualify the precompiled shared library name with the snapshot directory instead of using LD_LIBRARY_PATH.
R=johnmccutchan@google.com Review URL: https://codereview.chromium.org/1771423002 .
This commit is contained in:
parent
cb7aa02116
commit
a0e3bfdd68
|
@ -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,
|
||||
|
|
|
@ -12,4 +12,4 @@ set -ex
|
|||
|
||||
gcc -nostartfiles -m64 -shared -Wl,-soname,libprecompiled.so -o libprecompiled.so precompiled.S
|
||||
|
||||
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PWD" gdb -ex run --args ./out/DebugX64/dart_precompiled_runtime --run-precompiled-snapshot not_used.dart
|
||||
gdb -ex run --args ./out/DebugX64/dart_precompiled_runtime --run-precompiled-snapshot=$PWD not_used.dart
|
||||
|
|
|
@ -12,4 +12,4 @@ set -ex
|
|||
|
||||
gcc -nostartfiles -m32 -shared -Wl,-soname,libprecompiled.so -o libprecompiled.so precompiled.S
|
||||
|
||||
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PWD" gdb -ex run --args ./out/DebugSIMARM/dart_precompiled_runtime --run-precompiled-snapshot not_used.dart
|
||||
gdb -ex run --args ./out/DebugSIMARM/dart_precompiled_runtime --run-precompiled-snapshot=$PWD not_used.dart
|
||||
|
|
|
@ -12,4 +12,4 @@ set -ex
|
|||
|
||||
clang -nostartfiles -m64 -dynamiclib -o libprecompiled.dylib precompiled.S
|
||||
|
||||
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PWD" lldb -- ./xcodebuild/DebugX64/dart_precompiled_runtime --run-precompiled-snapshot not_used.dart
|
||||
lldb -- ./xcodebuild/DebugX64/dart_precompiled_runtime --run-precompiled-snapshot=$PWD not_used.dart
|
||||
|
|
|
@ -270,11 +270,10 @@ class DartPrecompiledRuntimeConfiguration extends DartVmRuntimeConfiguration {
|
|||
augmentedArgs.add("--run-precompiled-snapshot=${artifact.filename}");
|
||||
augmentedArgs.addAll(arguments);
|
||||
|
||||
var augmentedEnv = new Map.from(environmentOverrides);
|
||||
augmentedEnv['LD_LIBRARY_PATH'] = artifact.filename;
|
||||
|
||||
return <Command>[commandBuilder.getVmCommand(
|
||||
suite.dartPrecompiledBinaryFileName, augmentedArgs, augmentedEnv)];
|
||||
suite.dartPrecompiledBinaryFileName,
|
||||
augmentedArgs,
|
||||
environmentOverrides)];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue