SOURCES: crossavr-binutils-aa.patch (NEW), crossavr-binutils-atmeg...

glen glen at pld-linux.org
Mon Apr 9 21:15:18 CEST 2007


Author: glen                         Date: Mon Apr  9 19:15:18 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- from freebsd cvs
  http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/avr-binutils/files/

---- Files affected:
SOURCES:
   crossavr-binutils-aa.patch (NONE -> 1.1)  (NEW), crossavr-binutils-atmega256x.patch (NONE -> 1.1)  (NEW), crossavr-binutils-coff-avr.patch (NONE -> 1.1)  (NEW), crossavr-binutils-newdevices.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/crossavr-binutils-aa.patch
diff -u /dev/null SOURCES/crossavr-binutils-aa.patch:1.1
--- /dev/null	Mon Apr  9 21:15:18 2007
+++ SOURCES/crossavr-binutils-aa.patch	Mon Apr  9 21:15:13 2007
@@ -0,0 +1,48 @@
+--- libiberty/Makefile.in.orig	Fri Apr  7 02:01:25 2006
++++ libiberty/Makefile.in	Mon Sep 25 21:54:25 2006
+@@ -330,7 +330,8 @@
+ @MAINT@	echo stamp > stamp-functions
+ 
+ INSTALL_DEST = @INSTALL_DEST@
+-install: install_to_$(INSTALL_DEST) install-subdir
++#install: install_to_$(INSTALL_DEST) install-subdir
++install:
+ 
+ install_to_libdir: all
+ 	${mkinstalldirs} $(DESTDIR)$(libdir)$(MULTISUBDIR)
+--- bfd/Makefile.in.orig	Fri Jun 23 20:17:19 2006
++++ bfd/Makefile.in	Mon Sep 25 21:54:49 2006
+@@ -1158,7 +1158,8 @@
+ 	for dir in "$(DESTDIR)$(bfdlibdir)"; do \
+ 	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ 	done
+-install: install-recursive
++#install: install-recursive
++install:
+ install-exec: install-exec-recursive
+ install-data: install-data-recursive
+ uninstall: uninstall-recursive
+--- opcodes/Makefile.in.orig	Thu Apr  6 23:49:35 2006
++++ opcodes/Makefile.in	Mon Sep 25 21:55:23 2006
+@@ -837,7 +837,8 @@
+ 	for dir in "$(DESTDIR)$(bfdlibdir)"; do \
+ 	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ 	done
+-install: install-recursive
++#install: install-recursive
++install:
+ install-exec: install-exec-recursive
+ install-data: install-data-recursive
+ uninstall: uninstall-recursive
+--- etc/Makefile.in.orig	Thu Apr  6 23:49:30 2006
++++ etc/Makefile.in	Mon Sep 25 21:55:51 2006
+@@ -59,7 +59,8 @@
+ HTMLFILES = standards.html configure.html
+ 
+ all: info
+-install: install-info
++#install: install-info
++install:
+ 
+ uninstall:
+ 

