File: elf64_mips_reloc.h

package info (click to toggle)
gcl 2.6.7%2Bdfsga-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 84,796 kB
  • sloc: ansic: 452,686; lisp: 156,133; asm: 111,405; sh: 29,299; cpp: 18,599; perl: 5,602; makefile: 5,201; tcl: 3,181; sed: 469; yacc: 378; lex: 174; fortran: 48; awk: 30; csh: 23
file content (47 lines) | stat: -rw-r--r-- 1,358 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
    case R_MIPS_JALR:
      break;
    case R_MIPS_64:
      add_val(where,~0L,s+a);
      break;
    case R_MIPS_GPREL32:
      add_val(where,MASK(32),s+a-(ul)got);
      break;
    case R_MIPS_32:
      add_val(where,MASK(32),s+a);
      break;
    case R_MIPS_GOT_DISP:
    case R_MIPS_CALL16:
    case R_MIPS_GOT_PAGE:
      gote=got+(a>>32)-1;
      a&=MASK(32);
      store_val(where,MASK(16),((void *)gote-(void *)got));
      if (s>=ggot && s<ggote) {
        massert(!write_stub(s,got,gote));
      } else
        *gote=s+(a&~MASK(16))+((a&0x8000)<<1);
      break;
    case R_MIPS_GOT_OFST:
      store_val(where,MASK(16),a);
      break;
    case R_MIPS_HI16:
      s+=a&MASK(32);
      if (ELF_R_FTYPE(r->r_info)==R_MIPS_GPREL16) s=(ul)got-s;
      if (!hr) hr=(void *)r;
      if (a&(1L<<32)) add_vals(where,MASK(16),(s+(a>>32))>>16);
      break;
    case R_MIPS_LO16:
      s+=a;
      if (ELF_R_FTYPE(r->r_info)==R_MIPS_GPREL16) s=(ul)got-s;
      a=*where&MASK(16);
      if (a&0x8000) a|=0xffffffffffff0000; 
      a+=s&MASK(16);
      a+=(a&0x8000)<<1; 
      store_val(where,MASK(16),a);
      a&=~MASK(16);
      {
        Rela *ra=(void *)r;				
        for (hr=hr ? hr : (void *)ra;--ra>=hr && ELF_R_TYPE(ra->r_info)==R_MIPS_HI16;)
	  relocate(sym1,ra,ra->r_addend|(1L<<32)|(a<<32),start,got,gote);
      }
      hr=NULL;
      break;