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
613 x += val - addr;613 x += val - addr;
614 h = x & 2;614 h = x & 2;
615#ifndef TCC_TARGET_PE615#ifndef TCC_TARGET_PE
616 if ((x & 3) || x >= 0x4000000 || x < -0x4000000)616 if ((x & 3) || x >= 0x2000000 || x < -0x2000000)
617 if (!(x & 3) || !blx_avail || !is_call)617 if (!(x & 3) || !blx_avail || !is_call)
618 if (s1->output_type == TCC_OUTPUT_MEMORY) {618 if (s1->output_type == TCC_OUTPUT_MEMORY) {
619 x += add_jmp_table(s1, val) - val; /* add veneer */619 x += add_jmp_table(s1, val) - val; /* add veneer */
620 is_thumb = 0; /* Veneer uses ARM instructions */620 is_thumb = 0; /* Veneer uses ARM instructions */
621 }621 }
622#endif622#endif
623 if ((x & 3) || x >= 0x4000000 || x < -0x4000000)623 if ((x & 3) || x >= 0x2000000 || x < -0x2000000)
624 if (!(x & 3) || !blx_avail || !is_call)624 if (!(x & 3) || !blx_avail || !is_call)
625 tcc_error("can't relocate value at %x",addr);625 tcc_error("can't relocate value at %x",addr);
626 x >>= 2;626 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