avr-libc-dev
[Top][All Lists]
Advanced

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

Fw: [avr-libc-dev] Fwd: [PATCH gnu binutils] add linker relaxationsuppor


From: Anatoly Sokolov
Subject: Fw: [avr-libc-dev] Fwd: [PATCH gnu binutils] add linker relaxationsupport for avr
Date: Wed, 21 Jun 2006 21:32:01 +0400

----- Original Message ----- 
From: "Björn Haase" <address@hidden>
To: "Anatoly Sokolov" <address@hidden>
Sent: Thursday, March 09, 2006 2:53 PM
Subject: Re: [avr-libc-dev] Fwd: [PATCH gnu binutils] add linker 
relaxationsupport for avr


You wrote Donnerstag, 9. März 2006 17:25 :
> Hi.
>
> I have build the gcc toolchain: binutils from CVS 8-Mar-2006; gcc-4.0.2;
> avr-libc-1.4.3. At attempt to load the compiled project in AVRStudio there
> is a error:
> Error loading object file J:\avr\test\demo.elf
>
> With the binutils-2.16.1 all works correctly.
>
> I assume that it has occured as a result of 'relax' patch.
>
> Anatoly.

Possibly avrstudio has problems with evaluating the elf header information. 
There is now a new bit in addition to the family specification (e.g. avr5) 
that tags object files that could be used for the relaxation machine. Maybe 
avrstudio presently considers the elf-files to be an unknown architecture due 
to this additional byte.?

One possibly could forward this information and the elf file itself to 
Thorleif Sandnes who is (IIRC) the responsible at Atmel for avrstudio. Eric 
could you do that? I don't have Thorleif's mail address at hand right now.

Yours,

Bjoern.

P.S.: 
What follows are two changes in binutils/src/include/elf/avr.h and 
binutils/src/bfd/elf32-avr.c

If everything works again if you comment out the line in the the latter file 
that reads
  elf_elfheader (abfd)->e_flags |= EF_AVR_LINKRELAX_PREPARED;
Avrstudio simply needs to be told to ignore bit #7 of the architecture 
descriptor.

... elf/avr.h:
...
/* If bit #7 is set, it is assumed that the elf file uses local symbols
   as reference for the relocations so that linker relaxation is possible.  */
#define EF_AVR_LINKRELAX_PREPARED 0x80
...

and bfd/elf32-avr.c
...
static void
bfd_elf_avr_final_write_processing (abfd, linker)
     bfd *abfd;
     bfd_boolean linker ATTRIBUTE_UNUSED;
{
  unsigned long val;

  switch (bfd_get_mach (abfd))
    {
    default:
    case bfd_mach_avr2:
      val = E_AVR_MACH_AVR2;
      break;

    case bfd_mach_avr1:
      val = E_AVR_MACH_AVR1;
      break;

    case bfd_mach_avr3:
      val = E_AVR_MACH_AVR3;
      break;

    case bfd_mach_avr4:
      val = E_AVR_MACH_AVR4;
      break;

    case bfd_mach_avr5:
      val = E_AVR_MACH_AVR5;
      break;
    }

  elf_elfheader (abfd)->e_machine = EM_AVR;
  elf_elfheader (abfd)->e_flags &= ~ EF_AVR_MACH;
  elf_elfheader (abfd)->e_flags |= val;
  elf_elfheader (abfd)->e_flags |= EF_AVR_LINKRELAX_PREPARED; 
}
...

reply via email to

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