Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
elf_loader.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter 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#ifndef FLUTTER_TESTING_ELF_LOADER_H_
6#define FLUTTER_TESTING_ELF_LOADER_H_
7
8#include <memory>
9
10#include "flutter/common/settings.h"
11#include "flutter/fml/macros.h"
12#include "third_party/dart/runtime/bin/elf_loader.h"
13
14namespace flutter {
15namespace testing {
16
17inline constexpr const char* kDefaultAOTAppELFFileName = "app_elf_snapshot.so";
18
19// This file name is what gen_snapshot defaults to. It is based off of the
20// name of the base file, with the `2` indicating that this split corresponds
21// to loading unit id of 2. The base module id is 1 and is omitted as it is not
22// considered a split. If dart changes the naming convention, this should be
23// changed to match, however, this is considered unlikely to happen.
24inline constexpr const char* kDefaultAOTAppELFSplitFileName =
25 "app_elf_snapshot.so-2.part.so";
26
30
31using UniqueLoadedELF = std::unique_ptr<Dart_LoadedElf, LoadedELFDeleter>;
32
35 const uint8_t* vm_snapshot_data = nullptr;
36 const uint8_t* vm_snapshot_instrs = nullptr;
37 const uint8_t* vm_isolate_data = nullptr;
38 const uint8_t* vm_isolate_instrs = nullptr;
39};
40
41//------------------------------------------------------------------------------
42/// @brief Attempts to resolve AOT symbols from the portable ELF loader.
43/// This location is automatically resolved from the fixtures
44/// generator. This only returns valid symbols when the VM is
45/// configured for AOT.
46///
47/// @param[in] elf_filename The AOT ELF filename from the fixtures generator.
48///
49/// @return The loaded ELF symbols.
50///
52
53//------------------------------------------------------------------------------
54/// @brief Attempts to resolve split loading unit AOT symbols from the
55/// portable ELF loader. If the dart code does not make use of
56/// deferred libraries, then there will be no split .so to load.
57/// This only returns valid symbols when the VM is configured for
58/// AOT.
59///
60/// @param[in] elf_split_filename The split AOT ELF filename from the fixtures
61/// generator.
62///
63/// @return The loaded ELF symbols.
64///
66 std::string elf_split_filename);
67
68//------------------------------------------------------------------------------
69/// @brief Prepare the settings objects various AOT mappings resolvers with
70/// the symbols already loaded. This method does nothing in non-AOT
71/// runtime modes.
72///
73/// @warning The symbols must not be collected till all shell instantiations
74/// made using the settings object are collected.
75///
76/// @param[in/out] settings The settings whose AOT resolvers to populate.
77/// @param[in] symbols The symbols used to populate the settings object.
78///
79/// @return If the settings object was correctly updated.
80///
82 const ELFAOTSymbols& symbols);
83
84} // namespace testing
85} // namespace flutter
86
87#endif // FLUTTER_TESTING_ELF_LOADER_H_
ELFAOTSymbols LoadELFSymbolFromFixturesIfNeccessary(std::string elf_filename)
Attempts to resolve AOT symbols from the portable ELF loader. This location is automatically resolved...
Definition elf_loader.cc:17
bool PrepareSettingsForAOTWithSymbols(Settings &settings, const ELFAOTSymbols &symbols)
Prepare the settings objects various AOT mappings resolvers with the symbols already loaded....
ELFAOTSymbols LoadELFSplitSymbolFromFixturesIfNeccessary(std::string elf_split_filename)
Attempts to resolve split loading unit AOT symbols from the portable ELF loader. If the dart code doe...
Definition elf_loader.cc:66
constexpr const char * kDefaultAOTAppELFSplitFileName
Definition elf_loader.h:24
constexpr const char * kDefaultAOTAppELFFileName
Definition elf_loader.h:17
std::unique_ptr< Dart_LoadedElf, LoadedELFDeleter > UniqueLoadedELF
Definition elf_loader.h:31
const uint8_t * vm_snapshot_data
Definition elf_loader.h:35
const uint8_t * vm_snapshot_instrs
Definition elf_loader.h:36
const uint8_t * vm_isolate_instrs
Definition elf_loader.h:38
const uint8_t * vm_isolate_data
Definition elf_loader.h:37
void operator()(Dart_LoadedElf *elf)
Definition elf_loader.h:28
DART_EXPORT void Dart_UnloadELF(Dart_LoadedElf *loaded)