mirror of
https://github.com/mirror/tinycc.git
synced 2025-04-01 12:30:08 +08:00
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 !
This commit is contained in:
parent
0f81512d7d
commit
bcac413c30
4
tccelf.c
4
tccelf.c
@ -613,14 +613,14 @@ ST_FUNC void relocate_section(TCCState *s1, Section *s)
|
|||||||
x += val - addr;
|
x += val - addr;
|
||||||
h = x & 2;
|
h = x & 2;
|
||||||
#ifndef TCC_TARGET_PE
|
#ifndef TCC_TARGET_PE
|
||||||
if ((x & 3) || x >= 0x4000000 || x < -0x4000000)
|
if ((x & 3) || x >= 0x2000000 || x < -0x2000000)
|
||||||
if (!(x & 3) || !blx_avail || !is_call)
|
if (!(x & 3) || !blx_avail || !is_call)
|
||||||
if (s1->output_type == TCC_OUTPUT_MEMORY) {
|
if (s1->output_type == TCC_OUTPUT_MEMORY) {
|
||||||
x += add_jmp_table(s1, val) - val; /* add veneer */
|
x += add_jmp_table(s1, val) - val; /* add veneer */
|
||||||
is_thumb = 0; /* Veneer uses ARM instructions */
|
is_thumb = 0; /* Veneer uses ARM instructions */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if ((x & 3) || x >= 0x4000000 || x < -0x4000000)
|
if ((x & 3) || x >= 0x2000000 || x < -0x2000000)
|
||||||
if (!(x & 3) || !blx_avail || !is_call)
|
if (!(x & 3) || !blx_avail || !is_call)
|
||||||
tcc_error("can't relocate value at %x",addr);
|
tcc_error("can't relocate value at %x",addr);
|
||||||
x >>= 2;
|
x >>= 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user