Unified · Split
| @@ -739,25 +739,28 @@ static void gadd_sp(int val) · 738 unmodified lines | ||
| 739 | 739 | static void gcall_or_jmp(int is_jmp) |
| 740 | 740 | { |
| 741 | 741 | int r; |
| 742 | + uint32_t x; | |
| 742 | 743 | if ((vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST) { |
| 743 | − uint32_t x; | |
| 744 | 744 | /* constant case */ |
| 745 | − x=encbranch(ind,ind+vtop->c.i,0); | |
| 746 | − if(x) { | |
| 747 | − if (vtop->r & VT_SYM) { | |
| 748 | − /* relocation case */ | |
| 749 | − greloc(cur_text_section, vtop->sym, ind, R_ARM_PC24); | |
| 750 | − } else | |
| 751 | − put_elf_reloc(symtab_section, cur_text_section, ind, R_ARM_PC24, 0); | |
| 752 | − o(x|(is_jmp?0xE0000000:0xE1000000)); | |
| 753 | − } else { | |
| 754 | − if(!is_jmp) | |
| 755 | − o(0xE28FE004); // add lr,pc,#4 | |
| 756 | − o(0xE51FF004); // ldr pc,[pc,#-4] | |
| 757 | − if (vtop->r & VT_SYM) | |
| 758 | − greloc(cur_text_section, vtop->sym, ind, R_ARM_ABS32); | |
| 759 | − o(vtop->c.i); | |
| 760 | − } | |
| 745 | + if(vtop->r & VT_SYM){ | |
| 746 | + x=encbranch(ind,ind+vtop->c.i,0); | |
| 747 | + if(x) { | |
| 748 | + /* relocation case */ | |
| 749 | + greloc(cur_text_section, vtop->sym, ind, R_ARM_PC24); | |
| 750 | + o(x|(is_jmp?0xE0000000:0xE1000000)); | |
| 751 | + } else { | |
| 752 | + if(!is_jmp) | |
| 753 | + o(0xE28FE004); // add lr,pc,#4 | |
| 754 | + o(0xE51FF004); // ldr pc,[pc,#-4] | |
| 755 | + greloc(cur_text_section, vtop->sym, ind, R_ARM_ABS32); | |
| 756 | + o(vtop->c.i); | |
| 757 | + } | |
| 758 | + }else{ | |
| 759 | + if(!is_jmp) | |
| 760 | + o(0xE28FE004); // add lr,pc,#4 | |
| 761 | + o(0xE51FF004); // ldr pc,[pc,#-4] | |
| 762 | + o(vtop->c.i); | |
| 763 | + } | |
| 761 | 764 | } else { |
| 762 | 765 | /* otherwise, indirect call */ |
| 763 | 766 | r = gv(RC_INT); |