mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 16:55:08 +00:00
[vm] Locate ELF/Mach-O scripts with realpath in dart_precompiled_runtime.
Change-Id: I93f38bbd59c565c19677eedf7f434b52ffa9fb71 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109401 Commit-Queue: Samir Jindel <sjindel@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com>
This commit is contained in:
parent
5e2a950685
commit
0bfb943500
|
@ -33,21 +33,4 @@ fi
|
|||
export DART_CONFIGURATION=${DART_CONFIGURATION:-ReleaseX64}
|
||||
BIN_DIR="$OUT_DIR$DART_CONFIGURATION"
|
||||
|
||||
OPTIONS=()
|
||||
SNAPSHOT=()
|
||||
for arg in "$@"; do
|
||||
case $arg in
|
||||
--*)
|
||||
OPTIONS+=("$arg")
|
||||
;;
|
||||
*)
|
||||
SNAPSHOT="$arg"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Pass an absolute file path to the snapshot so that the dynamic linker can find
|
||||
# ELF snapshots which are not in the system load path.
|
||||
SNAPSHOT=$(realpath "$SNAPSHOT")
|
||||
|
||||
exec "$BIN_DIR"/dart_precompiled_runtime "${OPTIONS[@]}" "$SNAPSHOT"
|
||||
exec "$BIN_DIR"/dart_precompiled_runtime "$@"
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "bin/snapshot_utils.h"
|
||||
|
||||
#include "bin/dartutils.h"
|
||||
|
@ -240,7 +242,17 @@ AppSnapshot* Snapshot::TryReadAppSnapshot(const char* script_name) {
|
|||
#if defined(DART_PRECOMPILED_RUNTIME)
|
||||
// For testing AOT with the standalone embedder, we also support loading
|
||||
// from a dynamic library to simulate what happens on iOS.
|
||||
|
||||
#if defined(TARGET_OS_LINUX) || defined(TARGET_OS_MACOS)
|
||||
// On Linux and OSX, resolve the script path before passing into dlopen()
|
||||
// since dlopen will not search the filesystem for paths like 'libtest.so'.
|
||||
std::unique_ptr<char, decltype(std::free)*> absolute_path{
|
||||
realpath(script_name, nullptr), std::free};
|
||||
script_name = absolute_path.get();
|
||||
#endif
|
||||
|
||||
snapshot = TryReadAppSnapshotDynamicLibrary(script_name);
|
||||
|
||||
if (snapshot != NULL) {
|
||||
return snapshot;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue