avr-gcc-list
[Top][All Lists]
Advanced

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

[avr-gcc-list] Relocation types in AVR GAS


From: Boyapati, Anitha
Subject: [avr-gcc-list] Relocation types in AVR GAS
Date: Tue, 22 Mar 2011 20:16:36 +0800

Hi,

[Ideally this is the binutils part of it. But I am continuing anyway hoping to 
get some immediate help in AVR target.]

I am trying to understand relocation types in AVR. To start with, can someone 
illustrate how R_AVR_16 works in the following case?

long i;

int main()
{
        return i++;

}

The corresponding HOWTO macro in bfd/elf32-avr.c is defined as:

/* A 16 bit absolute relocation.  */
  HOWTO (R_AVR_16,              /* type */
         0,                     /* rightshift */
         1,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
         FALSE,                 /* pc_relative */
         0,                     /* bitpos */
         complain_overflow_dont, /* complain_on_overflow */
         bfd_elf_generic_reloc, /* special_function */
         "R_AVR_16",            /* name */
         FALSE,                 /* partial_inplace */
         0xffff,                /* src_mask */
         0xffff,                /* dst_mask */
         FALSE),                /* pcrel_offset */

As I see it, since the address is 16-bit, 'size' is 1. How do we arrive at 
'rightshift' and 'bitsize' entries? And how assembler knows to emit R_AVR_16 
type? I would really appreciate any explanation on this...


As additional information -

When I just compile (no linking done) and dump the relocation entries, 
following output shows up:

RELOCATION RECORDS FOR [.text]:
OFFSET   TYPE              VALUE 
0000000a R_AVR_16          i
0000000e R_AVR_16          i+0x00000001
00000012 R_AVR_16          i+0x00000002
00000016 R_AVR_16          i+0x00000003
00000022 R_AVR_16          i
00000026 R_AVR_16          i+0x00000001
0000002a R_AVR_16          i+0x00000002
0000002e R_AVR_16          i+0x00000003

(I understand that relocations are applied at given offsets)

Thanks
Anitha



reply via email to

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