fix arm-gen.c -> gcall_or_jmp to VT_CONST
This commit is contained in:
parent
82abfd75f3
commit
bf09349f8e
1 changed files with 20 additions and 17 deletions
37
arm-gen.c
37
arm-gen.c
|
@ -739,25 +739,28 @@ static void gadd_sp(int val)
|
||||||
static void gcall_or_jmp(int is_jmp)
|
static void gcall_or_jmp(int is_jmp)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
uint32_t x;
|
||||||
if ((vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST) {
|
if ((vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST) {
|
||||||
uint32_t x;
|
|
||||||
/* constant case */
|
/* constant case */
|
||||||
x=encbranch(ind,ind+vtop->c.i,0);
|
if(vtop->r & VT_SYM){
|
||||||
if(x) {
|
x=encbranch(ind,ind+vtop->c.i,0);
|
||||||
if (vtop->r & VT_SYM) {
|
if(x) {
|
||||||
/* relocation case */
|
/* relocation case */
|
||||||
greloc(cur_text_section, vtop->sym, ind, R_ARM_PC24);
|
greloc(cur_text_section, vtop->sym, ind, R_ARM_PC24);
|
||||||
} else
|
o(x|(is_jmp?0xE0000000:0xE1000000));
|
||||||
put_elf_reloc(symtab_section, cur_text_section, ind, R_ARM_PC24, 0);
|
} else {
|
||||||
o(x|(is_jmp?0xE0000000:0xE1000000));
|
if(!is_jmp)
|
||||||
} else {
|
o(0xE28FE004); // add lr,pc,#4
|
||||||
if(!is_jmp)
|
o(0xE51FF004); // ldr pc,[pc,#-4]
|
||||||
o(0xE28FE004); // add lr,pc,#4
|
greloc(cur_text_section, vtop->sym, ind, R_ARM_ABS32);
|
||||||
o(0xE51FF004); // ldr pc,[pc,#-4]
|
o(vtop->c.i);
|
||||||
if (vtop->r & VT_SYM)
|
}
|
||||||
greloc(cur_text_section, vtop->sym, ind, R_ARM_ABS32);
|
}else{
|
||||||
o(vtop->c.i);
|
if(!is_jmp)
|
||||||
}
|
o(0xE28FE004); // add lr,pc,#4
|
||||||
|
o(0xE51FF004); // ldr pc,[pc,#-4]
|
||||||
|
o(vtop->c.i);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* otherwise, indirect call */
|
/* otherwise, indirect call */
|
||||||
r = gv(RC_INT);
|
r = gv(RC_INT);
|
||||||
|
|
Loading…
Reference in a new issue