History

fix arm-gen.c -> gcall_or_jmp to VT_CONST

general committed 7 years ago

Commit bf093491 parent 82abfd71 file · +20 −17Browse files

Unified · Split

arm-gen.c+20−17
@@ -739,25 +739,28 @@ static void gadd_sp(int val) · 738 unmodified lines
739739 static void gcall_or_jmp(int is_jmp)
740740 {
741741 int r;
742+ uint32_t x;
742743 if ((vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST) {
743− uint32_t x;
744744 /* 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+ }
761764 } else {
762765 /* otherwise, indirect call */
763766 r = gv(RC_INT);

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