gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gcl-devel] ARM relocs


From: Camm Maguire
Subject: [Gcl-devel] ARM relocs
Date: Mon, 21 Jan 2013 10:05:20 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Greetings, and thank you again so much for the help with the virtual
machine.  This issue appears now to be fixed (tests almost finished),
but the patch in place is at present just a re-engineering of what gcc
appears to do.  I'll commit this once I can verify the in the arm docs
that it is right:

elf32_arm_reloc.h:
=============================================================================
#define R_ARM_THM_CALL        10
#define R_ARM_CALL 28
#define R_ARM_V4BX 40
#define R_ARM_THM_MOVW_ABS_NC 47
#define R_ARM_THM_MOVW_ABS    48
#define R_ARM_MOVW_ABS_NC 43
#define R_ARM_MOVT_ABS    44
    case R_ARM_THM_CALL: 
      s+=a; 
      if (ELF_ST_TYPE(sym->st_info)==STT_FUNC) s|=1; 
      s-=p+4; /*FIXME maybe drop 4 and add_val below*/
      s=((long)s>>1); 
      massert(!(abs(s)&0xffc00000));  
      store_val(where,MASK(11),s>>11); 
      store_val(where,MASK(11)<<16,(s&0x7ff)<<16); 
      break; 
    case R_ARM_THM_MOVW_ABS_NC:
      s+=a;
      if (ELF_ST_TYPE(sym->st_info)==STT_FUNC) s|=1;
      s&=0xffff;
      s=((s>>12)&0xf)|(((s>>11)&0x1)<<10)|((s&0xff)<<16)|(((s>>8)&0x7)<<28);
      add_vals(where,~0L,s);
      break;
    case R_ARM_THM_MOVW_ABS:
      s+=a;
      s>>=16;
      s=((s>>12)&0xf)|(((s>>11)&0x1)<<10)|((s&0xff)<<16)|(((s>>8)&0x7)<<28);
      add_vals(where,~0L,s);
      break;
    case R_ARM_MOVW_ABS_NC:
      s+=a;
      s&=0xffff;s=(s&0xfff)|((s>>12)<<16);
      add_vals(where,~0L,s);
      break;
    case R_ARM_MOVT_ABS:
      s+=a;
      s>>=16;s=(s&0xfff)|((s>>12)<<16);
      add_vals(where,~0L,s);
      break;
    case R_ARM_CALL:
      add_vals(where,MASK(24),((long)(s+a-p))>>2);
      break;
    case R_ARM_ABS32:
      add_val(where,~0L,s+a);
      break;
    case R_ARM_V4BX:
      add_val(where,~0L,s+a);
      break;
=============================================================================
-- 
Camm Maguire                                        address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah



reply via email to

[Prev in Thread] Current Thread [Next in Thread]