diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/loader/linker.cpp | 8 | ||||
| -rw-r--r-- | src/core/loader/linker.h | 3 |
2 files changed, 4 insertions, 7 deletions
diff --git a/src/core/loader/linker.cpp b/src/core/loader/linker.cpp index 769516b6f..57ca8c3ee 100644 --- a/src/core/loader/linker.cpp +++ b/src/core/loader/linker.cpp | |||
| @@ -49,8 +49,7 @@ struct Elf64_Sym { | |||
| 49 | static_assert(sizeof(Elf64_Sym) == 0x18, "Elf64_Sym has incorrect size."); | 49 | static_assert(sizeof(Elf64_Sym) == 0x18, "Elf64_Sym has incorrect size."); |
| 50 | 50 | ||
| 51 | void Linker::WriteRelocations(std::vector<u8>& program_image, const std::vector<Symbol>& symbols, | 51 | void Linker::WriteRelocations(std::vector<u8>& program_image, const std::vector<Symbol>& symbols, |
| 52 | u64 relocation_offset, u64 size, bool is_jump_relocation, | 52 | u64 relocation_offset, u64 size, VAddr load_base) { |
| 53 | VAddr load_base) { | ||
| 54 | for (u64 i = 0; i < size; i += sizeof(Elf64_Rela)) { | 53 | for (u64 i = 0; i < size; i += sizeof(Elf64_Rela)) { |
| 55 | Elf64_Rela rela; | 54 | Elf64_Rela rela; |
| 56 | std::memcpy(&rela, &program_image[relocation_offset + i], sizeof(Elf64_Rela)); | 55 | std::memcpy(&rela, &program_image[relocation_offset + i], sizeof(Elf64_Rela)); |
| @@ -124,12 +123,11 @@ void Linker::Relocate(std::vector<u8>& program_image, u32 dynamic_section_offset | |||
| 124 | } | 123 | } |
| 125 | 124 | ||
| 126 | if (dynamic.find(DT_RELA) != dynamic.end()) { | 125 | if (dynamic.find(DT_RELA) != dynamic.end()) { |
| 127 | WriteRelocations(program_image, symbols, dynamic[DT_RELA], dynamic[DT_RELASZ], false, | 126 | WriteRelocations(program_image, symbols, dynamic[DT_RELA], dynamic[DT_RELASZ], load_base); |
| 128 | load_base); | ||
| 129 | } | 127 | } |
| 130 | 128 | ||
| 131 | if (dynamic.find(DT_JMPREL) != dynamic.end()) { | 129 | if (dynamic.find(DT_JMPREL) != dynamic.end()) { |
| 132 | WriteRelocations(program_image, symbols, dynamic[DT_JMPREL], dynamic[DT_PLTRELSZ], true, | 130 | WriteRelocations(program_image, symbols, dynamic[DT_JMPREL], dynamic[DT_PLTRELSZ], |
| 133 | load_base); | 131 | load_base); |
| 134 | } | 132 | } |
| 135 | } | 133 | } |
diff --git a/src/core/loader/linker.h b/src/core/loader/linker.h index c09d382c1..107625837 100644 --- a/src/core/loader/linker.h +++ b/src/core/loader/linker.h | |||
| @@ -24,8 +24,7 @@ protected: | |||
| 24 | }; | 24 | }; |
| 25 | 25 | ||
| 26 | void WriteRelocations(std::vector<u8>& program_image, const std::vector<Symbol>& symbols, | 26 | void WriteRelocations(std::vector<u8>& program_image, const std::vector<Symbol>& symbols, |
| 27 | u64 relocation_offset, u64 size, bool is_jump_relocation, | 27 | u64 relocation_offset, u64 size, VAddr load_base); |
| 28 | VAddr load_base); | ||
| 29 | void Relocate(std::vector<u8>& program_image, u32 dynamic_section_offset, VAddr load_base); | 28 | void Relocate(std::vector<u8>& program_image, u32 dynamic_section_offset, VAddr load_base); |
| 30 | 29 | ||
| 31 | void ResolveImports(); | 30 | void ResolveImports(); |