================================================================
Index: SOURCES/crossavr-binutils-atmega256x.patch
diff -u /dev/null SOURCES/crossavr-binutils-atmega256x.patch:1.1
--- /dev/null	Mon Apr  9 21:15:18 2007
+++ SOURCES/crossavr-binutils-atmega256x.patch	Mon Apr  9 21:15:13 2007
@@ -0,0 +1,2323 @@
+diff -Nur bfd/archures.c bfd/archures.c
+--- bfd/archures.c	2006-03-06 14:42:03.000000000 +0100
++++ bfd/archures.c	2006-08-28 20:01:10.714097550 +0200
+@@ -334,6 +334,7 @@
+ .#define bfd_mach_avr3		3
+ .#define bfd_mach_avr4		4
+ .#define bfd_mach_avr5		5
++.#define bfd_mach_avr6		6
+ .  bfd_arch_bfin,        {* ADI Blackfin *}
+ .#define bfd_mach_bfin          1
+ .  bfd_arch_cr16c,       {* National Semiconductor CompactRISC. *}
+diff -Nur bfd/bfd-in2.h bfd/bfd-in2.h
+--- bfd/bfd-in2.h	2006-03-26 01:38:42.000000000 +0100
++++ bfd/bfd-in2.h	2006-08-28 20:01:10.743095447 +0200
+@@ -1931,6 +1931,7 @@
+ #define bfd_mach_avr3          3
+ #define bfd_mach_avr4          4
+ #define bfd_mach_avr5          5
++#define bfd_mach_avr6          6
+   bfd_arch_bfin,        /* ADI Blackfin */
+ #define bfd_mach_bfin          1
+   bfd_arch_cr16c,       /* National Semiconductor CompactRISC. */
+@@ -3539,10 +3540,22 @@
+ command address) into 8 bit immediate value of LDI insn.  */
+   BFD_RELOC_AVR_LO8_LDI_PM,
+ 
++/* This is a 16 bit reloc for the AVR that stores 8 bit value
++(command address) into 8 bit immediate value of LDI insn. If the address
++is beyond the 128k boundary, the linker inserts a jump stub for this reloc
++in the lower 128k.  */
++  BFD_RELOC_AVR_LO8_LDI_GS,
++
+ /* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
+ of command address) into 8 bit immediate value of LDI insn.  */
+   BFD_RELOC_AVR_HI8_LDI_PM,
+ 
++/* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
++of command address) into 8 bit immediate value of LDI insn.  If the address
++is beyond the 128k boundary, the linker inserts a jump stub for this reloc
++below 128k.  */
++  BFD_RELOC_AVR_HI8_LDI_GS,
++
+ /* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
+ of command address) into 8 bit immediate value of LDI insn.  */
+   BFD_RELOC_AVR_HH8_LDI_PM,
+diff -Nur bfd/cpu-avr.c bfd/cpu-avr.c
+--- bfd/cpu-avr.c	2006-03-03 16:54:23.000000000 +0100
++++ bfd/cpu-avr.c	2006-08-28 20:01:10.771093417 +0200
+@@ -82,7 +82,10 @@
+   N (16, bfd_mach_avr4, "avr:4", FALSE, & arch_info_struct[4]),
+ 
+   /* ATmega161, ATmega163, ATmega32, AT94K.  */
+-  N (22, bfd_mach_avr5, "avr:5", FALSE, NULL)
++  N (22, bfd_mach_avr5, "avr:5", FALSE, & arch_info_struct[5]),
++
++  /* ATmega256x.  */
++  N (22, bfd_mach_avr6, "avr:6", FALSE, NULL)
+ };
+ 
+ const bfd_arch_info_type bfd_avr_arch =
+diff -Nur bfd/elf32-avr.c bfd/elf32-avr.c
+--- bfd/elf32-avr.c	2006-03-03 16:54:23.000000000 +0100
++++ bfd/elf32-avr.c	2006-08-28 20:18:20.796399347 +0200
+@@ -25,6 +25,92 @@
+ #include "libbfd.h"
+ #include "elf-bfd.h"
+ #include "elf/avr.h"
++#include "elf32-avr.h"
++
++/* Enable debugging printout at stdout with this variable.  */
++static bfd_boolean debug_relax = FALSE;
++
++/* Enable debugging printout at stdout with this variable.  */
++static bfd_boolean debug_stubs = FALSE;
++
++/* Hash table initialization and handling.  Code is taken from the hppa port
++   and adapted to the needs of AVR.  */
++
++/* We use two hash tables to hold information for linking avr objects.
++
++   The first is the elf32_avr_link_hash_tablse which is derived from the
++   stanard ELF linker hash table.  We use this as a place to attach the other
++   hash table and some static information.
++
++   The second is the stub hash table which is derived from the base BFD
++   hash table.  The stub hash table holds the information on the linker
++   stubs.  */
++
++struct elf32_avr_stub_hash_entry
++{
++  /* Base hash table entry structure.  */
++  struct bfd_hash_entry bh_root;
++
++  /* Offset within stub_sec of the beginning of this stub.  */
++  bfd_vma stub_offset;
++
++  /* Given the symbol's value and its section we can determine its final
++     value when building the stubs (so the stub knows where to jump).  */
++  bfd_vma target_value;
++
++  /* This way we could mark stubs to be no longer necessary.  */
++  bfd_boolean is_actually_needed;
++};
++
++struct elf32_avr_link_hash_table
++{
++  /* The main hash table.  */
++  struct elf_link_hash_table etab;
++
++  /* The stub hash table.  */
++  struct bfd_hash_table bstab;
++
++  bfd_boolean no_stubs;
++
++  /* Linker stub bfd.  */
++  bfd *stub_bfd;
++
++  /* The stub section.  */
++  asection *stub_sec;
++
++  /* Usually 0, unless we are generating code for a bootloader.  Will
++     be initialized by elf32_avr_size_stubs to the vma offset of the
++     output section associated with the stub section.  */
++  bfd_vma vector_base;
++
++  /* Assorted information used by elf32_avr_size_stubs.  */
++  unsigned int        bfd_count;
++  int                 top_index;
++  asection **         input_list;
++  Elf_Internal_Sym ** all_local_syms;
++
++  /* Tables for mapping vma beyond the 128k boundary to the address of the
++     corresponding stub.  (AMT)
++     "amt_max_entry_cnt" reflects the number of entries that memory is allocated
++     for in the "amt_stub_offsets" and "amt_destination_addr" arrays.
++     "amt_entry_cnt" informs how many of these entries actually contain
++     useful data.  */
++  unsigned int amt_entry_cnt;
++  unsigned int amt_max_entry_cnt;
++  bfd_vma *    amt_stub_offsets;
++  bfd_vma *    amt_destination_addr;
++};
++
++/* Various hash macros and functions.  */
++#define avr_link_hash_table(p) \
++  ((struct elf32_avr_link_hash_table *) ((p)->hash))
++
++#define avr_stub_hash_entry(ent) \
++  ((struct elf32_avr_stub_hash_entry *)(ent))
++
++#define avr_stub_hash_lookup(table, string, create, copy) \
++  ((struct elf32_avr_stub_hash_entry *) \
++   bfd_hash_lookup ((table), (string), (create), (copy)))
+ 
+ static reloc_howto_type elf_avr_howto_table[] =
+ {
+@@ -101,7 +187,8 @@
+ 	 0xffff,		/* dst_mask */
+ 	 FALSE),		/* pcrel_offset */
+ 
+-  /* A 16 bit absolute relocation for command address.  */
++  /* A 16 bit absolute relocation for command address
++     Will be changed when linker stubs are needed.  */
+   HOWTO (R_AVR_16_PM,		/* type */
+ 	 1,			/* rightshift */
+ 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+@@ -207,7 +294,7 @@
+ 	 0xffff,		/* dst_mask */
+ 	 FALSE),		/* pcrel_offset */
+   /* A low 8 bit absolute relocation of 24 bit program memory address.
+-     For LDI command.  */
++     For LDI command.  Will not be changed when linker stubs are needed. */
+   HOWTO (R_AVR_LO8_LDI_PM,	/* type */
+ 	 1,			/* rightshift */
+ 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+@@ -221,8 +308,8 @@
+ 	 0xffff,		/* src_mask */
+ 	 0xffff,		/* dst_mask */
+ 	 FALSE),		/* pcrel_offset */
+-  /* A high 8 bit absolute relocation of 16 bit program memory address.
+-     For LDI command.  */
++  /* A low 8 bit absolute relocation of 24 bit program memory address.
++     For LDI command.  Will not be changed when linker stubs are needed. */
+   HOWTO (R_AVR_HI8_LDI_PM,	/* type */
+ 	 9,			/* rightshift */
+ 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+@@ -236,8 +323,8 @@
+ 	 0xffff,		/* src_mask */
+ 	 0xffff,		/* dst_mask */
+ 	 FALSE),		/* pcrel_offset */
+-  /* A high 8 bit absolute relocation of 24 bit program memory address.
+-     For LDI command.  */
++  /* A low 8 bit absolute relocation of 24 bit program memory address.
++     For LDI command.  Will not be changed when linker stubs are needed. */
+   HOWTO (R_AVR_HH8_LDI_PM,	/* type */
+ 	 17,			/* rightshift */
+ 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+@@ -251,8 +338,8 @@
+ 	 0xffff,		/* src_mask */
+ 	 0xffff,		/* dst_mask */
+ 	 FALSE),		/* pcrel_offset */
+-  /* A low 8 bit absolute relocation of a negative 24 bit
+-     program memory address.  For LDI command.  */
++  /* A low 8 bit absolute relocation of 24 bit program memory address.
++     For LDI command.  Will not be changed when linker stubs are needed. */
+   HOWTO (R_AVR_LO8_LDI_PM_NEG,	/* type */
+ 	 1,			/* rightshift */
+ 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+@@ -266,8 +353,8 @@
+ 	 0xffff,		/* src_mask */
+ 	 0xffff,		/* dst_mask */
+ 	 FALSE),		/* pcrel_offset */
+-  /* A high 8 bit absolute relocation of a negative 16 bit
+-     program memory address.  For LDI command.  */
++  /* A low 8 bit absolute relocation of 24 bit program memory address.
++     For LDI command.  Will not be changed when linker stubs are needed. */
+   HOWTO (R_AVR_HI8_LDI_PM_NEG,	/* type */
+ 	 9,			/* rightshift */
+ 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+@@ -281,8 +368,8 @@
+ 	 0xffff,		/* src_mask */
+ 	 0xffff,		/* dst_mask */
+ 	 FALSE),		/* pcrel_offset */
+-  /* A high 8 bit absolute relocation of a negative 24 bit
+-     program memory address.  For LDI command.  */
++  /* A low 8 bit absolute relocation of 24 bit program memory address.
++     For LDI command.  Will not be changed when linker stubs are needed. */
+   HOWTO (R_AVR_HH8_LDI_PM_NEG,	/* type */
+ 	 17,			/* rightshift */
+ 	 1,			/* size (0 = byte, 1 = short, 2 = long) */
+@@ -382,7 +469,37 @@
+ 	 FALSE,			/* partial_inplace */
+ 	 0xffff,		/* src_mask */
+ 	 0xffff,		/* dst_mask */
+-	 FALSE) 		/* pcrel_offset */
++	 FALSE), 		/* pcrel_offset */
++  /* A low 8 bit absolute relocation of 24 bit program memory address.
++     For LDI command.  Will be changed when linker stubs are needed. */
++  HOWTO (R_AVR_LO8_LDI_GS,      /* type */
++         1,                     /* rightshift */
++         1,                     /* size (0 = byte, 1 = short, 2 = long) */
++         8,                     /* bitsize */
++         FALSE,                 /* pc_relative */
++         0,                     /* bitpos */
++         complain_overflow_dont, /* complain_on_overflow */
++         bfd_elf_generic_reloc, /* special_function */
++         "R_AVR_LO8_LDI_GS",    /* name */
++         FALSE,                 /* partial_inplace */
++         0xffff,                /* src_mask */
++         0xffff,                /* dst_mask */
++         FALSE),                /* pcrel_offset */
++  /* A low 8 bit absolute relocation of 24 bit program memory address.
++     For LDI command.  Will be changed when linker stubs are needed. */
++  HOWTO (R_AVR_HI8_LDI_GS,      /* type */
++         9,                     /* rightshift */
++         1,                     /* size (0 = byte, 1 = short, 2 = long) */
++         8,                     /* bitsize */
++         FALSE,                 /* pc_relative */
++         0,                     /* bitpos */
++         complain_overflow_dont, /* complain_on_overflow */
++         bfd_elf_generic_reloc, /* special_function */
++         "R_AVR_HI8_LDI_GS",    /* name */
++         FALSE,                 /* partial_inplace */
++         0xffff,                /* src_mask */
++         0xffff,                /* dst_mask */
++         FALSE)                 /* pcrel_offset */
+ };
+ 
+ /* Map BFD reloc types to AVR ELF reloc types.  */
+@@ -393,7 +510,7 @@
+   unsigned int elf_reloc_val;
+ };
+ 
+- static const struct avr_reloc_map avr_reloc_map[] =
++static const struct avr_reloc_map avr_reloc_map[] =
+ {
+   { BFD_RELOC_NONE,                 R_AVR_NONE },
+   { BFD_RELOC_32,                   R_AVR_32 },
+@@ -410,7 +527,9 @@
+   { BFD_RELOC_AVR_HH8_LDI_NEG,      R_AVR_HH8_LDI_NEG },
+   { BFD_RELOC_AVR_MS8_LDI_NEG,      R_AVR_MS8_LDI_NEG },
+   { BFD_RELOC_AVR_LO8_LDI_PM,       R_AVR_LO8_LDI_PM },
++  { BFD_RELOC_AVR_LO8_LDI_GS,       R_AVR_LO8_LDI_GS },
+   { BFD_RELOC_AVR_HI8_LDI_PM,       R_AVR_HI8_LDI_PM },
++  { BFD_RELOC_AVR_HI8_LDI_GS,       R_AVR_HI8_LDI_GS },
+   { BFD_RELOC_AVR_HH8_LDI_PM,       R_AVR_HH8_LDI_PM },
+   { BFD_RELOC_AVR_LO8_LDI_PM_NEG,   R_AVR_LO8_LDI_PM_NEG },
+   { BFD_RELOC_AVR_HI8_LDI_PM_NEG,   R_AVR_HI8_LDI_PM_NEG },
+@@ -429,8 +548,101 @@
+    that we will never suggest a wrap-around jump during relaxation.
+    The logic of the source code later on assumes that in
+    avr_pc_wrap_around one single bit is set.  */
++static bfd_vma avr_pc_wrap_around = 0x10000000;
++
++/* If this variable holds a value different from zero, the linker relaxation
++   machine will try to optimize call/ret sequences by a single jump
++   instruction. This option could be switched off by a linker switch.  */
++static int avr_replace_call_ret_sequences = 1;
++
++/* Initialize an entry in the stub hash table.  */
++
++static struct bfd_hash_entry *
++stub_hash_newfunc (struct bfd_hash_entry *entry,
++                   struct bfd_hash_table *table,
++                   const char *string)
++{
++  /* Allocate the structure if it has not already been allocated by a
++     subclass.  */
++  if (entry == NULL)
++    {
++      entry = bfd_hash_allocate (table,
++                                 sizeof (struct elf32_avr_stub_hash_entry));
++      if (entry == NULL)
++        return entry;
++    }
++
++  /* Call the allocation method of the superclass.  */
++  entry = bfd_hash_newfunc (entry, table, string);
++  if (entry != NULL)
++    {
++      struct elf32_avr_stub_hash_entry *hsh;
+ 
+-unsigned int avr_pc_wrap_around = 0x10000000;
++      /* Initialize the local fields.  */
++      hsh = avr_stub_hash_entry (entry);
++      hsh->stub_offset = 0;
++      hsh->target_value = 0;
++    }
++
++  return entry;
++}
++
++/* Create the derived linker hash table.  The AVR ELF port uses the derived
++   hash table to keep information specific to the AVR ELF linker (without
++   using static variables).  */
++
++static struct bfd_link_hash_table *
++elf32_avr_link_hash_table_create (bfd *abfd)
++{
++  struct elf32_avr_link_hash_table *htab;
++  bfd_size_type amt = sizeof (*htab);
++
++  htab = bfd_malloc (amt);
++  if (htab == NULL)
++    return NULL;
++
++  if (!_bfd_elf_link_hash_table_init (&htab->etab, abfd,
++                                      _bfd_elf_link_hash_newfunc,
++                                      sizeof (struct elf_link_hash_entry)))
++    {
++      free (htab);
++      return NULL;
++    }
++
++  /* Init the stub hash table too.  */
++  if (!bfd_hash_table_init (&htab->bstab, stub_hash_newfunc,
++                            sizeof (struct elf32_avr_stub_hash_entry)))
++    return NULL;
++
++  htab->stub_bfd = NULL;
++  htab->stub_sec = NULL;
++
++  /* Initialize the address mapping table.  */
++  htab->amt_stub_offsets = NULL;
++  htab->amt_destination_addr = NULL;
++  htab->amt_entry_cnt = 0;
++  htab->amt_max_entry_cnt = 0;
++
++  return &htab->etab.root;
++}
++
++/* Free the derived linker hash table.  */
++
++static void
++elf32_avr_link_hash_table_free (struct bfd_link_hash_table *btab)
++{
++  struct elf32_avr_link_hash_table *htab
++    = (struct elf32_avr_link_hash_table *) btab;
++
++  /* Free the address mapping table.  */
++  if (htab->amt_stub_offsets != NULL)
++    free (htab->amt_stub_offsets);
++  if (htab->amt_destination_addr != NULL)
++    free (htab->amt_destination_addr);
++
++  bfd_hash_table_free (&htab->bstab);
++  _bfd_generic_link_hash_table_free (btab);
++}
+ 
+ /* Calculates the effective distance of a pc relative jump/call.  */
+ static int
+@@ -564,20 +776,57 @@
+   return TRUE;
+ }
+ 
++static bfd_boolean
++avr_stub_is_required_for_16_bit_reloc (bfd_vma relocation)
++{
++  return (relocation >= 0x020000);
++}
++
++/* Returns the address of the corresponding stub if there is one.
++   Returns otherwise an address above 0x020000.  This function
++   could also be used, if there is no knowledge on the section where
++   the destination is found.  */
++
++static bfd_vma
++avr_get_stub_addr (bfd_vma srel,
++                   struct elf32_avr_link_hash_table *htab)
++{
++  unsigned int index;
++  bfd_vma stub_sec_addr =
++              (htab->stub_sec->output_section->vma +
++	       htab->stub_sec->output_offset);
++
++  for (index = 0; index < htab->amt_max_entry_cnt; index ++)
++    if (htab->amt_destination_addr[index] == srel)
++      return htab->amt_stub_offsets[index] + stub_sec_addr;
++
++  /* Return an address that could not be reached by 16 bit relocs.  */
++  return 0x020000;
++}
++
+ /* Perform a single relocation.  By default we use the standard BFD
+    routines, but a few relocs, we have to do them ourselves.  */
+ 
+ static bfd_reloc_status_type
+-avr_final_link_relocate (reloc_howto_type *  howto,
+-			 bfd *               input_bfd,
+-			 asection *          input_section,
+-			 bfd_byte *          contents,
+-			 Elf_Internal_Rela * rel,
+-			 bfd_vma             relocation)
++avr_final_link_relocate (reloc_howto_type *                 howto,
++			 bfd *                              input_bfd,
++			 asection *                         input_section,
++			 bfd_byte *                         contents,
++			 Elf_Internal_Rela *                rel,
++                         bfd_vma                            relocation,
++                         struct elf32_avr_link_hash_table * htab)
+ {
+   bfd_reloc_status_type r = bfd_reloc_ok;
+   bfd_vma               x;
+   bfd_signed_vma	srel;
++  bfd_signed_vma	reloc_addr;
++  bfd_boolean           use_stubs = FALSE;
++  /* Usually is 0, unless we are generating code for a bootloader.  */
++  bfd_signed_vma        base_addr = htab->vector_base;
++
++  /* Absolute addr of the reloc in the final excecutable.  */
++  reloc_addr = rel->r_offset + input_section->output_section->vma
++	       + input_section->output_offset;
+ 
+   switch (howto->type)
+     {
+@@ -748,9 +997,31 @@
+       bfd_put_16 (input_bfd, x, contents);
+       break;
+ 
++    case R_AVR_LO8_LDI_GS:
++      use_stubs = (!htab->no_stubs);
++      /* Fall through.  */
+     case R_AVR_LO8_LDI_PM:
+       contents += rel->r_offset;
+       srel = (bfd_signed_vma) relocation + rel->r_addend;
++
++      if (use_stubs
++          && avr_stub_is_required_for_16_bit_reloc (srel - base_addr))
++        {
++          bfd_vma old_srel = srel;
++
++          /* We need to use the address of the stub instead.  */
++          srel = avr_get_stub_addr (srel, htab);
++          if (debug_stubs)
++            printf ("LD: Using jump stub (at 0x%x) with destination 0x%x for "
++                    "reloc at address 0x%x.\n",
++                    (unsigned int) srel,
++                    (unsigned int) old_srel,
++                    (unsigned int) reloc_addr);
++
++	  if (avr_stub_is_required_for_16_bit_reloc (srel - base_addr))
++	    return bfd_reloc_outofrange;
++        }
++
+       if (srel & 1)
+ 	return bfd_reloc_outofrange;
+       srel = srel >> 1;
+@@ -759,9 +1030,31 @@
+       bfd_put_16 (input_bfd, x, contents);
+       break;
+ 
++    case R_AVR_HI8_LDI_GS:
++      use_stubs = (!htab->no_stubs);
++      /* Fall through.  */
+     case R_AVR_HI8_LDI_PM:
+       contents += rel->r_offset;
+       srel = (bfd_signed_vma) relocation + rel->r_addend;
++
++      if (use_stubs
++          && avr_stub_is_required_for_16_bit_reloc (srel - base_addr))
++        {
++          bfd_vma old_srel = srel;
++
++          /* We need to use the address of the stub instead.  */
++          srel = avr_get_stub_addr (srel, htab);
++          if (debug_stubs)
++            printf ("LD: Using jump stub (at 0x%x) with destination 0x%x for "
++                    "reloc at address 0x%x.\n",
++                    (unsigned int) srel,
++                    (unsigned int) old_srel,
++                    (unsigned int) reloc_addr);
++
++	  if (avr_stub_is_required_for_16_bit_reloc (srel - base_addr))
++	    return bfd_reloc_outofrange;
++        }
++
+       if (srel & 1)
+ 	return bfd_reloc_outofrange;
+       srel = srel >> 1;
+@@ -833,6 +1126,35 @@
+       bfd_put_16 (input_bfd, (bfd_vma) srel & 0xffff, contents+2);
+       break;
+ 
++    case R_AVR_16_PM:
++      use_stubs = (!htab->no_stubs);
++      contents += rel->r_offset;
++      srel = (bfd_signed_vma) relocation + rel->r_addend;
++
++      if (use_stubs
++          && avr_stub_is_required_for_16_bit_reloc (srel - base_addr))
++        {
++          bfd_vma old_srel = srel;
++
++          /* We need to use the address of the stub instead.  */
++          srel = avr_get_stub_addr (srel,htab);
++          if (debug_stubs)
++            printf ("LD: Using jump stub (at 0x%x) with destination 0x%x for "
<<Diff was trimmed, longer than 597 lines>>


More information about the pld-cvs-commit mailing list