diff options
| author | 2017-10-05 23:30:08 -0400 | |
|---|---|---|
| committer | 2017-10-05 23:30:08 -0400 | |
| commit | 33ea53094cc1f34c27ca295472f01f8dd09a300b (patch) | |
| tree | c45a8eefd68222c390b28ab2dfba3d787c4634ac /src/core/loader/linker.h | |
| parent | nso: Fixes to support homebrew NSOs without a MOD header. (diff) | |
| download | yuzu-33ea53094cc1f34c27ca295472f01f8dd09a300b.tar.gz yuzu-33ea53094cc1f34c27ca295472f01f8dd09a300b.tar.xz yuzu-33ea53094cc1f34c27ca295472f01f8dd09a300b.zip | |
loader: Add support for NRO, as well as various fixes and shared linker.
Diffstat (limited to 'src/core/loader/linker.h')
| -rw-r--r-- | src/core/loader/linker.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/core/loader/linker.h b/src/core/loader/linker.h new file mode 100644 index 000000000..d18155f0d --- /dev/null +++ b/src/core/loader/linker.h | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | // Copyright 2017 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <map> | ||
| 8 | #include <string> | ||
| 9 | #include "common/common_types.h" | ||
| 10 | |||
| 11 | namespace Loader { | ||
| 12 | |||
| 13 | class Linker { | ||
| 14 | protected: | ||
| 15 | struct Symbol { | ||
| 16 | Symbol(std::string&& name, u64 value) : name(std::move(name)), value(value) {} | ||
| 17 | std::string name; | ||
| 18 | u64 value; | ||
| 19 | }; | ||
| 20 | |||
| 21 | struct Import { | ||
| 22 | VAddr ea; | ||
| 23 | s64 addend; | ||
| 24 | }; | ||
| 25 | |||
| 26 | void WriteRelocations(std::vector<u8>& program_image, const std::vector<Symbol>& symbols, | ||
| 27 | u64 relocation_offset, u64 size, bool is_jump_relocation, | ||
| 28 | VAddr load_base); | ||
| 29 | void Relocate(std::vector<u8>& program_image, u32 dynamic_section_offset, VAddr load_base); | ||
| 30 | |||
| 31 | void ResolveImports(); | ||
| 32 | |||
| 33 | std::map<std::string, Import> imports; | ||
| 34 | std::map<std::string, VAddr> exports; | ||
| 35 | }; | ||
| 36 | |||
| 37 | } // namespace Loader | ||