Merge pull request #783 from lioncash/linker

linker: Remove unused parameter from WriteRelocations()
This commit is contained in:
bunnei 2018-07-23 19:07:22 -07:00 committed by GitHub
commit 1ce5e04be8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 7 deletions

View File

@ -49,8 +49,7 @@ struct Elf64_Sym {
static_assert(sizeof(Elf64_Sym) == 0x18, "Elf64_Sym has incorrect size."); static_assert(sizeof(Elf64_Sym) == 0x18, "Elf64_Sym has incorrect size.");
void Linker::WriteRelocations(std::vector<u8>& program_image, const std::vector<Symbol>& symbols, void Linker::WriteRelocations(std::vector<u8>& program_image, const std::vector<Symbol>& symbols,
u64 relocation_offset, u64 size, bool is_jump_relocation, u64 relocation_offset, u64 size, VAddr load_base) {
VAddr load_base) {
for (u64 i = 0; i < size; i += sizeof(Elf64_Rela)) { for (u64 i = 0; i < size; i += sizeof(Elf64_Rela)) {
Elf64_Rela rela; Elf64_Rela rela;
std::memcpy(&rela, &program_image[relocation_offset + i], sizeof(Elf64_Rela)); 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
} }
if (dynamic.find(DT_RELA) != dynamic.end()) { if (dynamic.find(DT_RELA) != dynamic.end()) {
WriteRelocations(program_image, symbols, dynamic[DT_RELA], dynamic[DT_RELASZ], false, WriteRelocations(program_image, symbols, dynamic[DT_RELA], dynamic[DT_RELASZ], load_base);
load_base);
} }
if (dynamic.find(DT_JMPREL) != dynamic.end()) { if (dynamic.find(DT_JMPREL) != dynamic.end()) {
WriteRelocations(program_image, symbols, dynamic[DT_JMPREL], dynamic[DT_PLTRELSZ], true, WriteRelocations(program_image, symbols, dynamic[DT_JMPREL], dynamic[DT_PLTRELSZ],
load_base); load_base);
} }
} }

View File

@ -24,8 +24,7 @@ protected:
}; };
void WriteRelocations(std::vector<u8>& program_image, const std::vector<Symbol>& symbols, void WriteRelocations(std::vector<u8>& program_image, const std::vector<Symbol>& symbols,
u64 relocation_offset, u64 size, bool is_jump_relocation, u64 relocation_offset, u64 size, VAddr load_base);
VAddr load_base);
void Relocate(std::vector<u8>& program_image, u32 dynamic_section_offset, VAddr load_base); void Relocate(std::vector<u8>& program_image, u32 dynamic_section_offset, VAddr load_base);
void ResolveImports(); void ResolveImports();