clang-format

This commit is contained in:
MerryMage 2018-01-16 18:05:21 +00:00
parent 153205edbb
commit e35644c005
25 changed files with 54 additions and 63 deletions

View file

@ -48,9 +48,9 @@ struct Elf64_Sym {
};
static_assert(sizeof(Elf64_Sym) == 0x18, "Elf64_Sym has incorrect size.");
void Linker::WriteRelocations(std::vector<u8>& program_image,
const std::vector<Symbol>& symbols, u64 relocation_offset,
u64 size, bool is_jump_relocation, VAddr load_base) {
void Linker::WriteRelocations(std::vector<u8>& program_image, const std::vector<Symbol>& symbols,
u64 relocation_offset, u64 size, bool is_jump_relocation,
VAddr load_base) {
for (u64 i = 0; i < size; i += sizeof(Elf64_Rela)) {
Elf64_Rela rela;
std::memcpy(&rela, &program_image[relocation_offset + i], sizeof(Elf64_Rela));
@ -90,8 +90,7 @@ void Linker::WriteRelocations(std::vector<u8>& program_image,
}
}
void Linker::Relocate(std::vector<u8>& program_image, u32 dynamic_section_offset,
VAddr load_base) {
void Linker::Relocate(std::vector<u8>& program_image, u32 dynamic_section_offset, VAddr load_base) {
std::map<u64, u64> dynamic;
while (dynamic_section_offset < program_image.size()) {
Elf64_Dyn dyn;
@ -141,8 +140,7 @@ void Linker::ResolveImports() {
const auto& search = exports.find(import.first);
if (search != exports.end()) {
Memory::Write64(import.second.ea, search->second + import.second.addend);
}
else {
} else {
LOG_ERROR(Loader, "Unresolved import: %s", import.first.c_str());
}
}

View file

@ -157,7 +157,8 @@ ResultStatus AppLoader_NSO::Load(Kernel::SharedPtr<Kernel::Process>& process) {
// Load NSO modules
VAddr next_load_addr{Memory::PROCESS_IMAGE_VADDR};
for (const auto& module : {"rtld", "sdk", "subsdk0", "subsdk1", "subsdk2", "subsdk3", "subsdk4"}) {
for (const auto& module :
{"rtld", "sdk", "subsdk0", "subsdk1", "subsdk2", "subsdk3", "subsdk4"}) {
const std::string path = filepath.substr(0, filepath.find_last_of("/\\")) + "/" + module;
const VAddr load_addr = next_load_addr;
next_load_addr = LoadNso(path, load_addr);

View file

@ -18,8 +18,7 @@ namespace Loader {
class AppLoader_NSO final : public AppLoader, Linker {
public:
AppLoader_NSO(FileUtil::IOFile&& file, std::string filepath)
: AppLoader(std::move(file)), filepath(std::move(filepath)) {
}
: AppLoader(std::move(file)), filepath(std::move(filepath)) {}
/**
* Returns the type of the file