[arch-commits] Commit in avr-binutils/repos (8 files)

Anatol Pomozov anatolik at archlinux.org
Sun Oct 30 18:02:08 UTC 2016


    Date: Sunday, October 30, 2016 @ 18:02:08
  Author: anatolik
Revision: 194038

archrelease: copy trunk to community-testing-i686, community-testing-x86_64

Added:
  avr-binutils/repos/community-testing-i686/
  avr-binutils/repos/community-testing-i686/PKGBUILD
    (from rev 194037, avr-binutils/trunk/PKGBUILD)
  avr-binutils/repos/community-testing-i686/avr-size.patch
    (from rev 194037, avr-binutils/trunk/avr-size.patch)
  avr-binutils/repos/community-testing-i686/fix_relaxation.patch
    (from rev 194037, avr-binutils/trunk/fix_relaxation.patch)
  avr-binutils/repos/community-testing-x86_64/
  avr-binutils/repos/community-testing-x86_64/PKGBUILD
    (from rev 194037, avr-binutils/trunk/PKGBUILD)
  avr-binutils/repos/community-testing-x86_64/avr-size.patch
    (from rev 194037, avr-binutils/trunk/avr-size.patch)
  avr-binutils/repos/community-testing-x86_64/fix_relaxation.patch
    (from rev 194037, avr-binutils/trunk/fix_relaxation.patch)

-----------------------------------------------+
 community-testing-i686/PKGBUILD               |   90 ++++
 community-testing-i686/avr-size.patch         |  523 ++++++++++++++++++++++++
 community-testing-i686/fix_relaxation.patch   |  256 +++++++++++
 community-testing-x86_64/PKGBUILD             |   90 ++++
 community-testing-x86_64/avr-size.patch       |  523 ++++++++++++++++++++++++
 community-testing-x86_64/fix_relaxation.patch |  256 +++++++++++
 6 files changed, 1738 insertions(+)

Copied: avr-binutils/repos/community-testing-i686/PKGBUILD (from rev 194037, avr-binutils/trunk/PKGBUILD)
===================================================================
--- community-testing-i686/PKGBUILD	                        (rev 0)
+++ community-testing-i686/PKGBUILD	2016-10-30 18:02:08 UTC (rev 194038)
@@ -0,0 +1,90 @@
+# $Id$
+# Maintainer: schuay <jakob.gruber at gmail.com>
+# Contributor: Brad Fanella <bradfanella at archlinux.us>
+# Contributor: Corrado Primier <bardo at aur.archlinux.org>
+# Contributor: danst0 <danst0 at west.de>
+
+# Build order: avr-binutils -> avr-gcc -> avr-libc
+
+pkgname=avr-binutils
+pkgver=2.27
+pkgrel=2
+pkgdesc="A set of programs to assemble and manipulate binary and object files for the AVR architecture"
+arch=('i686' 'x86_64')
+url="http://www.gnu.org/software/binutils/"
+license=('GPL')
+depends=('glibc>=2.17' 'zlib' 'binutils')
+options=('!distcc' '!ccache')
+source=(ftp://ftp.gnu.org/gnu/binutils/binutils-${pkgver}.tar.bz2{,.sig}
+        avr-size.patch
+        # fix for https://bugs.archlinux.org/task/49284
+        # from https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bf1865065f64af2f32798c0327143baf99634e8d
+        fix_relaxation.patch)
+sha1sums=('6e472ddae565a2b1447e6f2393809bb8799982cf'
+          'SKIP'
+          'b6d1ff7084b1f0a3fd2dee5383019ffb202e6c9a'
+          '3c43bc9d27ecb2773afd5859864bdfdb2706d7d7')
+validpgpkeys=('EAF1C276A747E9ED86210CBAC3126D3B4AE55E93')  # Tristan Gingold
+
+_builddir=binutils-build
+
+prepare() {
+    cd ${srcdir}/binutils-${pkgver}
+
+    # See https://bugs.archlinux.org/task/32504
+    # And https://bugs.archlinux.org/task/40986
+    patch -Np0 < ${srcdir}/avr-size.patch
+
+    patch -p1 < ${srcdir}/fix_relaxation.patch 
+
+    # https://bugs.archlinux.org/task/34629
+    sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" libiberty/configure
+
+    rm -rf ${srcdir}/${_builddir}
+    mkdir ${srcdir}/${_builddir}
+}
+
+build() {
+    cd ${srcdir}/binutils-${pkgver}
+
+    config_guess=$(./config.guess)
+
+    cd ${srcdir}/${_builddir}
+
+    ${srcdir}/binutils-${pkgver}/configure \
+        --prefix=/usr \
+        --with-lib-path=/usr/lib:/usr/local/lib \
+        --with-bugurl=https://bugs.archlinux.org/ \
+        --enable-ld=default \
+        --enable-gold \
+        --enable-plugins \
+        --enable-threads \
+        --with-pic \
+        --enable-shared \
+        --disable-werror \
+        --disable-multilib \
+        --build=${config_guess} \
+        --target=avr \
+        $CONFIGFLAG
+
+    # This checks the host environment and makes sure all the necessary tools are available to compile Binutils.
+    make configure-host
+
+    make tooldir=/usr
+}
+
+package() {
+    cd ${srcdir}/${_builddir}
+
+    make prefix=${pkgdir}/usr tooldir=${pkgdir}/usr install
+
+    for bin in ar as nm objcopy objdump ranlib strip readelf; do
+        rm -f ${pkgdir}/usr/bin/${bin}
+    done
+
+    for info in as bfd binutils gprof ld; do
+        mv ${pkgdir}/usr/share/info/${info}.info ${pkgdir}/usr/share/info/avr-${info}.info
+    done
+
+    rm -r ${pkgdir}/usr/share/locale
+}

