History

Fix overflow detection in ARM relocation

Fix overflow detection for R_ARM_CALL, R_ARM_PC24, R_ARM_JUMP24 and R_ARM_PLT32 relocations on ARM. 26 bits means 25 bits for positive and negative offsets !

Thomas Preud'homme committed 13 years ago

Commit bcac4131 parent 0f815121 file · +2 −2Browse files

Unified · Split

tccelf.c+2−2
@@ -613,14 +613,14 @@ ST_FUNC void relocate_section(TCCState *s1, Section *s) · 612 unmodified lines
613613 x += val - addr;
614614 h = x & 2;
615615 #ifndef TCC_TARGET_PE
616− if ((x & 3) || x >= 0x4000000 || x < -0x4000000)
616+ if ((x & 3) || x >= 0x2000000 || x < -0x2000000)
617617 if (!(x & 3) || !blx_avail || !is_call)
618618 if (s1->output_type == TCC_OUTPUT_MEMORY) {
619619 x += add_jmp_table(s1, val) - val; /* add veneer */
620620 is_thumb = 0; /* Veneer uses ARM instructions */
621621 }
622622 #endif
623− if ((x & 3) || x >= 0x4000000 || x < -0x4000000)
623+ if ((x & 3) || x >= 0x2000000 || x < -0x2000000)
624624 if (!(x & 3) || !blx_avail || !is_call)
625625 tcc_error("can't relocate value at %x",addr);
626626 x >>= 2;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t