[arch-commits] Commit in avr-binutils/trunk (PKGBUILD avr-size.patch)
Anatol Pomozov
anatolik at archlinux.org
Sun Oct 13 20:12:25 UTC 2019
Date: Sunday, October 13, 2019 @ 20:12:24
Author: anatolik
Revision: 515328
upgpkg: avr-binutils 2.33.1-1
Modified:
avr-binutils/trunk/PKGBUILD
avr-binutils/trunk/avr-size.patch
----------------+
PKGBUILD | 4 -
avr-size.patch | 205 ++++++++++++++++---------------------------------------
2 files changed, 62 insertions(+), 147 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2019-10-13 19:45:43 UTC (rev 515327)
+++ PKGBUILD 2019-10-13 20:12:24 UTC (rev 515328)
@@ -18,7 +18,7 @@
avr-size.patch)
sha1sums=('332c7df7e1830c1e756cf4a5542a7952200210c1'
'SKIP'
- 'b6d1ff7084b1f0a3fd2dee5383019ffb202e6c9a')
+ '7ec726441f086bf13142884901a6eb8d571f53ae')
validpgpkeys=('EAF1C276A747E9ED86210CBAC3126D3B4AE55E93' # Tristan Gingold <gingold at adacore.com>
'3A24BC1E8FB409FA9F14371813FCEF89DD9E3C4F') # Nick Clifton (Chief Binutils Maintainer) <nickc at redhat.com>
@@ -29,7 +29,7 @@
# See https://bugs.archlinux.org/task/32504
# And https://bugs.archlinux.org/task/40986
- patch -Np0 < ${srcdir}/avr-size.patch
+ patch -p1 < ${srcdir}/avr-size.patch
# https://bugs.archlinux.org/task/34629
sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" libiberty/configure
Modified: avr-size.patch
===================================================================
--- avr-size.patch 2019-10-13 19:45:43 UTC (rev 515327)
+++ avr-size.patch 2019-10-13 20:12:24 UTC (rev 515328)
@@ -1,55 +1,18 @@
-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;
+diff --git a/binutils/size.c b/binutils/size.c
+index 479a464887..f0b38e66a6 100644
+--- a/binutils/size.c
++++ b/binutils/size.c
+@@ -51,7 +51,8 @@ enum output_format
+ {
+ FORMAT_BERKLEY,
+ FORMAT_SYSV,
+- FORMAT_GNU
++ FORMAT_GNU,
++ FORMAT_AVR
+ };
+ static enum output_format selected_output_format =
+ #if BSD_DEFAULT
+@@ -74,6 +75,246 @@ static bfd_size_type total_textsize;
/* Program exit status. */
static int return_code = 0;
@@ -144,7 +107,7 @@
+ {"atmega64c1", AVR64K, AVR4K, AVR2K},
+ {"atmega64hve", AVR64K, AVR4K, AVR1K},
+ {"atmega64m1", AVR64K, AVR4K, AVR2K},
-+ {"m3000", AVR64K, AVR4K, 0UL},
++ {"m3000", AVR64K, AVR4K, 0UL},
+
+ {"atmega406", AVR40K, AVR2K, AVR512},
+
@@ -175,7 +138,7 @@
+ {"atmega3290p", AVR32K, AVR2K, AVR1K},
+ {"atmega32hvb", AVR32K, AVR2K, AVR1K},
+ {"atmega32c1", AVR32K, AVR2K, AVR1K},
-+ {"atmega32hvb", AVR32K, AVR2K, AVR1K},
++ {"atmega32hvb", AVR32K, AVR2K, AVR1K},
+ {"atmega32m1", AVR32K, AVR2K, AVR1K},
+ {"atmega32u2", AVR32K, AVR1K, AVR1K},
+ {"atmega32u4", AVR32K, 2560UL, AVR1K},
@@ -210,7 +173,7 @@
+ {"atmega169pa", AVR16K, AVR1K, AVR512},
+ {"atmega16hva", AVR16K, 768UL, AVR256},
+ {"atmega16hva2", AVR16K, AVR1K, AVR256},
-+ {"atmega16hvb", AVR16K, AVR1K, AVR512},
++ {"atmega16hvb", AVR16K, AVR1K, AVR512},
+ {"atmega16m1", AVR16K, AVR1K, AVR512},
+ {"atmega16u2", AVR16K, AVR512, AVR512},
+ {"atmega16u4", AVR16K, 1280UL, AVR512},
@@ -264,7 +227,7 @@
+ {"at90s2323", AVR2K, AVR128, AVR128},
+ {"at90s2333", AVR2K, 224UL, AVR128},
+ {"at90s2343", AVR2K, AVR128, AVR128},
-+ {"attiny20", AVR2K, AVR128, 0UL},
++ {"attiny20", AVR2K, AVR128, 0UL},
+ {"attiny22", AVR2K, 224UL, AVR128},
+ {"attiny2313", AVR2K, AVR128, AVR128},
+ {"attiny2313a", AVR2K, AVR128, AVR128},
@@ -275,11 +238,11 @@
+ {"attiny261", AVR2K, AVR128, AVR128},
+ {"attiny261a", AVR2K, AVR128, AVR128},
+ {"attiny28", AVR2K, 0UL, 0UL},
-+ {"attiny40", AVR2K, AVR256, 0UL},
++ {"attiny40", AVR2K, AVR256, 0UL},
+
+ {"at90s1200", AVR1K, 0UL, AVR64},
-+ {"attiny9", AVR1K, 32UL, 0UL},
-+ {"attiny10", AVR1K, 32UL, 0UL},
++ {"attiny9", AVR1K, 32UL, 0UL},
++ {"attiny10", AVR1K, 32UL, 0UL},
+ {"attiny11", AVR1K, 0UL, AVR64},
+ {"attiny12", AVR1K, 0UL, AVR64},
+ {"attiny13", AVR1K, AVR64, AVR64},
@@ -286,8 +249,8 @@
+ {"attiny13a", AVR1K, AVR64, AVR64},
+ {"attiny15", AVR1K, 0UL, AVR64},
+
-+ {"attiny4", AVR512, 32UL, 0UL},
-+ {"attiny5", AVR512, 32UL, 0UL},
++ {"attiny4", AVR512, 32UL, 0UL},
++ {"attiny5", AVR512, 32UL, 0UL},
+};
+
+static char *avrmcu = NULL;
@@ -296,38 +259,25 @@
static char *target = NULL;
/* Forward declarations. */
-@@ -79,7 +337,8 @@ usage (FILE *stream, int status)
+@@ -89,7 +330,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\
+- -A|-B|-G --format={sysv|berkeley|gnu} Select output style (default is %s)\n\
++ -A|-B|-G|-C --format={sysv|berkeley|gnu|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)
+@@ -113,6 +355,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)
++#define OPTION_MCU (OPTION_TARGET + 1)
static struct option long_options[] =
{
-@@ -110,6 +368,7 @@ static struct option long_options[] =
+@@ -120,6 +363,7 @@ static struct option long_options[] =
{"format", required_argument, 0, OPTION_FORMAT},
{"radix", required_argument, 0, OPTION_RADIX},
{"target", required_argument, 0, OPTION_TARGET},
@@ -335,34 +285,26 @@
{"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 ();
+@@ -153,7 +397,7 @@ main (int argc, char **argv)
+ fatal (_("fatal error: libbfd ABI mismatch"));
set_default_bfd_target ();
-- while ((c = getopt_long (argc, argv, "ABHhVvdfotx", long_options,
-+ while ((c = getopt_long (argc, argv, "ABCHhVvdfotx", long_options,
+- while ((c = getopt_long (argc, argv, "ABGHhVvdfotx", long_options,
++ while ((c = getopt_long (argc, argv, "ABCGHhVvdfotx", 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;
+@@ -172,12 +416,20 @@ main (int argc, char **argv)
+ case 'g':
+ selected_output_format = FORMAT_GNU;
break;
- case 'S':
- case 's':
-- berkeley_format = 0;
-+ format = format_sysv;
-+ break;
+ case 'A':
+ case 'a':
-+ format = format_avr;
- break;
++ selected_output_format = FORMAT_AVR;
++ break;
default:
non_fatal (_("invalid argument to --format: %s"), optarg);
-@@ -162,6 +424,10 @@ main (int argc, char **argv)
+ usage (stderr, 1);
}
break;
@@ -373,33 +315,17 @@
case OPTION_TARGET:
target = optarg;
break;
-@@ -190,11 +457,14 @@ main (int argc, char **argv)
+@@ -214,6 +466,9 @@ main (int argc, char **argv)
+ case 'G':
+ selected_output_format = FORMAT_GNU;
break;
-
- case 'A':
-- berkeley_format = 0;
-+ format = format_sysv;
- break;
- case 'B':
-- berkeley_format = 1;
-+ format = format_bsd;
- break;
+ case 'C':
-+ format = format_avr;
++ selected_output_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)
+@@ -648,6 +903,101 @@ print_sysv_format (bfd *file)
printf ("\n\n");
}
@@ -431,7 +357,7 @@
+ int flashmax = 0;
+ int rammax = 0;
+ int eeprommax = 0;
-+ asection *section;
++ asection *section;
+ bfd_size_type my_datasize = 0;
+ bfd_size_type my_textsize = 0;
+ bfd_size_type my_bsssize = 0;
@@ -460,15 +386,15 @@
+ 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)
@@ -476,7 +402,7 @@
+ 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)
@@ -484,10 +410,10 @@
+ printf (" (%2.1f%% Full)", ((float)data / rammax) * 100);
+ }
+ printf ("\n(.data + .bss + .noinit)\n\n");
-+
++
+ /* EEPROM size */
-+ if (eeprom > 0)
-+ {
++ if (eeprom > 0)
++ {
+ printf ("EEPROM: %8ld bytes", eeprom);
+ if (eeprommax > 0)
+ {
@@ -501,23 +427,12 @@
static void
print_sizes (bfd *file)
{
- if (show_common)
+@@ -655,6 +1005,8 @@ print_sizes (bfd *file)
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;
-+ }
+ if (selected_output_format == FORMAT_SYSV)
+ print_sysv_format (file);
++ else if (selected_output_format == FORMAT_AVR)
++ print_avr_format (file);
+ else
+ print_berkeley_or_gnu_format (file);
}
More information about the arch-commits
mailing list