Copied: avr-binutils/repos/community-testing-i686/avr-size.patch (from rev 194037, avr-binutils/trunk/avr-size.patch)
===================================================================
--- community-testing-i686/avr-size.patch	                        (rev 0)
+++ community-testing-i686/avr-size.patch	2016-10-30 18:02:08 UTC (rev 194038)
@@ -0,0 +1,523 @@
+AVR only; support -C for AVR memory usage
+
+Source: http://git.makehackvoid.com/cgi-bin/gitweb.cgi?p=mhvavrtools.git;a=blob_plain;f=mhvavrtools/patches/binutils-001-avr-size.patch;h=e80d28eae46217551d996a2253256c97d10aa4b5;hb=refs/heads/master
+===========================================================
+--- binutils/size.c	2007-08-06 13:56:14.000000000 -0600
++++ binutils/size.c	2007-09-13 09:13:10.281250000 -0600
+@@ -36,10 +36,31 @@
+ #include "getopt.h"
+ #include "bucomm.h"
+ 
+-#ifndef BSD_DEFAULT
+-#define BSD_DEFAULT 1
++typedef enum
++{
++    format_sysv = 0,
++    format_bsd = 1,
++    format_avr = 2,
++} format_type_t;
++
++
++/* Set the default format. */
++#define FORMAT_DEFAULT_SYSV 0
++#define FORMAT_DEFAULT_BSD 1
++#define FORMAT_DEFAULT_AVR 0
++
++#if FORMAT_DEFAULT_SYSV
++    #define FORMAT_DEFAULT format_sysv
++    #define FORMAT_NAME "sysv"
++#elif FORMAT_DEFAULT_BSD
++    #define FORMAT_DEFAULT format_bsd
++    #define FORMAT_NAME "berkeley"
++#elif FORMAT_DEFAULT_AVR
++    #define FORMAT_DEFAULT format_avr
++    #define FORMAT_NAME "avr"
+ #endif
+ 
++
+ /* Program options.  */
+ 
+ static enum
+@@ -48,9 +69,8 @@ static enum
+   }
+ radix = decimal;
+ 
+-/* 0 means use AT&T-style output.  */
+-static int berkeley_format = BSD_DEFAULT;
+ 
++format_type_t format = FORMAT_DEFAULT;
+ static int show_version = 0;
+ static int show_help = 0;
+ static int show_totals = 0;
+@@ -64,6 +84,246 @@ static bfd_size_type total_textsize;
+ /* Program exit status.  */
+ static int return_code = 0;
+ 
++
++/* AVR Size specific stuff */
++
++#define AVR64 64UL
++#define AVR128 128UL
++#define AVR256 256UL
++#define AVR512 512UL
++#define AVR1K 1024UL
++#define AVR2K 2048UL
++#define AVR4K 4096UL
++#define AVR8K 8192UL
++#define AVR16K 16384UL
++#define AVR20K 20480UL
++#define AVR24K 24576UL
++#define AVR32K 32768UL
++#define AVR36K 36864UL
++#define AVR40K 40960UL
++#define AVR64K 65536UL
++#define AVR68K 69632UL
++#define AVR128K 131072UL
++#define AVR136K 139264UL
++#define AVR200K 204800UL
++#define AVR256K 262144UL
++#define AVR264K 270336UL
++
++typedef struct
++{
++    char *name;
++	long flash;
++	long ram;
++	long eeprom;
++} avr_device_t;
++
++avr_device_t avr[] =
++{
++	{"atxmega256a3",  AVR264K, AVR16K, AVR4K},
++	{"atxmega256a3b", AVR264K, AVR16K, AVR4K},
++	{"atxmega256d3",  AVR264K, AVR16K, AVR4K},
++
++	{"atmega2560",    AVR256K, AVR8K,  AVR4K},
++	{"atmega2561",    AVR256K, AVR8K,  AVR4K},
++
++	{"atxmega192a3",  AVR200K, AVR16K, AVR2K},
++	{"atxmega192d3",  AVR200K, AVR16K, AVR2K},
++
++	{"atxmega128a1",  AVR136K, AVR8K,  AVR2K},
++	{"atxmega128a1u", AVR136K, AVR8K,  AVR2K},
++	{"atxmega128a3",  AVR136K, AVR8K,  AVR2K},
++	{"atxmega128d3",  AVR136K, AVR8K,  AVR2K},
++
++	{"at43usb320",    AVR128K, 608UL,  0UL},
++	{"at90can128",    AVR128K, AVR4K,  AVR4K},
++	{"at90usb1286",   AVR128K, AVR8K,  AVR4K},
++	{"at90usb1287",   AVR128K, AVR8K,  AVR4K},
++	{"atmega128",     AVR128K, AVR4K,  AVR4K},
++	{"atmega1280",    AVR128K, AVR8K,  AVR4K},
++	{"atmega1281",    AVR128K, AVR8K,  AVR4K},
++	{"atmega1284p",   AVR128K, AVR16K, AVR4K},
++	{"atmega128rfa1", AVR128K, AVR16K, AVR4K},
++	{"atmega103",     AVR128K, 4000UL, AVR4K},
++
++	{"atxmega64a1",   AVR68K,  AVR4K,  AVR2K},
++	{"atxmega64a1u",  AVR68K,  AVR4K,  AVR2K},
++	{"atxmega64a3",   AVR68K,  AVR4K,  AVR2K},
++	{"atxmega64d3",   AVR68K,  AVR4K,  AVR2K},
++
++	{"at90can64",     AVR64K,  AVR4K,  AVR2K},
++	{"at90scr100",    AVR64K,  AVR4K,  AVR2K},
++	{"at90usb646",    AVR64K,  AVR4K,  AVR2K},
++	{"at90usb647",    AVR64K,  AVR4K,  AVR2K},
++	{"atmega64",      AVR64K,  AVR4K,  AVR2K},
++	{"atmega640",     AVR64K,  AVR8K,  AVR4K},
++	{"atmega644",     AVR64K,  AVR4K,  AVR2K},
++	{"atmega644a",    AVR64K,  AVR4K,  AVR2K},
++	{"atmega644p",    AVR64K,  AVR4K,  AVR2K},
++	{"atmega644pa",   AVR64K,  AVR4K,  AVR2K},
++	{"atmega645",     AVR64K,  AVR4K,  AVR2K},
++	{"atmega645a",    AVR64K,  AVR4K,  AVR2K},
++	{"atmega645p",    AVR64K,  AVR4K,  AVR2K},
++	{"atmega6450",    AVR64K,  AVR4K,  AVR2K},
++	{"atmega6450a",   AVR64K,  AVR4K,  AVR2K},
++	{"atmega6450p",   AVR64K,  AVR4K,  AVR2K},
++	{"atmega649",     AVR64K,  AVR4K,  AVR2K},
++	{"atmega649a",    AVR64K,  AVR4K,  AVR2K},
++	{"atmega649p",    AVR64K,  AVR4K,  AVR2K},
++	{"atmega6490",    AVR64K,  AVR4K,  AVR2K},
++	{"atmega6490a",   AVR64K,  AVR4K,  AVR2K},
++	{"atmega6490p",   AVR64K,  AVR4K,  AVR2K},
++	{"atmega64c1",    AVR64K,  AVR4K,  AVR2K},
++	{"atmega64hve",   AVR64K,  AVR4K,  AVR1K},
++	{"atmega64m1",    AVR64K,  AVR4K,  AVR2K},
++   {"m3000",         AVR64K,  AVR4K,  0UL},
++
++	{"atmega406",     AVR40K,  AVR2K,  AVR512},
++
++	{"atxmega32a4",   AVR36K,  AVR4K,  AVR1K},
++	{"atxmega32d4",   AVR36K,  AVR4K,  AVR1K},
++
++	{"at90can32",     AVR32K,  AVR2K,  AVR1K},
++	{"at94k",         AVR32K,  AVR4K,  0UL},
++	{"atmega32",      AVR32K,  AVR2K,  AVR1K},
++	{"atmega323",     AVR32K,  AVR2K,  AVR1K},
++	{"atmega324a",    AVR32K,  AVR2K,  AVR1K},
++	{"atmega324p",    AVR32K,  AVR2K,  AVR1K},
++	{"atmega324pa",   AVR32K,  AVR2K,  AVR1K},
++	{"atmega325",     AVR32K,  AVR2K,  AVR1K},
++	{"atmega325a",    AVR32K,  AVR2K,  AVR1K},
++	{"atmega325p",    AVR32K,  AVR2K,  AVR1K},
++	{"atmega3250",    AVR32K,  AVR2K,  AVR1K},
++	{"atmega3250a",   AVR32K,  AVR2K,  AVR1K},
++	{"atmega3250p",   AVR32K,  AVR2K,  AVR1K},
++	{"atmega328",     AVR32K,  AVR2K,  AVR1K},
++	{"atmega328p",    AVR32K,  AVR2K,  AVR1K},
++	{"atmega329",     AVR32K,  AVR2K,  AVR1K},
++	{"atmega329a",    AVR32K,  AVR2K,  AVR1K},
++	{"atmega329p",    AVR32K,  AVR2K,  AVR1K},
++	{"atmega329pa",   AVR32K,  AVR2K,  AVR1K},
++	{"atmega3290",    AVR32K,  AVR2K,  AVR1K},
++	{"atmega3290a",   AVR32K,  AVR2K,  AVR1K},
++	{"atmega3290p",   AVR32K,  AVR2K,  AVR1K},
++	{"atmega32hvb",   AVR32K,  AVR2K,  AVR1K},
++	{"atmega32c1",    AVR32K,  AVR2K,  AVR1K},
++   {"atmega32hvb",   AVR32K,  AVR2K,  AVR1K},
++	{"atmega32m1",    AVR32K,  AVR2K,  AVR1K},
++	{"atmega32u2",    AVR32K,  AVR1K,  AVR1K},
++	{"atmega32u4",    AVR32K,  2560UL, AVR1K},
++	{"atmega32u6",    AVR32K,  2560UL, AVR1K},
++
++	{"at43usb355",    AVR24K,  1120UL,   0UL},
++
++	{"atxmega16a4",   AVR20K,  AVR2K,  AVR1K},
++	{"atxmega16d4",   AVR20K,  AVR2K,  AVR1K},
++
++	{"at76c711",      AVR16K,  AVR2K,  0UL},
++	{"at90pwm216",    AVR16K,  AVR1K,  AVR512},
++	{"at90pwm316",    AVR16K,  AVR1K,  AVR512},
++	{"at90usb162",    AVR16K,  AVR512, AVR512},
++	{"atmega16",      AVR16K,  AVR1K,  AVR512},
++	{"atmega16a",     AVR16K,  AVR1K,  AVR512},
++	{"atmega161",     AVR16K,  AVR1K,  AVR512},
++	{"atmega162",     AVR16K,  AVR1K,  AVR512},
++	{"atmega163",     AVR16K,  AVR1K,  AVR512},
++	{"atmega164",     AVR16K,  AVR1K,  AVR512},
++	{"atmega164a",    AVR16K,  AVR1K,  AVR512},
++	{"atmega164p",    AVR16K,  AVR1K,  AVR512},
++	{"atmega165a",    AVR16K,  AVR1K,  AVR512},
++	{"atmega165",     AVR16K,  AVR1K,  AVR512},
++	{"atmega165p",    AVR16K,  AVR1K,  AVR512},
++	{"atmega168",     AVR16K,  AVR1K,  AVR512},
++	{"atmega168a",    AVR16K,  AVR1K,  AVR512},
++	{"atmega168p",    AVR16K,  AVR1K,  AVR512},
++	{"atmega169",     AVR16K,  AVR1K,  AVR512},
++	{"atmega169a",    AVR16K,  AVR1K,  AVR512},
++	{"atmega169p",    AVR16K,  AVR1K,  AVR512},
++	{"atmega169pa",   AVR16K,  AVR1K,  AVR512},
++	{"atmega16hva",   AVR16K,  768UL,  AVR256},
++	{"atmega16hva2",  AVR16K,  AVR1K,  AVR256},
++   {"atmega16hvb",   AVR16K,  AVR1K,  AVR512},
++	{"atmega16m1",    AVR16K,  AVR1K,  AVR512},
++	{"atmega16u2",    AVR16K,  AVR512, AVR512},
++	{"atmega16u4",    AVR16K,  1280UL, AVR512},
++	{"attiny167",     AVR16K,  AVR512, AVR512},
++
++	{"at90c8534",     AVR8K,   352UL,  AVR512},
++	{"at90pwm1",      AVR8K,   AVR512, AVR512},
++	{"at90pwm2",      AVR8K,   AVR512, AVR512},
++	{"at90pwm2b",     AVR8K,   AVR512, AVR512},
++	{"at90pwm3",      AVR8K,   AVR512, AVR512},
++	{"at90pwm3b",     AVR8K,   AVR512, AVR512},
++	{"at90pwm81",     AVR8K,   AVR256, AVR512},
++	{"at90s8515",     AVR8K,   AVR512, AVR512},
++	{"at90s8535",     AVR8K,   AVR512, AVR512},
++	{"at90usb82",     AVR8K,   AVR512, AVR512},
++	{"ata6289",       AVR8K,   AVR512, 320UL},
++	{"atmega8",       AVR8K,   AVR1K,  AVR512},
++	{"atmega8515",    AVR8K,   AVR512, AVR512},
++	{"atmega8535",    AVR8K,   AVR512, AVR512},
++	{"atmega88",      AVR8K,   AVR1K,  AVR512},
++	{"atmega88a",     AVR8K,   AVR1K,  AVR512},
++	{"atmega88p",     AVR8K,   AVR1K,  AVR512},
++	{"atmega88pa",    AVR8K,   AVR1K,  AVR512},
++	{"atmega8hva",    AVR8K,   768UL,  AVR256},
++	{"atmega8u2",     AVR8K,   AVR512, AVR512},
++	{"attiny84",      AVR8K,   AVR512, AVR512},
++	{"attiny84a",     AVR8K,   AVR512, AVR512},
++	{"attiny85",      AVR8K,   AVR512, AVR512},
++	{"attiny861",     AVR8K,   AVR512, AVR512},
++	{"attiny861a",    AVR8K,   AVR512, AVR512},
++	{"attiny87",      AVR8K,   AVR512, AVR512},
++	{"attiny88",      AVR8K,   AVR512, AVR64},
++
++	{"at90s4414",     AVR4K,   352UL,  AVR256},
++	{"at90s4433",     AVR4K,   AVR128, AVR256},
++	{"at90s4434",     AVR4K,   352UL,  AVR256},
++	{"atmega48",      AVR4K,   AVR512, AVR256},
++	{"atmega48a",     AVR4K,   AVR512, AVR256},
++	{"atmega48p",     AVR4K,   AVR512, AVR256},
++	{"attiny4313",    AVR4K,   AVR256, AVR256},
++	{"attiny43u",     AVR4K,   AVR256, AVR64},
++	{"attiny44",      AVR4K,   AVR256, AVR256},
++	{"attiny44a",     AVR4K,   AVR256, AVR256},
++	{"attiny45",      AVR4K,   AVR256, AVR256},
++	{"attiny461",     AVR4K,   AVR256, AVR256},
++	{"attiny461a",    AVR4K,   AVR256, AVR256},
++	{"attiny48",      AVR4K,   AVR256, AVR64},
++
++	{"at86rf401",     AVR2K,   224UL,  AVR128},
++	{"at90s2313",     AVR2K,   AVR128, AVR128},
++	{"at90s2323",     AVR2K,   AVR128, AVR128},
++	{"at90s2333",     AVR2K,   224UL,  AVR128},
++	{"at90s2343",     AVR2K,   AVR128, AVR128},
++   {"attiny20",      AVR2K,   AVR128, 0UL},
++	{"attiny22",      AVR2K,   224UL,  AVR128},
++	{"attiny2313",    AVR2K,   AVR128, AVR128},
++	{"attiny2313a",   AVR2K,   AVR128, AVR128},
++	{"attiny24",      AVR2K,   AVR128, AVR128},
++	{"attiny24a",     AVR2K,   AVR128, AVR128},
++	{"attiny25",      AVR2K,   AVR128, AVR128},
++	{"attiny26",      AVR2K,   AVR128, AVR128},
++	{"attiny261",     AVR2K,   AVR128, AVR128},
++	{"attiny261a",    AVR2K,   AVR128, AVR128},
++	{"attiny28",      AVR2K,   0UL,    0UL},
++   {"attiny40",      AVR2K,   AVR256, 0UL},
++
++	{"at90s1200",     AVR1K,   0UL,    AVR64},
++   {"attiny9",       AVR1K,   32UL,   0UL},
++   {"attiny10",      AVR1K,   32UL,   0UL},
++	{"attiny11",      AVR1K,   0UL,    AVR64},
++	{"attiny12",      AVR1K,   0UL,    AVR64},
++	{"attiny13",      AVR1K,   AVR64,  AVR64},
++	{"attiny13a",     AVR1K,   AVR64,  AVR64},
++	{"attiny15",      AVR1K,   0UL,    AVR64},
++
++   {"attiny4",       AVR512,  32UL,   0UL},
++   {"attiny5",       AVR512,  32UL,   0UL},
++};
++
++static char *avrmcu = NULL;
++
++
+ static char *target = NULL;
+ 
+ /* Forward declarations.  */
+@@ -79,7 +337,8 @@ usage (FILE *stream, int status)
+   fprintf (stream, _(" Displays the sizes of sections inside binary files\n"));
+   fprintf (stream, _(" If no input file(s) are specified, a.out is assumed\n"));
+   fprintf (stream, _(" The options are:\n\
+-  -A|-B     --format={sysv|berkeley}  Select output style (default is %s)\n\
++  -A|-B|-C  --format={sysv|berkeley|avr}  Select output style (default is %s)\n\
++            --mcu=<avrmcu>            MCU name for AVR format only\n\
+   -o|-d|-x  --radix={8|10|16}         Display numbers in octal, decimal or hex\n\
+   -t        --totals                  Display the total sizes (Berkeley only)\n\
+             --common                  Display total size for *COM* syms\n\
+@@ -88,11 +337,7 @@ usage (FILE *stream, int status)
+   -h        --help                    Display this information\n\
+   -v        --version                 Display the program's version\n\
+ \n"),
+-#if BSD_DEFAULT
+-  "berkeley"
+-#else
+-  "sysv"
+-#endif
++FORMAT_NAME
+ );
+   list_supported_targets (program_name, stream);
+   if (REPORT_BUGS_TO[0] && status == 0)
+@@ -103,6 +359,7 @@ usage (FILE *stream, int status)
+ #define OPTION_FORMAT (200)
+ #define OPTION_RADIX (OPTION_FORMAT + 1)
+ #define OPTION_TARGET (OPTION_RADIX + 1)
++#define OPTION_MCU (OPTION_TARGET + 1) 
+ 
+ static struct option long_options[] =
+ {
+@@ -110,6 +368,7 @@ static struct option long_options[] =
+   {"format", required_argument, 0, OPTION_FORMAT},
+   {"radix", required_argument, 0, OPTION_RADIX},
+   {"target", required_argument, 0, OPTION_TARGET},
++  {"mcu", required_argument, 0, 203},
+   {"totals", no_argument, &show_totals, 1},
+   {"version", no_argument, &show_version, 1},
+   {"help", no_argument, &show_help, 1},
+@@ -141,7 +399,7 @@ main (int argc, char **argv)
+   bfd_init ();
+   set_default_bfd_target ();
+ 
+-  while ((c = getopt_long (argc, argv, "ABHhVvdfotx", long_options,
++  while ((c = getopt_long (argc, argv, "ABCHhVvdfotx", long_options,
+ 			   (int *) 0)) != EOF)
+     switch (c)
+       {
+@@ -150,11 +409,15 @@ main (int argc, char **argv)
+ 	  {
+ 	  case 'B':
+ 	  case 'b':
+-	    berkeley_format = 1;
++	    format = format_bsd;
+ 	    break;
+ 	  case 'S':
+ 	  case 's':
+-	    berkeley_format = 0;
++	    format = format_sysv;
++	    break;
++	  case 'A':
++	  case 'a':
++	    format = format_avr;
+ 	    break;
+ 	  default:
+ 	    non_fatal (_("invalid argument to --format: %s"), optarg);
+@@ -162,6 +424,10 @@ main (int argc, char **argv)
+ 	  }
+ 	break;
+ 
++      case OPTION_MCU:
++	avrmcu = optarg;
++	break;
++
+       case OPTION_TARGET:
+ 	target = optarg;
+ 	break;
+@@ -190,11 +457,14 @@ main (int argc, char **argv)
+ 	break;
+ 
+       case 'A':
+-	berkeley_format = 0;
++	format = format_sysv;
+ 	break;
+       case 'B':
+-	berkeley_format = 1;
++	format = format_bsd;
+ 	break;
++      case 'C':
++    format = format_avr;
++    break;
+       case 'v':
+       case 'V':
+ 	show_version = 1;
+@@ -240,7 +509,7 @@ main (int argc, char **argv)
+     for (; optind < argc;)
+       display_file (argv[optind++]);
+ 
+-  if (show_totals && berkeley_format)
++  if (show_totals && format == format_bsd)
+     {
+       bfd_size_type total = total_textsize + total_datasize + total_bsssize;
+ 
+@@ -599,13 +869,117 @@ print_sysv_format (bfd *file)
+   printf ("\n\n");
+ }
+ 
++
++static avr_device_t *
++avr_find_device (void)
++{
++  unsigned int i;
++  if (avrmcu != NULL)
++  {
++    for (i = 0; i < sizeof(avr) / sizeof(avr[0]); i++)
++    {
++      if (strcmp(avr[i].name, avrmcu) == 0)
++      {
++        /* Match found */
++        return (&avr[i]);
++      }
++    }
++  }
++  return (NULL);
++}
++
++
++
++static void
++print_avr_format (bfd *file)
++{
++  char *avr_name = "Unknown";
++  int flashmax = 0;
++  int rammax = 0;
++  int eeprommax = 0;
++  asection *section; 
++  bfd_size_type my_datasize = 0;
++  bfd_size_type my_textsize = 0;
++  bfd_size_type my_bsssize = 0;
++  bfd_size_type bootloadersize = 0;
++  bfd_size_type noinitsize = 0;
++  bfd_size_type eepromsize = 0;
++
++  avr_device_t *avrdevice = avr_find_device();
++  if (avrdevice != NULL)
++  {
++    avr_name = avrdevice->name;
++    flashmax = avrdevice->flash;
++    rammax = avrdevice->ram;
++    eeprommax = avrdevice->eeprom;
++  }
++
++  if ((section = bfd_get_section_by_name (file, ".data")) != NULL)
++    my_datasize = bfd_section_size (file, section);
++  if ((section = bfd_get_section_by_name (file, ".text")) != NULL)
++    my_textsize = bfd_section_size (file, section);
++  if ((section = bfd_get_section_by_name (file, ".bss")) != NULL)
++    my_bsssize = bfd_section_size (file, section);
++  if ((section = bfd_get_section_by_name (file, ".bootloader")) != NULL)
++    bootloadersize = bfd_section_size (file, section);
++  if ((section = bfd_get_section_by_name (file, ".noinit")) != NULL)
++    noinitsize = bfd_section_size (file, section);
++  if ((section = bfd_get_section_by_name (file, ".eeprom")) != NULL)
++    eepromsize = bfd_section_size (file, section);
++  
++  bfd_size_type text = my_textsize + my_datasize + bootloadersize;
++  bfd_size_type data = my_datasize + my_bsssize + noinitsize;
++  bfd_size_type eeprom = eepromsize;
++  
++  printf ("AVR Memory Usage\n"
++          "----------------\n"
++          "Device: %s\n\n", avr_name);
++  
++  /* Text size */
++  printf ("Program:%8ld bytes", text);
++  if (flashmax > 0)
++  {
++    printf (" (%2.1f%% Full)", ((float)text / flashmax) * 100);
++  }
++  printf ("\n(.text + .data + .bootloader)\n\n");
++  
++  /* Data size */
++  printf ("Data:   %8ld bytes", data);
++  if (rammax > 0)
++  {
++    printf (" (%2.1f%% Full)", ((float)data / rammax) * 100);
++  }
++  printf ("\n(.data + .bss + .noinit)\n\n");
++  
++  /* EEPROM size */
++  if (eeprom > 0) 
++  { 
++    printf ("EEPROM: %8ld bytes", eeprom);
++    if (eeprommax > 0)
++    {
++      printf (" (%2.1f%% Full)", ((float)eeprom / eeprommax) * 100);
++    }
++    printf ("\n(.eeprom)\n\n");
++  }
++}
++
++
+ static void
+ print_sizes (bfd *file)
+ {
+   if (show_common)
+     calculate_common_size (file);
+-  if (berkeley_format)
+-    print_berkeley_format (file);
+-  else
+-    print_sysv_format (file);
++  switch (format)
++  {
++    case format_sysv:
++      print_sysv_format (file);
++      break;
++    case format_bsd:
++      print_berkeley_format (file);
++      break;
++    case format_avr:
++    default:
++      print_avr_format (file);
++      break;
++  }
+ }

Copied: avr-binutils/repos/community-testing-i686/fix_relaxation.patch (from rev 194037, avr-binutils/trunk/fix_relaxation.patch)
===================================================================
--- community-testing-i686/fix_relaxation.patch	                        (rev 0)
+++ community-testing-i686/fix_relaxation.patch	2016-10-30 18:02:08 UTC (rev 194038)
@@ -0,0 +1,256 @@
+From bf1865065f64af2f32798c0327143baf99634e8d Mon Sep 17 00:00:00 2001
+From: Senthil Kumar Selvaraj <senthil_kumar.selvaraj at atmel.com>
+Date: Tue, 6 Sep 2016 12:28:37 +0530
+Subject: [PATCH] Fix PR ld/20545 - relaxation bugs in avr backend
+
+Prior to the patch, addends for relocs were being adjusted even if
+they went beyond an alignment boundary. This is wrong - to
+preserve alignment constraints, the relaxation logic adds as many padding
+bytes at the alignment boundary as was deleted, so addends beyond the
+boundary should not be adjusted. avr-prop-7.s reproduces this
+scenario.
+
+Also, prior to this patch, the relaxation logic assumed that the addr
+parameter pointed to the middle of the instruction to be deleted, and
+that addr - count would therefore be the shrinked instruction's
+address. This is true when actually shrinking instructions.
+
+The alignment constraints handling logic also invokes the same logic
+though, with addr as the starting offset of padding bytes and
+with count as the number of bytes to be deleted. Calculating the
+shrinked insn's address as addr - count is obviously wrong in this
+case - that offset would point to count bytes before the last
+non-padded byte. avr-prop-8.s reproduces this scenario.
+
+To fix scenario 1, the patch adds an additional check to ensure reloc addends
+aren't adjusted if they cross a shrink boundary. The shrink boundary
+is either the section size or an alignment boundary. Addends pointing
+at an alignment boundary don't need to be adjusted, as padding would
+occur and keep the boundary the same. Addends pointing at section size
+need to be adjusted though, as no padding occurs and the section size
+itself would get decremented. The patch records whether padding
+occured (did_pad) and uses that to detect and handle this condition.
+
+To fix scenario 2, the patch adds an additional parameter
+(delete_shrinks_insn) to elf32_avr_relax_delete_bytes to distinguish
+instruction bytes deletion from padding bytes deletion. It then uses that to
+correctly set shrinked_insn_address.
+
+bfd/ChangeLog:
+
+2016-09-02  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj at atmel.com>
+
+	PR ld/20545
+	* elf32-avr.c (elf32_avr_relax_delete_bytes): Add parameter
+	delete_shrinks_insn. Modify computation of shrinked_insn_address.
+	Compute shrink_boundary and adjust addend only if
+	addend_within_shrink_boundary.
+	(elf32_avr_relax_section): Modify calls to
+	elf32_avr_relax_delete_bytes to pass extra parameter.
+
+ld/ChangeLog:
+
+2016-09-02  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj at atmel.com>
+
+	PR ld/20545
+	* testsuite/ld-avr/avr-prop-7.d: New test.
+	* testsuite/ld-avr/avr-prop-7.s: New test.
+	* testsuite/ld-avr/avr-prop-8.d: New test.
+	* testsuite/ld-avr/avr-prop-8.s: New test.
+---
+ bfd/ChangeLog                    |   10 +++++++++
+ bfd/elf32-avr.c                  |   40 +++++++++++++++++++++++++++++++------
+ ld/ChangeLog                     |    8 +++++++
+ ld/testsuite/ld-avr/avr-prop-7.d |   15 ++++++++++++++
+ ld/testsuite/ld-avr/avr-prop-7.s |    8 +++++++
+ ld/testsuite/ld-avr/avr-prop-8.d |   13 ++++++++++++
+ ld/testsuite/ld-avr/avr-prop-8.s |    7 ++++++
+ 7 files changed, 94 insertions(+), 7 deletions(-)
+ create mode 100644 ld/testsuite/ld-avr/avr-prop-7.d
+ create mode 100644 ld/testsuite/ld-avr/avr-prop-7.s
+ create mode 100644 ld/testsuite/ld-avr/avr-prop-8.d
+ create mode 100644 ld/testsuite/ld-avr/avr-prop-8.s
+
+diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c
+index a0a5c69..eea76a4 100644
+--- a/bfd/elf32-avr.c
++++ b/bfd/elf32-avr.c
+@@ -1808,13 +1808,17 @@ elf32_avr_adjust_diff_reloc_value (bfd *abfd,
+ /* Delete some bytes from a section while changing the size of an instruction.
+    The parameter "addr" denotes the section-relative offset pointing just
+    behind the shrinked instruction. "addr+count" point at the first
+-   byte just behind the original unshrinked instruction.  */
++   byte just behind the original unshrinked instruction. If delete_shrinks_insn
++   is FALSE, we are deleting redundant padding bytes from relax_info prop
++   record handling. In that case, addr is section-relative offset of start
++   of padding, and count is the number of padding bytes to delete. */
+ 
+ static bfd_boolean
+ elf32_avr_relax_delete_bytes (bfd *abfd,
+                               asection *sec,
+                               bfd_vma addr,
+-                              int count)
++                              int count,
++                              bfd_boolean delete_shrinks_insn)
+ {
+   Elf_Internal_Shdr *symtab_hdr;
+   unsigned int sec_shndx;
+@@ -1829,6 +1833,7 @@ elf32_avr_relax_delete_bytes (bfd *abfd,
+   struct avr_relax_info *relax_info;
+   struct avr_property_record *prop_record = NULL;
+   bfd_boolean did_shrink = FALSE;
++  bfd_boolean did_pad = FALSE;
+ 
+   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+   sec_shndx = _bfd_elf_section_from_bfd_section (abfd, sec);
+@@ -1909,6 +1914,7 @@ elf32_avr_relax_delete_bytes (bfd *abfd,
+          to remember we didn't delete anything i.e. don't set did_shrink,
+          so that we don't corrupt reloc offsets or symbol values.*/
+       memset (contents + toaddr - count, fill, count);
++      did_pad = TRUE;
+ 
+       /* Adjust the TOADDR to avoid moving symbols located at the address
+          of the property record, which has not moved.  */
+@@ -1965,7 +1971,9 @@ elf32_avr_relax_delete_bytes (bfd *abfd,
+ 	 continue;
+ 
+        shrinked_insn_address = (sec->output_section->vma
+-                                + sec->output_offset + addr - count);
++                                + sec->output_offset + addr);
++       if (delete_shrinks_insn)
++         shrinked_insn_address -= count;
+ 
+        irel = elf_section_data (isec)->relocs;
+        /* PR 12161: Read in the relocs for this section if necessary.  */
+@@ -2002,6 +2010,13 @@ elf32_avr_relax_delete_bytes (bfd *abfd,
+                   a symbol or section associated with it.  */
+                if (sym_sec == sec)
+                  {
++                   /* If there is an alignment boundary, we only need to
++                      adjust addends that end up below the boundary. */
++                   bfd_vma shrink_boundary = (reloc_toaddr
++                                              + sec->output_section->vma
++                                              + sec->output_offset);
++                   bfd_boolean addend_within_shrink_boundary = FALSE;
++
+                    symval += sym_sec->output_section->vma
+                              + sym_sec->output_offset;
+ 
+@@ -2015,8 +2030,17 @@ elf32_avr_relax_delete_bytes (bfd *abfd,
+                              (unsigned int) (symval + irel->r_addend),
+                              (unsigned int) shrinked_insn_address);
+ 
++                   /* If we padded bytes, then the boundary didn't change,
++                      so there's no need to adjust addends pointing at the boundary.
++                      If we didn't pad, then we actually shrank the boundary, so
++                      addends pointing at the boundary need to be adjusted too. */
++                    addend_within_shrink_boundary = did_pad
++                      ? ((symval + irel->r_addend) < shrink_boundary)
++                      : ((symval + irel->r_addend) <= shrink_boundary);
++
+                    if (symval <= shrinked_insn_address
+-                       && (symval + irel->r_addend) > shrinked_insn_address)
++                       && (symval + irel->r_addend) > shrinked_insn_address
++                       && addend_within_shrink_boundary)
+                      {
+                        if (elf32_avr_is_diff_reloc (irel))
+                          {
+@@ -2648,7 +2672,8 @@ elf32_avr_relax_section (bfd *abfd,
+                   {
+                     /* Delete two bytes of data.  */
+                     if (!elf32_avr_relax_delete_bytes (abfd, sec,
+-                                                       irel->r_offset + 2, 2))
++                                                       irel->r_offset + 2, 2,
++                                                       TRUE))
+                       goto error_return;
+ 
+                     /* That will change things, so, we should relax again.
+@@ -2972,7 +2997,8 @@ elf32_avr_relax_section (bfd *abfd,
+ 
+ 			    /* Delete two bytes of data.  */
+ 			    if (!elf32_avr_relax_delete_bytes (abfd, sec,
+-							       irel->r_offset + insn_size, 2))
++							       irel->r_offset + insn_size, 2,
++							       TRUE))
+ 			      goto error_return;
+ 
+ 			    /* That will change things, so, we should relax
+@@ -3040,7 +3066,7 @@ elf32_avr_relax_section (bfd *abfd,
+                         record->offset -= count;
+                         elf32_avr_relax_delete_bytes (abfd, sec,
+                                                       addr - count,
+-                                                      count);
++                                                      count, FALSE);
+                         *again = TRUE;
+                       }
+                   }
+diff --git a/ld/testsuite/ld-avr/avr-prop-7.d b/ld/testsuite/ld-avr/avr-prop-7.d
+new file mode 100644
+index 0000000..9f2cea9
+--- /dev/null
++++ b/ld/testsuite/ld-avr/avr-prop-7.d
+@@ -0,0 +1,15 @@
++#name: AVR .avr.prop, AVR_7_PCREL after align
++#as: -mavrxmega2 -mlink-relax
++#ld: -mavrxmega2 --relax
++#source: avr-prop-7.s
++#objdump: -S
++#target: avr-*-*
++
++#...
++00000000 <__ctors_end>:
++   0:	04 d0       	rcall	.+8      	; 0xa <foo>
++   2:	00 00       	nop
++   4:	00 00       	nop
++   6:	86 e0       	ldi	r24, 0x06	; 6
++   8:	f0 f7       	brcc	.-4      	; 0x6 <__ctors_end\+0x6>
++#...
+diff --git a/ld/testsuite/ld-avr/avr-prop-7.s b/ld/testsuite/ld-avr/avr-prop-7.s
+new file mode 100644
+index 0000000..38276ba
+--- /dev/null
++++ b/ld/testsuite/ld-avr/avr-prop-7.s
+@@ -0,0 +1,8 @@
++	call foo
++	nop
++	.p2align	1
++        nop
++.L618:
++	ldi r24,lo8(6)
++	brsh .L618
++foo:    nop
+diff --git a/ld/testsuite/ld-avr/avr-prop-8.d b/ld/testsuite/ld-avr/avr-prop-8.d
+new file mode 100644
+index 0000000..2905f98
+--- /dev/null
++++ b/ld/testsuite/ld-avr/avr-prop-8.d
+@@ -0,0 +1,13 @@
++#name: AVR .avr.prop, AVR_7_PCREL just before align
++#as: -mavrxmega2 -mlink-relax
++#ld: -mavrxmega2 --relax
++#source: avr-prop-8.s
++#objdump: -S
++#target: avr-*-*
++
++#...
++00000000 <__ctors_end>:
++   0:	ff cf       	rjmp	.-2      	; 0x0 <__ctors_end>
++   2:	fe df       	rcall	.-4      	; 0x0 <__ctors_end>
++   4:	f8 f7       	brcc	.-2      	; 0x4 <__ctors_end\+0x4>
++#...
+diff --git a/ld/testsuite/ld-avr/avr-prop-8.s b/ld/testsuite/ld-avr/avr-prop-8.s
+new file mode 100644
+index 0000000..34554f2
+--- /dev/null
++++ b/ld/testsuite/ld-avr/avr-prop-8.s
+@@ -0,0 +1,7 @@
++foo:
++	jmp foo
++	call foo
++.L1:
++	brsh .L1
++.p2align	1
++	nop
+-- 
+1.7.1
+

Copied: avr-binutils/repos/community-testing-x86_64/PKGBUILD (from rev 194037, avr-binutils/trunk/PKGBUILD)
===================================================================
--- community-testing-x86_64/PKGBUILD	                        (rev 0)
+++ community-testing-x86_64/PKGBUILD	2016-10-30 18:02:08 UTC (rev 194038)
@@ -0,0 +1,90 @@
+# $Id$
+# Maintainer: schuay <jakob.gruber at gmail.com>
+# Contributor: Brad Fanella <bradfanella at archlinux.us>
+# Contributor: Corrado Primier <bardo at aur.archlinux.org>
+# Contributor: danst0 <danst0 at west.de>
+
+# Build order: avr-binutils -> avr-gcc -> avr-libc
+
+pkgname=avr-binutils
+pkgver=2.27
+pkgrel=2
+pkgdesc="A set of programs to assemble and manipulate binary and object files for the AVR architecture"
+arch=('i686' 'x86_64')
+url="http://www.gnu.org/software/binutils/"
+license=('GPL')
+depends=('glibc>=2.17' 'zlib' 'binutils')
+options=('!distcc' '!ccache')
+source=(ftp://ftp.gnu.org/gnu/binutils/binutils-${pkgver}.tar.bz2{,.sig}
+        avr-size.patch
+        # fix for https://bugs.archlinux.org/task/49284
+        # from https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bf1865065f64af2f32798c0327143baf99634e8d
+        fix_relaxation.patch)
+sha1sums=('6e472ddae565a2b1447e6f2393809bb8799982cf'
+          'SKIP'
+          'b6d1ff7084b1f0a3fd2dee5383019ffb202e6c9a'
+          '3c43bc9d27ecb2773afd5859864bdfdb2706d7d7')
+validpgpkeys=('EAF1C276A747E9ED86210CBAC3126D3B4AE55E93')  # Tristan Gingold
+
+_builddir=binutils-build
+
+prepare() {
+    cd ${srcdir}/binutils-${pkgver}
+
+    # See https://bugs.archlinux.org/task/32504
+    # And https://bugs.archlinux.org/task/40986
+    patch -Np0 < ${srcdir}/avr-size.patch
+
+    patch -p1 < ${srcdir}/fix_relaxation.patch 
+
+    # https://bugs.archlinux.org/task/34629
+    sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" libiberty/configure
+
+    rm -rf ${srcdir}/${_builddir}
+    mkdir ${srcdir}/${_builddir}
+}
+
+build() {
+    cd ${srcdir}/binutils-${pkgver}
+
+    config_guess=$(./config.guess)
+
+    cd ${srcdir}/${_builddir}
+
+    ${srcdir}/binutils-${pkgver}/configure \
+        --prefix=/usr \
+        --with-lib-path=/usr/lib:/usr/local/lib \
+        --with-bugurl=https://bugs.archlinux.org/ \
+        --enable-ld=default \
+        --enable-gold \
+        --enable-plugins \
+        --enable-threads \
+        --with-pic \
+        --enable-shared \
+        --disable-werror \
+        --disable-multilib \
+        --build=${config_guess} \
+        --target=avr \
+        $CONFIGFLAG
+
+    # This checks the host environment and makes sure all the necessary tools are available to compile Binutils.
+    make configure-host
+
+    make tooldir=/usr
+}
+
+package() {
+    cd ${srcdir}/${_builddir}
+
+    make prefix=${pkgdir}/usr tooldir=${pkgdir}/usr install
+
+    for bin in ar as nm objcopy objdump ranlib strip readelf; do
+        rm -f ${pkgdir}/usr/bin/${bin}
+    done
+
+    for info in as bfd binutils gprof ld; do
+        mv ${pkgdir}/usr/share/info/${info}.info ${pkgdir}/usr/share/info/avr-${info}.info
+    done
+
+    rm -r ${pkgdir}/usr/share/locale
+}

Copied: avr-binutils/repos/community-testing-x86_64/avr-size.patch (from rev 194037, avr-binutils/trunk/avr-size.patch)
===================================================================
--- community-testing-x86_64/avr-size.patch	                        (rev 0)
+++ community-testing-x86_64/avr-size.patch	2016-10-30 18:02:08 UTC (rev 194038)
@@ -0,0 +1,523 @@
+AVR only; support -C for AVR memory usage
+
+Source: http://git.makehackvoid.com/cgi-bin/gitweb.cgi?p=mhvavrtools.git;a=blob_plain;f=mhvavrtools/patches/binutils-001-avr-size.patch;h=e80d28eae46217551d996a2253256c97d10aa4b5;hb=refs/heads/master
+===========================================================
+--- binutils/size.c	2007-08-06 13:56:14.000000000 -0600
++++ binutils/size.c	2007-09-13 09:13:10.281250000 -0600
+@@ -36,10 +36,31 @@
+ #include "getopt.h"
+ #include "bucomm.h"
+ 
+-#ifndef BSD_DEFAULT
+-#define BSD_DEFAULT 1
++typedef enum
++{
++    format_sysv = 0,
++    format_bsd = 1,
++    format_avr = 2,
++} format_type_t;
++
++
++/* Set the default format. */
++#define FORMAT_DEFAULT_SYSV 0
++#define FORMAT_DEFAULT_BSD 1
++#define FORMAT_DEFAULT_AVR 0
++
++#if FORMAT_DEFAULT_SYSV
++    #define FORMAT_DEFAULT format_sysv
++    #define FORMAT_NAME "sysv"
++#elif FORMAT_DEFAULT_BSD
++    #define FORMAT_DEFAULT format_bsd
++    #define FORMAT_NAME "berkeley"
++#elif FORMAT_DEFAULT_AVR
++    #define FORMAT_DEFAULT format_avr
++    #define FORMAT_NAME "avr"
+ #endif
+ 
++
+ /* Program options.  */
+ 
+ static enum
+@@ -48,9 +69,8 @@ static enum
+   }
+ radix = decimal;
+ 
+-/* 0 means use AT&T-style output.  */
+-static int berkeley_format = BSD_DEFAULT;
+ 
++format_type_t format = FORMAT_DEFAULT;
+ static int show_version = 0;
+ static int show_help = 0;
+ static int show_totals = 0;
+@@ -64,6 +84,246 @@ static bfd_size_type total_textsize;
+ /* Program exit status.  */
+ static int return_code = 0;
+ 
++
++/* AVR Size specific stuff */
++
++#define AVR64 64UL
++#define AVR128 128UL
++#define AVR256 256UL
++#define AVR512 512UL
++#define AVR1K 1024UL
++#define AVR2K 2048UL
++#define AVR4K 4096UL
++#define AVR8K 8192UL
++#define AVR16K 16384UL
++#define AVR20K 20480UL
++#define AVR24K 24576UL
++#define AVR32K 32768UL
++#define AVR36K 36864UL
++#define AVR40K 40960UL
++#define AVR64K 65536UL
++#define AVR68K 69632UL
++#define AVR128K 131072UL
++#define AVR136K 139264UL
++#define AVR200K 204800UL
++#define AVR256K 262144UL
++#define AVR264K 270336UL
++
++typedef struct
++{
++    char *name;
++	long flash;
++	long ram;
++	long eeprom;
++} avr_device_t;
++
++avr_device_t avr[] =
++{
++	{"atxmega256a3",  AVR264K, AVR16K, AVR4K},
++	{"atxmega256a3b", AVR264K, AVR16K, AVR4K},
++	{"atxmega256d3",  AVR264K, AVR16K, AVR4K},
++
++	{"atmega2560",    AVR256K, AVR8K,  AVR4K},
++	{"atmega2561",    AVR256K, AVR8K,  AVR4K},
++
++	{"atxmega192a3",  AVR200K, AVR16K, AVR2K},
++	{"atxmega192d3",  AVR200K, AVR16K, AVR2K},
++
++	{"atxmega128a1",  AVR136K, AVR8K,  AVR2K},
++	{"atxmega128a1u", AVR136K, AVR8K,  AVR2K},
++	{"atxmega128a3",  AVR136K, AVR8K,  AVR2K},
++	{"atxmega128d3",  AVR136K, AVR8K,  AVR2K},
++
++	{"at43usb320",    AVR128K, 608UL,  0UL},
++	{"at90can128",    AVR128K, AVR4K,  AVR4K},
++	{"at90usb1286",   AVR128K, AVR8K,  AVR4K},
++	{"at90usb1287",   AVR128K, AVR8K,  AVR4K},
++	{"atmega128",     AVR128K, AVR4K,  AVR4K},
++	{"atmega1280",    AVR128K, AVR8K,  AVR4K},
++	{"atmega1281",    AVR128K, AVR8K,  AVR4K},
++	{"atmega1284p",   AVR128K, AVR16K, AVR4K},
++	{"atmega128rfa1", AVR128K, AVR16K, AVR4K},
++	{"atmega103",     AVR128K, 4000UL, AVR4K},
++
++	{"atxmega64a1",   AVR68K,  AVR4K,  AVR2K},
++	{"atxmega64a1u",  AVR68K,  AVR4K,  AVR2K},
++	{"atxmega64a3",   AVR68K,  AVR4K,  AVR2K},
++	{"atxmega64d3",   AVR68K,  AVR4K,  AVR2K},
++
++	{"at90can64",     AVR64K,  AVR4K,  AVR2K},
++	{"at90scr100",    AVR64K,  AVR4K,  AVR2K},
++	{"at90usb646",    AVR64K,  AVR4K,  AVR2K},
++	{"at90usb647",    AVR64K,  AVR4K,  AVR2K},
++	{"atmega64",      AVR64K,  AVR4K,  AVR2K},
++	{"atmega640",     AVR64K,  AVR8K,  AVR4K},
++	{"atmega644",     AVR64K,  AVR4K,  AVR2K},
++	{"atmega644a",    AVR64K,  AVR4K,  AVR2K},
++	{"atmega644p",    AVR64K,  AVR4K,  AVR2K},
++	{"atmega644pa",   AVR64K,  AVR4K,  AVR2K},
++	{"atmega645",     AVR64K,  AVR4K,  AVR2K},
++	{"atmega645a",    AVR64K,  AVR4K,  AVR2K},
++	{"atmega645p",    AVR64K,  AVR4K,  AVR2K},
++	{"atmega6450",    AVR64K,  AVR4K,  AVR2K},
++	{"atmega6450a",   AVR64K,  AVR4K,  AVR2K},
++	{"atmega6450p",   AVR64K,  AVR4K,  AVR2K},
++	{"atmega649",     AVR64K,  AVR4K,  AVR2K},
++	{"atmega649a",    AVR64K,  AVR4K,  AVR2K},
++	{"atmega649p",    AVR64K,  AVR4K,  AVR2K},
++	{"atmega6490",    AVR64K,  AVR4K,  AVR2K},
++	{"atmega6490a",   AVR64K,  AVR4K,  AVR2K},
++	{"atmega6490p",   AVR64K,  AVR4K,  AVR2K},
++	{"atmega64c1",    AVR64K,  AVR4K,  AVR2K},
++	{"atmega64hve",   AVR64K,  AVR4K,  AVR1K},
++	{"atmega64m1",    AVR64K,  AVR4K,  AVR2K},
++   {"m3000",         AVR64K,  AVR4K,  0UL},
++
++	{"atmega406",     AVR40K,  AVR2K,  AVR512},
++
++	{"atxmega32a4",   AVR36K,  AVR4K,  AVR1K},
++	{"atxmega32d4",   AVR36K,  AVR4K,  AVR1K},
++
++	{"at90can32",     AVR32K,  AVR2K,  AVR1K},
++	{"at94k",         AVR32K,  AVR4K,  0UL},
++	{"atmega32",      AVR32K,  AVR2K,  AVR1K},
++	{"atmega323",     AVR32K,  AVR2K,  AVR1K},
++	{"atmega324a",    AVR32K,  AVR2K,  AVR1K},
++	{"atmega324p",    AVR32K,  AVR2K,  AVR1K},
++	{"atmega324pa",   AVR32K,  AVR2K,  AVR1K},
++	{"atmega325",     AVR32K,  AVR2K,  AVR1K},
++	{"atmega325a",    AVR32K,  AVR2K,  AVR1K},
++	{"atmega325p",    AVR32K,  AVR2K,  AVR1K},
++	{"atmega3250",    AVR32K,  AVR2K,  AVR1K},
++	{"atmega3250a",   AVR32K,  AVR2K,  AVR1K},
++	{"atmega3250p",   AVR32K,  AVR2K,  AVR1K},
++	{"atmega328",     AVR32K,  AVR2K,  AVR1K},
++	{"atmega328p",    AVR32K,  AVR2K,  AVR1K},
++	{"atmega329",     AVR32K,  AVR2K,  AVR1K},
++	{"atmega329a",    AVR32K,  AVR2K,  AVR1K},
++	{"atmega329p",    AVR32K,  AVR2K,  AVR1K},
++	{"atmega329pa",   AVR32K,  AVR2K,  AVR1K},
++	{"atmega3290",    AVR32K,  AVR2K,  AVR1K},
++	{"atmega3290a",   AVR32K,  AVR2K,  AVR1K},
++	{"atmega3290p",   AVR32K,  AVR2K,  AVR1K},
++	{"atmega32hvb",   AVR32K,  AVR2K,  AVR1K},
++	{"atmega32c1",    AVR32K,  AVR2K,  AVR1K},
++   {"atmega32hvb",   AVR32K,  AVR2K,  AVR1K},
++	{"atmega32m1",    AVR32K,  AVR2K,  AVR1K},
++	{"atmega32u2",    AVR32K,  AVR1K,  AVR1K},
++	{"atmega32u4",    AVR32K,  2560UL, AVR1K},
++	{"atmega32u6",    AVR32K,  2560UL, AVR1K},
++
++	{"at43usb355",    AVR24K,  1120UL,   0UL},
++
++	{"atxmega16a4",   AVR20K,  AVR2K,  AVR1K},
++	{"atxmega16d4",   AVR20K,  AVR2K,  AVR1K},
++
++	{"at76c711",      AVR16K,  AVR2K,  0UL},
++	{"at90pwm216",    AVR16K,  AVR1K,  AVR512},
++	{"at90pwm316",    AVR16K,  AVR1K,  AVR512},
++	{"at90usb162",    AVR16K,  AVR512, AVR512},
++	{"atmega16",      AVR16K,  AVR1K,  AVR512},
++	{"atmega16a",     AVR16K,  AVR1K,  AVR512},
++	{"atmega161",     AVR16K,  AVR1K,  AVR512},
++	{"atmega162",     AVR16K,  AVR1K,  AVR512},
++	{"atmega163",     AVR16K,  AVR1K,  AVR512},
++	{"atmega164",     AVR16K,  AVR1K,  AVR512},
++	{"atmega164a",    AVR16K,  AVR1K,  AVR512},
++	{"atmega164p",    AVR16K,  AVR1K,  AVR512},
++	{"atmega165a",    AVR16K,  AVR1K,  AVR512},
++	{"atmega165",     AVR16K,  AVR1K,  AVR512},
++	{"atmega165p",    AVR16K,  AVR1K,  AVR512},
++	{"atmega168",     AVR16K,  AVR1K,  AVR512},
++	{"atmega168a",    AVR16K,  AVR1K,  AVR512},
++	{"atmega168p",    AVR16K,  AVR1K,  AVR512},
++	{"atmega169",     AVR16K,  AVR1K,  AVR512},
++	{"atmega169a",    AVR16K,  AVR1K,  AVR512},
++	{"atmega169p",    AVR16K,  AVR1K,  AVR512},
++	{"atmega169pa",   AVR16K,  AVR1K,  AVR512},
++	{"atmega16hva",   AVR16K,  768UL,  AVR256},
++	{"atmega16hva2",  AVR16K,  AVR1K,  AVR256},
++   {"atmega16hvb",   AVR16K,  AVR1K,  AVR512},
++	{"atmega16m1",    AVR16K,  AVR1K,  AVR512},
++	{"atmega16u2",    AVR16K,  AVR512, AVR512},
++	{"atmega16u4",    AVR16K,  1280UL, AVR512},
++	{"attiny167",     AVR16K,  AVR512, AVR512},
++
++	{"at90c8534",     AVR8K,   352UL,  AVR512},
++	{"at90pwm1",      AVR8K,   AVR512, AVR512},
++	{"at90pwm2",      AVR8K,   AVR512, AVR512},
++	{"at90pwm2b",     AVR8K,   AVR512, AVR512},
++	{"at90pwm3",      AVR8K,   AVR512, AVR512},
++	{"at90pwm3b",     AVR8K,   AVR512, AVR512},
++	{"at90pwm81",     AVR8K,   AVR256, AVR512},
++	{"at90s8515",     AVR8K,   AVR512, AVR512},
++	{"at90s8535",     AVR8K,   AVR512, AVR512},
++	{"at90usb82",     AVR8K,   AVR512, AVR512},
++	{"ata6289",       AVR8K,   AVR512, 320UL},
++	{"atmega8",       AVR8K,   AVR1K,  AVR512},
++	{"atmega8515",    AVR8K,   AVR512, AVR512},
++	{"atmega8535",    AVR8K,   AVR512, AVR512},
++	{"atmega88",      AVR8K,   AVR1K,  AVR512},
++	{"atmega88a",     AVR8K,   AVR1K,  AVR512},
++	{"atmega88p",     AVR8K,   AVR1K,  AVR512},
++	{"atmega88pa",    AVR8K,   AVR1K,  AVR512},
++	{"atmega8hva",    AVR8K,   768UL,  AVR256},
++	{"atmega8u2",     AVR8K,   AVR512, AVR512},
++	{"attiny84",      AVR8K,   AVR512, AVR512},
++	{"attiny84a",     AVR8K,   AVR512, AVR512},
++	{"attiny85",      AVR8K,   AVR512, AVR512},
++	{"attiny861",     AVR8K,   AVR512, AVR512},
++	{"attiny861a",    AVR8K,   AVR512, AVR512},
++	{"attiny87",      AVR8K,   AVR512, AVR512},
++	{"attiny88",      AVR8K,   AVR512, AVR64},
++
++	{"at90s4414",     AVR4K,   352UL,  AVR256},
++	{"at90s4433",     AVR4K,   AVR128, AVR256},
++	{"at90s4434",     AVR4K,   352UL,  AVR256},
++	{"atmega48",      AVR4K,   AVR512, AVR256},
++	{"atmega48a",     AVR4K,   AVR512, AVR256},
++	{"atmega48p",     AVR4K,   AVR512, AVR256},
++	{"attiny4313",    AVR4K,   AVR256, AVR256},
++	{"attiny43u",     AVR4K,   AVR256, AVR64},
++	{"attiny44",      AVR4K,   AVR256, AVR256},
++	{"attiny44a",     AVR4K,   AVR256, AVR256},
++	{"attiny45",      AVR4K,   AVR256, AVR256},
++	{"attiny461",     AVR4K,   AVR256, AVR256},
++	{"attiny461a",    AVR4K,   AVR256, AVR256},
++	{"attiny48",      AVR4K,   AVR256, AVR64},
++
++	{"at86rf401",     AVR2K,   224UL,  AVR128},
++	{"at90s2313",     AVR2K,   AVR128, AVR128},
++	{"at90s2323",     AVR2K,   AVR128, AVR128},
++	{"at90s2333",     AVR2K,   224UL,  AVR128},
++	{"at90s2343",     AVR2K,   AVR128, AVR128},
++   {"attiny20",      AVR2K,   AVR128, 0UL},
++	{"attiny22",      AVR2K,   224UL,  AVR128},
++	{"attiny2313",    AVR2K,   AVR128, AVR128},
++	{"attiny2313a",   AVR2K,   AVR128, AVR128},
++	{"attiny24",      AVR2K,   AVR128, AVR128},
++	{"attiny24a",     AVR2K,   AVR128, AVR128},
++	{"attiny25",      AVR2K,   AVR128, AVR128},
++	{"attiny26",      AVR2K,   AVR128, AVR128},
++	{"attiny261",     AVR2K,   AVR128, AVR128},
++	{"attiny261a",    AVR2K,   AVR128, AVR128},
++	{"attiny28",      AVR2K,   0UL,    0UL},
++   {"attiny40",      AVR2K,   AVR256, 0UL},
++
++	{"at90s1200",     AVR1K,   0UL,    AVR64},
++   {"attiny9",       AVR1K,   32UL,   0UL},
++   {"attiny10",      AVR1K,   32UL,   0UL},
++	{"attiny11",      AVR1K,   0UL,    AVR64},
++	{"attiny12",      AVR1K,   0UL,    AVR64},
++	{"attiny13",      AVR1K,   AVR64,  AVR64},
++	{"attiny13a",     AVR1K,   AVR64,  AVR64},
++	{"attiny15",      AVR1K,   0UL,    AVR64},
++
++   {"attiny4",       AVR512,  32UL,   0UL},
++   {"attiny5",       AVR512,  32UL,   0UL},
++};
++
++static char *avrmcu = NULL;
++
++
+ static char *target = NULL;
+ 
+ /* Forward declarations.  */
+@@ -79,7 +337,8 @@ usage (FILE *stream, int status)
+   fprintf (stream, _(" Displays the sizes of sections inside binary files\n"));
+   fprintf (stream, _(" If no input file(s) are specified, a.out is assumed\n"));
+   fprintf (stream, _(" The options are:\n\
+-  -A|-B     --format={sysv|berkeley}  Select output style (default is %s)\n\
++  -A|-B|-C  --format={sysv|berkeley|avr}  Select output style (default is %s)\n\
++            --mcu=<avrmcu>            MCU name for AVR format only\n\
+   -o|-d|-x  --radix={8|10|16}         Display numbers in octal, decimal or hex\n\
+   -t        --totals                  Display the total sizes (Berkeley only)\n\
+             --common                  Display total size for *COM* syms\n\
+@@ -88,11 +337,7 @@ usage (FILE *stream, int status)
+   -h        --help                    Display this information\n\
+   -v        --version                 Display the program's version\n\
+ \n"),
+-#if BSD_DEFAULT
+-  "berkeley"
+-#else
+-  "sysv"
+-#endif
++FORMAT_NAME
+ );
+   list_supported_targets (program_name, stream);
+   if (REPORT_BUGS_TO[0] && status == 0)
+@@ -103,6 +359,7 @@ usage (FILE *stream, int status)
+ #define OPTION_FORMAT (200)
+ #define OPTION_RADIX (OPTION_FORMAT + 1)
+ #define OPTION_TARGET (OPTION_RADIX + 1)
++#define OPTION_MCU (OPTION_TARGET + 1) 
+ 
+ static struct option long_options[] =
+ {
+@@ -110,6 +368,7 @@ static struct option long_options[] =
+   {"format", required_argument, 0, OPTION_FORMAT},
+   {"radix", required_argument, 0, OPTION_RADIX},
+   {"target", required_argument, 0, OPTION_TARGET},
++  {"mcu", required_argument, 0, 203},
+   {"totals", no_argument, &show_totals, 1},
+   {"version", no_argument, &show_version, 1},
+   {"help", no_argument, &show_help, 1},
+@@ -141,7 +399,7 @@ main (int argc, char **argv)
+   bfd_init ();
+   set_default_bfd_target ();
+ 
+-  while ((c = getopt_long (argc, argv, "ABHhVvdfotx", long_options,
++  while ((c = getopt_long (argc, argv, "ABCHhVvdfotx", long_options,
+ 			   (int *) 0)) != EOF)
+     switch (c)
+       {
+@@ -150,11 +409,15 @@ main (int argc, char **argv)
+ 	  {
+ 	  case 'B':
+ 	  case 'b':
+-	    berkeley_format = 1;
++	    format = format_bsd;
+ 	    break;
+ 	  case 'S':
+ 	  case 's':
+-	    berkeley_format = 0;
++	    format = format_sysv;
++	    break;
++	  case 'A':
++	  case 'a':
++	    format = format_avr;
+ 	    break;
+ 	  default:
+ 	    non_fatal (_("invalid argument to --format: %s"), optarg);
+@@ -162,6 +424,10 @@ main (int argc, char **argv)
+ 	  }
+ 	break;
+ 
++      case OPTION_MCU:
++	avrmcu = optarg;
++	break;
++
+       case OPTION_TARGET:
+ 	target = optarg;
+ 	break;
+@@ -190,11 +457,14 @@ main (int argc, char **argv)
+ 	break;
+ 
+       case 'A':
+-	berkeley_format = 0;
++	format = format_sysv;
+ 	break;
+       case 'B':
+-	berkeley_format = 1;
++	format = format_bsd;
+ 	break;
++      case 'C':
++    format = format_avr;
++    break;
+       case 'v':
+       case 'V':
+ 	show_version = 1;
+@@ -240,7 +509,7 @@ main (int argc, char **argv)
+     for (; optind < argc;)
+       display_file (argv[optind++]);
+ 
+-  if (show_totals && berkeley_format)
++  if (show_totals && format == format_bsd)
+     {
+       bfd_size_type total = total_textsize + total_datasize + total_bsssize;
+ 
+@@ -599,13 +869,117 @@ print_sysv_format (bfd *file)
+   printf ("\n\n");
+ }
+ 
++
++static avr_device_t *
++avr_find_device (void)
++{
++  unsigned int i;
++  if (avrmcu != NULL)
++  {
++    for (i = 0; i < sizeof(avr) / sizeof(avr[0]); i++)
++    {
++      if (strcmp(avr[i].name, avrmcu) == 0)
++      {
++        /* Match found */
++        return (&avr[i]);
++      }
++    }
++  }
++  return (NULL);
++}
++
++
++
++static void
++print_avr_format (bfd *file)
++{
++  char *avr_name = "Unknown";
++  int flashmax = 0;
++  int rammax = 0;
++  int eeprommax = 0;
++  asection *section; 
++  bfd_size_type my_datasize = 0;
++  bfd_size_type my_textsize = 0;
++  bfd_size_type my_bsssize = 0;
++  bfd_size_type bootloadersize = 0;
++  bfd_size_type noinitsize = 0;
++  bfd_size_type eepromsize = 0;
++
++  avr_device_t *avrdevice = avr_find_device();
++  if (avrdevice != NULL)
++  {
++    avr_name = avrdevice->name;
++    flashmax = avrdevice->flash;
++    rammax = avrdevice->ram;
++    eeprommax = avrdevice->eeprom;
++  }
++
++  if ((section = bfd_get_section_by_name (file, ".data")) != NULL)
++    my_datasize = bfd_section_size (file, section);
++  if ((section = bfd_get_section_by_name (file, ".text")) != NULL)
++    my_textsize = bfd_section_size (file, section);
++  if ((section = bfd_get_section_by_name (file, ".bss")) != NULL)
++    my_bsssize = bfd_section_size (file, section);
++  if ((section = bfd_get_section_by_name (file, ".bootloader")) != NULL)
++    bootloadersize = bfd_section_size (file, section);
++  if ((section = bfd_get_section_by_name (file, ".noinit")) != NULL)
++    noinitsize = bfd_section_size (file, section);
++  if ((section = bfd_get_section_by_name (file, ".eeprom")) != NULL)
++    eepromsize = bfd_section_size (file, section);
++  
++  bfd_size_type text = my_textsize + my_datasize + bootloadersize;
++  bfd_size_type data = my_datasize + my_bsssize + noinitsize;
++  bfd_size_type eeprom = eepromsize;
++  
++  printf ("AVR Memory Usage\n"
++          "----------------\n"
++          "Device: %s\n\n", avr_name);
++  
++  /* Text size */
++  printf ("Program:%8ld bytes", text);
++  if (flashmax > 0)
++  {
++    printf (" (%2.1f%% Full)", ((float)text / flashmax) * 100);
++  }
++  printf ("\n(.text + .data + .bootloader)\n\n");
++  
++  /* Data size */
++  printf ("Data:   %8ld bytes", data);
++  if (rammax > 0)
++  {
++    printf (" (%2.1f%% Full)", ((float)data / rammax) * 100);
++  }
++  printf ("\n(.data + .bss + .noinit)\n\n");
++  
++  /* EEPROM size */
++  if (eeprom > 0) 
++  { 
++    printf ("EEPROM: %8ld bytes", eeprom);
++    if (eeprommax > 0)
++    {
++      printf (" (%2.1f%% Full)", ((float)eeprom / eeprommax) * 100);
++    }
++    printf ("\n(.eeprom)\n\n");
++  }
++}
++
++
+ static void
+ print_sizes (bfd *file)
+ {
+   if (show_common)
+     calculate_common_size (file);
+-  if (berkeley_format)
+-    print_berkeley_format (file);
+-  else
+-    print_sysv_format (file);
++  switch (format)
++  {
++    case format_sysv:
++      print_sysv_format (file);
++      break;
++    case format_bsd:
++      print_berkeley_format (file);
++      break;
++    case format_avr:
++    default:
++      print_avr_format (file);
++      break;
++  }
+ }

Copied: avr-binutils/repos/community-testing-x86_64/fix_relaxation.patch (from rev 194037, avr-binutils/trunk/fix_relaxation.patch)
===================================================================
--- community-testing-x86_64/fix_relaxation.patch	                        (rev 0)
+++ community-testing-x86_64/fix_relaxation.patch	2016-10-30 18:02:08 UTC (rev 194038)
@@ -0,0 +1,256 @@
+From bf1865065f64af2f32798c0327143baf99634e8d Mon Sep 17 00:00:00 2001
+From: Senthil Kumar Selvaraj <senthil_kumar.selvaraj at atmel.com>
+Date: Tue, 6 Sep 2016 12:28:37 +0530
+Subject: [PATCH] Fix PR ld/20545 - relaxation bugs in avr backend
+
+Prior to the patch, addends for relocs were being adjusted even if
+they went beyond an alignment boundary. This is wrong - to
+preserve alignment constraints, the relaxation logic adds as many padding
+bytes at the alignment boundary as was deleted, so addends beyond the
+boundary should not be adjusted. avr-prop-7.s reproduces this
+scenario.
+
+Also, prior to this patch, the relaxation logic assumed that the addr
+parameter pointed to the middle of the instruction to be deleted, and
+that addr - count would therefore be the shrinked instruction's
+address. This is true when actually shrinking instructions.
+
+The alignment constraints handling logic also invokes the same logic
+though, with addr as the starting offset of padding bytes and
+with count as the number of bytes to be deleted. Calculating the
+shrinked insn's address as addr - count is obviously wrong in this
+case - that offset would point to count bytes before the last
+non-padded byte. avr-prop-8.s reproduces this scenario.
+
+To fix scenario 1, the patch adds an additional check to ensure reloc addends
+aren't adjusted if they cross a shrink boundary. The shrink boundary
+is either the section size or an alignment boundary. Addends pointing
+at an alignment boundary don't need to be adjusted, as padding would
+occur and keep the boundary the same. Addends pointing at section size
+need to be adjusted though, as no padding occurs and the section size
+itself would get decremented. The patch records whether padding
+occured (did_pad) and uses that to detect and handle this condition.
+
+To fix scenario 2, the patch adds an additional parameter
+(delete_shrinks_insn) to elf32_avr_relax_delete_bytes to distinguish
+instruction bytes deletion from padding bytes deletion. It then uses that to
+correctly set shrinked_insn_address.
+
+bfd/ChangeLog:
+
+2016-09-02  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj at atmel.com>
+
+	PR ld/20545
+	* elf32-avr.c (elf32_avr_relax_delete_bytes): Add parameter
+	delete_shrinks_insn. Modify computation of shrinked_insn_address.
+	Compute shrink_boundary and adjust addend only if
+	addend_within_shrink_boundary.
+	(elf32_avr_relax_section): Modify calls to
+	elf32_avr_relax_delete_bytes to pass extra parameter.
+
+ld/ChangeLog:
+
+2016-09-02  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj at atmel.com>
+
+	PR ld/20545
+	* testsuite/ld-avr/avr-prop-7.d: New test.
+	* testsuite/ld-avr/avr-prop-7.s: New test.
+	* testsuite/ld-avr/avr-prop-8.d: New test.
+	* testsuite/ld-avr/avr-prop-8.s: New test.
+---
+ bfd/ChangeLog                    |   10 +++++++++
+ bfd/elf32-avr.c                  |   40 +++++++++++++++++++++++++++++++------
+ ld/ChangeLog                     |    8 +++++++
+ ld/testsuite/ld-avr/avr-prop-7.d |   15 ++++++++++++++
+ ld/testsuite/ld-avr/avr-prop-7.s |    8 +++++++
+ ld/testsuite/ld-avr/avr-prop-8.d |   13 ++++++++++++
+ ld/testsuite/ld-avr/avr-prop-8.s |    7 ++++++
+ 7 files changed, 94 insertions(+), 7 deletions(-)
+ create mode 100644 ld/testsuite/ld-avr/avr-prop-7.d
+ create mode 100644 ld/testsuite/ld-avr/avr-prop-7.s
+ create mode 100644 ld/testsuite/ld-avr/avr-prop-8.d
+ create mode 100644 ld/testsuite/ld-avr/avr-prop-8.s
+
+diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c
+index a0a5c69..eea76a4 100644
+--- a/bfd/elf32-avr.c
++++ b/bfd/elf32-avr.c
+@@ -1808,13 +1808,17 @@ elf32_avr_adjust_diff_reloc_value (bfd *abfd,
+ /* Delete some bytes from a section while changing the size of an instruction.
+    The parameter "addr" denotes the section-relative offset pointing just
+    behind the shrinked instruction. "addr+count" point at the first
+-   byte just behind the original unshrinked instruction.  */
++   byte just behind the original unshrinked instruction. If delete_shrinks_insn
++   is FALSE, we are deleting redundant padding bytes from relax_info prop
++   record handling. In that case, addr is section-relative offset of start
++   of padding, and count is the number of padding bytes to delete. */
+ 
+ static bfd_boolean
+ elf32_avr_relax_delete_bytes (bfd *abfd,
+                               asection *sec,
+                               bfd_vma addr,
+-                              int count)
++                              int count,
++                              bfd_boolean delete_shrinks_insn)
+ {
+   Elf_Internal_Shdr *symtab_hdr;
+   unsigned int sec_shndx;
+@@ -1829,6 +1833,7 @@ elf32_avr_relax_delete_bytes (bfd *abfd,
+   struct avr_relax_info *relax_info;
+   struct avr_property_record *prop_record = NULL;
+   bfd_boolean did_shrink = FALSE;
++  bfd_boolean did_pad = FALSE;
+ 
+   symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+   sec_shndx = _bfd_elf_section_from_bfd_section (abfd, sec);
+@@ -1909,6 +1914,7 @@ elf32_avr_relax_delete_bytes (bfd *abfd,
+          to remember we didn't delete anything i.e. don't set did_shrink,
+          so that we don't corrupt reloc offsets or symbol values.*/
+       memset (contents + toaddr - count, fill, count);
++      did_pad = TRUE;
+ 
+       /* Adjust the TOADDR to avoid moving symbols located at the address
+          of the property record, which has not moved.  */
+@@ -1965,7 +1971,9 @@ elf32_avr_relax_delete_bytes (bfd *abfd,
+ 	 continue;
+ 
+        shrinked_insn_address = (sec->output_section->vma
+-                                + sec->output_offset + addr - count);
++                                + sec->output_offset + addr);
++       if (delete_shrinks_insn)
++         shrinked_insn_address -= count;
+ 
+        irel = elf_section_data (isec)->relocs;
+        /* PR 12161: Read in the relocs for this section if necessary.  */
+@@ -2002,6 +2010,13 @@ elf32_avr_relax_delete_bytes (bfd *abfd,
+                   a symbol or section associated with it.  */
+                if (sym_sec == sec)
+                  {
++                   /* If there is an alignment boundary, we only need to
++                      adjust addends that end up below the boundary. */
++                   bfd_vma shrink_boundary = (reloc_toaddr
++                                              + sec->output_section->vma
++                                              + sec->output_offset);
++                   bfd_boolean addend_within_shrink_boundary = FALSE;
++
+                    symval += sym_sec->output_section->vma
+                              + sym_sec->output_offset;
+ 
+@@ -2015,8 +2030,17 @@ elf32_avr_relax_delete_bytes (bfd *abfd,
+                              (unsigned int) (symval + irel->r_addend),
+                              (unsigned int) shrinked_insn_address);
+ 
++                   /* If we padded bytes, then the boundary didn't change,
++                      so there's no need to adjust addends pointing at the boundary.
++                      If we didn't pad, then we actually shrank the boundary, so
++                      addends pointing at the boundary need to be adjusted too. */
++                    addend_within_shrink_boundary = did_pad
++                      ? ((symval + irel->r_addend) < shrink_boundary)
++                      : ((symval + irel->r_addend) <= shrink_boundary);
++
+                    if (symval <= shrinked_insn_address
+-                       && (symval + irel->r_addend) > shrinked_insn_address)
++                       && (symval + irel->r_addend) > shrinked_insn_address
++                       && addend_within_shrink_boundary)
+                      {
+                        if (elf32_avr_is_diff_reloc (irel))
+                          {
+@@ -2648,7 +2672,8 @@ elf32_avr_relax_section (bfd *abfd,
+                   {
+                     /* Delete two bytes of data.  */
+                     if (!elf32_avr_relax_delete_bytes (abfd, sec,
+-                                                       irel->r_offset + 2, 2))
++                                                       irel->r_offset + 2, 2,
++                                                       TRUE))
+                       goto error_return;
+ 
+                     /* That will change things, so, we should relax again.
+@@ -2972,7 +2997,8 @@ elf32_avr_relax_section (bfd *abfd,
+ 
+ 			    /* Delete two bytes of data.  */
+ 			    if (!elf32_avr_relax_delete_bytes (abfd, sec,
+-							       irel->r_offset + insn_size, 2))
++							       irel->r_offset + insn_size, 2,
++							       TRUE))
+ 			      goto error_return;
+ 
+ 			    /* That will change things, so, we should relax
+@@ -3040,7 +3066,7 @@ elf32_avr_relax_section (bfd *abfd,
+                         record->offset -= count;
+                         elf32_avr_relax_delete_bytes (abfd, sec,
+                                                       addr - count,
+-                                                      count);
++                                                      count, FALSE);
+                         *again = TRUE;
+                       }
+                   }
+diff --git a/ld/testsuite/ld-avr/avr-prop-7.d b/ld/testsuite/ld-avr/avr-prop-7.d
+new file mode 100644
+index 0000000..9f2cea9
+--- /dev/null
++++ b/ld/testsuite/ld-avr/avr-prop-7.d
+@@ -0,0 +1,15 @@
++#name: AVR .avr.prop, AVR_7_PCREL after align
++#as: -mavrxmega2 -mlink-relax
++#ld: -mavrxmega2 --relax
++#source: avr-prop-7.s
++#objdump: -S
++#target: avr-*-*
++
++#...
++00000000 <__ctors_end>:
++   0:	04 d0       	rcall	.+8      	; 0xa <foo>
++   2:	00 00       	nop
++   4:	00 00       	nop
++   6:	86 e0       	ldi	r24, 0x06	; 6
++   8:	f0 f7       	brcc	.-4      	; 0x6 <__ctors_end\+0x6>
++#...
+diff --git a/ld/testsuite/ld-avr/avr-prop-7.s b/ld/testsuite/ld-avr/avr-prop-7.s
+new file mode 100644
+index 0000000..38276ba
+--- /dev/null
++++ b/ld/testsuite/ld-avr/avr-prop-7.s
+@@ -0,0 +1,8 @@
++	call foo
++	nop
++	.p2align	1
++        nop
++.L618:
++	ldi r24,lo8(6)
++	brsh .L618
++foo:    nop
+diff --git a/ld/testsuite/ld-avr/avr-prop-8.d b/ld/testsuite/ld-avr/avr-prop-8.d
+new file mode 100644
+index 0000000..2905f98
+--- /dev/null
++++ b/ld/testsuite/ld-avr/avr-prop-8.d
+@@ -0,0 +1,13 @@
++#name: AVR .avr.prop, AVR_7_PCREL just before align
++#as: -mavrxmega2 -mlink-relax
++#ld: -mavrxmega2 --relax
++#source: avr-prop-8.s
++#objdump: -S
++#target: avr-*-*
++
++#...
++00000000 <__ctors_end>:
++   0:	ff cf       	rjmp	.-2      	; 0x0 <__ctors_end>
++   2:	fe df       	rcall	.-4      	; 0x0 <__ctors_end>
++   4:	f8 f7       	brcc	.-2      	; 0x4 <__ctors_end\+0x4>
++#...
+diff --git a/ld/testsuite/ld-avr/avr-prop-8.s b/ld/testsuite/ld-avr/avr-prop-8.s
+new file mode 100644
+index 0000000..34554f2
+--- /dev/null
++++ b/ld/testsuite/ld-avr/avr-prop-8.s
+@@ -0,0 +1,7 @@
++foo:
++	jmp foo
++	call foo
++.L1:
++	brsh .L1
++.p2align	1
++	nop
+-- 
+1.7.1
+



More information about the arch-commits mailing list