* Add last two relocs.

This commit is contained in:
bg- 2007-05-11 15:40:16 +00:00
parent fd53ff57dd
commit 813b27d234

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)$Id: cle_avr.c,v 1.1 2007/04/26 13:38:22 bg- Exp $ * @(#)$Id: cle_avr.c,v 1.2 2007/05/11 15:40:16 bg- Exp $
*/ */
/* /*
@ -86,21 +86,21 @@ cle_write_reloc(unsigned char *pos,
ELF32_R_TYPE(rela->r_info)); ELF32_R_TYPE(rela->r_info));
return CLE_UNKNOWN_RELOC; return CLE_UNKNOWN_RELOC;
#if VERIFY_BEFORE_ENABLE
case R_AVR_7_PCREL: /* 2 */ case R_AVR_7_PCREL: /* 2 */
/* Reloc in bits 0x03f8 (0000 00kk kkkk k000). */ /* Reloc in bits 0x03f8 (0000 00kk kkkk k000). */
byte = (addr - rela->r_offset - 2)/2; byte = addr - rela->r_offset - 2;
byte = byte >> 1;
pos[0] = (pos[0] & 0x07) | (byte << 3); /* 0xf8 */ pos[0] = (pos[0] & 0x07) | (byte << 3); /* 0xf8 */
pos[1] = (pos[1] & 0xfc) | (byte >> 5); /* 0x03 */ pos[1] = (pos[1] & 0xfc) | (byte >> 5); /* 0x03 */
return CLE_OK; return CLE_OK;
case R_AVR_13_PCREL: /* 3 */ case R_AVR_13_PCREL: /* 3 */
/* Reloc in bits 0x0fff (0000 kkkk kkkk kkkk). */ /* Reloc in bits 0x0fff (0000 kkkk kkkk kkkk). */
addr = (addr - rela->r_offset - 2)/2; addr = addr - rela->r_offset - 2;
addr = addr >> 1;
pos[0] = addr; pos[0] = addr;
pos[1] = (pos[1] & 0xf0) | ((addr >> 8) & 0x0f); pos[1] = (pos[1] & 0xf0) | ((addr >> 8) & 0x0f);
return CLE_OK; return CLE_OK;
#endif
case R_AVR_CALL: /* 18 */ case R_AVR_CALL: /* 18 */
addr = addr >> 1; addr = addr >> 1;