Skip to content

Commit fa86d85

Browse files
committed
fix R_ARM_ABS8 reloc handler being misassigned
1 parent 26ddd77 commit fa86d85

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

core/arm_relocator.cpp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
#include "arm_relocator.h"
2-
#include "util/hex_write.h"
32

43
#include <algorithm>
54

5+
#include "util/hex_write.h"
6+
7+
#include "elfcpp/elfcpp.h"
8+
#include "elfcpp/arm.h"
9+
610
namespace lyn {
711

812
struct arm_data_abs32_reloc : public arm_relocator::relocatelet {
@@ -180,15 +184,15 @@ struct arm_arm_bl_reloc : public arm_arm_b_reloc {
180184
};
181185

182186
arm_relocator::arm_relocator() {
183-
mRelocatelets[0x02].reset(new arm_data_abs32_reloc); // R_ARM_ABS32
184-
mRelocatelets[0x03].reset(new arm_data_rel32_reloc); // R_ARM_REL32
185-
mRelocatelets[0x05].reset(new arm_data_abs16_reloc); // R_ARM_ABS16
186-
mRelocatelets[0x06].reset(new arm_data_abs8_reloc); // R_ARM_ABS8
187-
mRelocatelets[0x0A].reset(new arm_thumb_bl_reloc); // R_ARM_THM_CALL
188-
mRelocatelets[0x1C].reset(new arm_arm_bl_reloc); // R_ARM_CALL
189-
mRelocatelets[0x1D].reset(new arm_arm_b_reloc); // R_ARM_JUMP24
190-
mRelocatelets[0x66].reset(new arm_thumb_b_reloc); // R_ARM_THM_JUMP11
191-
mRelocatelets[0x67].reset(new arm_thumb_bcond_reloc); // R_ARM_THM_JUMP8
187+
mRelocatelets[elfcpp::R_ARM_ABS32].reset(new arm_data_abs32_reloc); // R_ARM_ABS32
188+
mRelocatelets[elfcpp::R_ARM_REL32].reset(new arm_data_rel32_reloc); // R_ARM_REL32
189+
mRelocatelets[elfcpp::R_ARM_ABS16].reset(new arm_data_abs16_reloc); // R_ARM_ABS16
190+
mRelocatelets[elfcpp::R_ARM_ABS8].reset(new arm_data_abs8_reloc); // R_ARM_ABS8
191+
mRelocatelets[elfcpp::R_ARM_THM_CALL].reset(new arm_thumb_bl_reloc); // R_ARM_THM_CALL
192+
mRelocatelets[elfcpp::R_ARM_CALL].reset(new arm_arm_bl_reloc); // R_ARM_CALL
193+
mRelocatelets[elfcpp::R_ARM_JUMP24].reset(new arm_arm_b_reloc); // R_ARM_JUMP24
194+
mRelocatelets[elfcpp::R_ARM_THM_JUMP11].reset(new arm_thumb_b_reloc); // R_ARM_THM_JUMP11
195+
mRelocatelets[elfcpp::R_ARM_THM_JUMP8].reset(new arm_thumb_bcond_reloc); // R_ARM_THM_JUMP8
192196
}
193197

194198
const arm_relocator::relocatelet* arm_relocator::get_relocatelet(int relocationIndex) const {

0 commit comments

Comments
 (0)