summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraerosoul94 <aerosoul94@hotmail.com>2017-05-02 08:52:22 -0500
committeraerosoul94 <aerosoul94@hotmail.com>2017-05-02 08:52:22 -0500
commit6380b272bd2b67862d855384d4478325c75444ae (patch)
tree70e34f8e0f3a511db4e45f1242d81fb28ffd99c7
parent592b0484b9c1e943093dd93b720428ebfaa116d2 (diff)
Bug fix in PS3 loader
-rw-r--r--src/ps3/cell_loader.cpp13
-rw-r--r--src/ps3/ps3.cpp2
-rw-r--r--src/vita/vita.cpp2
-rw-r--r--src/wiiu/wiiu.cpp2
4 files changed, 16 insertions, 3 deletions
diff --git a/src/ps3/cell_loader.cpp b/src/ps3/cell_loader.cpp
index f6be58a..0b64d94 100644
--- a/src/ps3/cell_loader.cpp
+++ b/src/ps3/cell_loader.cpp
@@ -248,6 +248,8 @@ void cell_loader::applySectionRelocations() {
// NOTE: the only SHT_RELA sections I see after 0.85
// are non-allocatable so no reason to consider those
if ( section.sh_type == SHT_RELA ) {
+ if ( !(sections[ section.sh_info ].sh_flags & SHF_ALLOC) )
+ continue;
auto nrela = section.sh_size / sizeof(Elf64_Rela);
auto relocations = reinterpret_cast<Elf64_Rela *>(section.data());
@@ -283,18 +285,23 @@ void cell_loader::applySectionRelocations() {
continue;
}
-
if ( symbols[ sym ].st_shndx > m_elf->getNumSections() ) {
if ( symbols[ sym ].st_shndx != SHN_ABS ) {
msg("Invalid symbol section index!\n");
continue;
}
}
+
+ uint32 symaddr;
+ if ( symbols[ sym ].st_shndx == SHN_ABS )
+ symaddr = symbols[ sym ].st_value;
+ else
+ symaddr = sections[ symbols[ sym ].st_shndx ].sh_addr;
uint32 addr = sections[ section.sh_info ].sh_addr +
rela.r_offset;
- uint32 saddr = sections[ symbols[ sym ].st_shndx ].sh_addr +
- symbols[ sym ].st_value + rela.r_addend;
+ uint32 saddr = symaddr + symbols[ sym ].st_value +
+ rela.r_addend;
applyRelocation(type, addr, saddr);
}
diff --git a/src/ps3/ps3.cpp b/src/ps3/ps3.cpp
index 53243cc..848e192 100644
--- a/src/ps3/ps3.cpp
+++ b/src/ps3/ps3.cpp
@@ -53,7 +53,9 @@ static void idaapi
cell_loader ldr(&elf, relocAddr, DATABASE_FILE); ldr.apply();
}
+#ifdef _WIN32
__declspec(dllexport)
+#endif
loader_t LDSC =
{
IDP_INTERFACE_VERSION,
diff --git a/src/vita/vita.cpp b/src/vita/vita.cpp
index 6c3a713..863f55c 100644
--- a/src/vita/vita.cpp
+++ b/src/vita/vita.cpp
@@ -41,7 +41,9 @@ static void idaapi
psp2_loader ldr(&elf, "vita.txt"); ldr.apply();
}
+#ifdef _WIN32
__declspec(dllexport)
+#endif
loader_t LDSC =
{
IDP_INTERFACE_VERSION,
diff --git a/src/wiiu/wiiu.cpp b/src/wiiu/wiiu.cpp
index 742be0c..caafc7f 100644
--- a/src/wiiu/wiiu.cpp
+++ b/src/wiiu/wiiu.cpp
@@ -36,7 +36,9 @@ static void idaapi
cafe_loader ldr(&elf); ldr.apply();
}
+#ifdef _WIN32
__declspec(dllexport)
+#endif
loader_t LDSC =
{
IDP_INTERFACE_VERSION,