From c6a3cb185419a15a0fa9e6645af947c65e90305b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krystian=20Bac=C5=82awski?= Date: Fri, 17 Feb 2012 23:15:33 -0800 Subject: [PATCH] Fixed crashing m68k-amigaos-ar. --- bootstrap.sh | 5 --- patches/binutils-2.9.1/bfd/archive.c.diff | 38 +++++++++++++++++++++++ 2 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 patches/binutils-2.9.1/bfd/archive.c.diff diff --git a/bootstrap.sh b/bootstrap.sh index ccac68f..94ad4f4 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -265,11 +265,6 @@ function build_ixemul { } function build { - # Strangely enough - this trick is needed in order to make m68k-amigaos-ar - # not to crash during libgcc compilation. It's difficult to say what exactly - # is affected by this change. Nevertheless, build succeeds under gcc 4.4.3. - export CC="gcc" - prepare_target unpack_sources build_tools diff --git a/patches/binutils-2.9.1/bfd/archive.c.diff b/patches/binutils-2.9.1/bfd/archive.c.diff new file mode 100644 index 0000000..8ab2b54 --- /dev/null +++ b/patches/binutils-2.9.1/bfd/archive.c.diff @@ -0,0 +1,38 @@ +--- binutils-2.9.1/bfd/archive.c 2012-02-17 23:00:06.554906216 -0800 ++++ binutils-2.9.1/bfd/archive.c 2012-02-17 23:00:15.694832573 -0800 +@@ -1374,7 +1374,7 @@ + sprintf ((hdr->ar_uid), "%ld", (long) status.st_uid); + sprintf ((hdr->ar_gid), "%ld", (long) status.st_gid); + sprintf ((hdr->ar_mode), "%-8o", (unsigned int) status.st_mode); +- sprintf ((hdr->ar_size), "%-10ld", (long) status.st_size); ++ sprintf ((hdr->ar_size), "%-9ld", (long) status.st_size); + /* Correct for a lossage in sprintf whereby it null-terminates. I cannot + understand how these C losers could design such a ramshackle bunch of + IO operations */ +@@ -1634,7 +1634,7 @@ + memset ((char *) (&hdr), 0, sizeof (struct ar_hdr)); + strcpy (hdr.ar_name, ename); + /* Round size up to even number in archive header. */ +- sprintf (&(hdr.ar_size[0]), "%-10d", ++ sprintf (&(hdr.ar_size[0]), "%-9d", + (int) ((elength + 1) & ~1)); + strncpy (hdr.ar_fmag, ARFMAG, 2); + for (i = 0; i < sizeof (struct ar_hdr); i++) +@@ -1894,7 +1894,7 @@ + sprintf (hdr.ar_uid, "%ld", (long) 666); + sprintf (hdr.ar_gid, "%ld", (long) 42); + #endif +- sprintf (hdr.ar_size, "%-10d", (int) mapsize); ++ sprintf (hdr.ar_size, "%-9d", (int) mapsize); + strncpy (hdr.ar_fmag, ARFMAG, 2); + for (i = 0; i < sizeof (struct ar_hdr); i++) + if (((char *) (&hdr))[i] == '\0') +@@ -2046,7 +2046,7 @@ + + memset ((char *) (&hdr), 0, sizeof (struct ar_hdr)); + hdr.ar_name[0] = '/'; +- sprintf (hdr.ar_size, "%-10d", (int) mapsize); ++ sprintf (hdr.ar_size, "%-9d", (int) mapsize); + sprintf (hdr.ar_date, "%ld", (long) time (NULL)); + /* This, at least, is what Intel coff sets the values to.: */ + sprintf ((hdr.ar_uid), "%d", 0);