[PATCH] Implementation of relocations: R_ARM_REL32, R_ARM_THM_JUMP11, R_ARM_PREL31 for ELF/ARM
Denis Protivensky
dprotivensky at accesssoftek.com
Thu Feb 12 05:54:43 PST 2015
REPOSITORY
rL LLVM
================
Comment at: lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.cpp:121
@@ -120,1 +120,3 @@
+static inline void applyThmReloc(uint8_t *location, uint16_t result,
+ uint16_t mask = 0xFFFF) {
----------------
Bigcheese wrote:
> applyThumbReloc
If the function fixes up 16-bit Thumb instructions only, this should be reflected in its name.
================
Comment at: lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.cpp:168
@@ +167,3 @@
+ const uint32_t mask = 0x7FFFFFFF;
+ result &= mask;
+ DEBUG_WITH_TYPE(
----------------
I'd propose not to modify the ```result``` variable after calculating address by the formula, so the logged value stays consistent with other handlers.
You can always introduce new variable with more readable name like ```rel31``` and store the masked address in it.
================
Comment at: lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.cpp:258
@@ +257,3 @@
+
+ result = ((result & 0x0FFE) >> 1) - 2; //we cut off first bit because it is always 1 according to p. 4.5.3
+
----------------
Subtracting 2 from the shifted address is wrong. This means that you subtract 4 bytes from the original address value. Why should you do that?
http://reviews.llvm.org/D7565
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list