From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Gilles Pion Newsgroups: gmane.emacs.bugs Subject: bug#13650: Emacs pretest 24.2.93 - compilation error on AIX 5.3 using gcc 4.7-2 Date: Fri, 8 Feb 2013 08:09:52 +0100 Message-ID: References: <511419F0.7040704@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7bfd027c32bb5604d5314011 X-Trace: ger.gmane.org 1360307471 30249 80.91.229.3 (8 Feb 2013 07:11:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 8 Feb 2013 07:11:11 +0000 (UTC) Cc: 13650@debbugs.gnu.org To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Feb 08 08:11:31 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1U3i7P-0007j8-7E for geb-bug-gnu-emacs@m.gmane.org; Fri, 08 Feb 2013 08:11:31 +0100 Original-Received: from localhost ([::1]:45863 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U3i75-0005mQ-SM for geb-bug-gnu-emacs@m.gmane.org; Fri, 08 Feb 2013 02:11:11 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:41031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U3i6z-0005lB-5H for bug-gnu-emacs@gnu.org; Fri, 08 Feb 2013 02:11:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U3i6v-0002ai-9T for bug-gnu-emacs@gnu.org; Fri, 08 Feb 2013 02:11:05 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:37313) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U3i6v-0002ab-5s for bug-gnu-emacs@gnu.org; Fri, 08 Feb 2013 02:11:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1U3i6w-0002Eo-0k for bug-gnu-emacs@gnu.org; Fri, 08 Feb 2013 02:11:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Gilles Pion Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 08 Feb 2013 07:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13650 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13650-submit@debbugs.gnu.org id=B13650.13603074248533 (code B ref 13650); Fri, 08 Feb 2013 07:11:01 +0000 Original-Received: (at 13650) by debbugs.gnu.org; 8 Feb 2013 07:10:24 +0000 Original-Received: from localhost ([127.0.0.1]:42777 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U3i6I-0002DV-TH for submit@debbugs.gnu.org; Fri, 08 Feb 2013 02:10:23 -0500 Original-Received: from mail-we0-f169.google.com ([74.125.82.169]:55672) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U3i6C-0002DD-QC for 13650@debbugs.gnu.org; Fri, 08 Feb 2013 02:10:19 -0500 Original-Received: by mail-we0-f169.google.com with SMTP id t11so2812503wey.0 for <13650@debbugs.gnu.org>; Thu, 07 Feb 2013 23:10:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=JXsfm6bwy8xm1Ckwk+xpjyMi11XdhD3bFSJnZHf7+aM=; b=c7CFCEWQu0IVD/0X1NI9fgha2RayeOPA9+hlz7P5QWIiLlFHcjHTR4HsY60OWvLDsp 0sBBxtt8XMqB1tV00ODSgzXPs4pUDLy08jZ2cYtxA0MyrPo+MdyUHJE9a7cOM9ozT28k uVvv1CC7RUT8XwVE15//x/PTTMw16GES2lxewpKrSXMRivdVrpr+MMrUJxPGUazC7hh/ xQTZ+tGoLV344Fw4nRh6upWVNgDZZGq8j5/4hopb+ZSDub0IKTkgRYy0Vvv5Qda9z3Ev PbbSOATes8D9Gkfp6shyUHLfI2ZLwWlGN/ATP/GWnkDcs/SBykqVlOSwqSogxD5K9HKy QgTg== X-Received: by 10.194.71.244 with SMTP id y20mr7555432wju.19.1360307414022; Thu, 07 Feb 2013 23:10:14 -0800 (PST) Original-Received: by 10.194.76.4 with HTTP; Thu, 7 Feb 2013 23:09:52 -0800 (PST) In-Reply-To: <511419F0.7040704@cs.ucla.edu> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:70870 Archived-At: --047d7bfd027c32bb5604d5314011 Content-Type: text/plain; charset=UTF-8 You'll have to wait until monday for the results but I won't forget! 2013/2/7 Paul Eggert > On 02/07/13 09:47, Glenn Morris wrote: > > At first glance, it looks like DATA_START, DATA_SEG_BITS, and > > NLIST_STRUCT also went missing in that 2012/05 change. Paul? > > That part should be OK. DATA_START and DATA_SEG_BITS are > needed only for the non-USE_LSB_TAG case, which no longer > applies to AIX. NLIST_STRUCT is handled automatically by > Gnulib now. > > Since ADDR_CORRECT should be a noop now, it should probably > be removed and replaced by a cast. Casting to 'int' can't > be right, though, since AIX can be 64-bit. I expect the build > in question here is 64-bit, too, as Gilles's symptom is the > same one that Harald Maier reported in 2009 > . > Given the date of that report, I expect the problem is that > unexaix has some long-existing problems for 64-bit platforms. > I briefly looked for problems and came up with the following patch, > which should fix both the ADDR_CORRECT problem and the > "Invalid format operation %u" problem. Most likely this will > merely uncover another problem but I hope we can fix that too. > > So, Gilles, can you please try this patch? Thanks. > > === modified file 'src/unexaix.c' > --- src/unexaix.c 2013-01-01 09:11:05 +0000 > +++ src/unexaix.c 2013-02-07 21:11:30 +0000 > @@ -51,6 +51,8 @@ what you give them. Help stamp out sof > #include "getpagesize.h" > > #include > +#include > +#include > #include > #include > #include > @@ -92,23 +94,30 @@ static int pagemask; > > #include "lisp.h" > > -static void > +static _Noreturn void > report_error (const char *file, int fd) > { > if (fd) > - close (fd); > + { > + int failed_errno = errno; > + close (fd); > + errno = failed_errno; > + } > report_file_error ("Cannot unexec", Fcons (build_string (file), Qnil)); > } > > -#define ERROR0(msg) report_error_1 (new, msg, 0, 0); return -1 > -#define ERROR1(msg,x) report_error_1 (new, msg, x, 0); return -1 > -#define ERROR2(msg,x,y) report_error_1 (new, msg, x, y); return -1 > +#define ERROR0(msg) report_error_1 (new, msg) > +#define ERROR1(msg,x) report_error_1 (new, msg, x) > +#define ERROR2(msg,x,y) report_error_1 (new, msg, x, y) > > -static void > -report_error_1 (int fd, const char *msg, int a1, int a2) > +static _Noreturn void ATTRIBUTE_FORMAT_PRINTF (2, 3) > +report_error_1 (int fd, const char *msg, ...) > { > + va_list ap; > close (fd); > - error (msg, a1, a2); > + va_start (ap, msg); > + verror (msg, ap); > + va_end (ap); > } > > static int make_hdr (int, int, const char *, const char *); > @@ -163,8 +172,8 @@ make_hdr (int new, int a_out, > const char *a_name, const char *new_name) > { > int scns; > - unsigned int bss_start; > - unsigned int data_start; > + uintptr_t bss_start; > + uintptr_t data_start; > > struct scnhdr section[MAX_SECTIONS]; > struct scnhdr * f_thdr; /* Text section header */ > @@ -179,17 +188,17 @@ make_hdr (int new, int a_out, > pagemask = getpagesize () - 1; > > /* Adjust text/data boundary. */ > - data_start = (long) start_of_data (); > - data_start = ADDR_CORRECT (data_start); > + data_start = (uintptr_t) start_of_data (); > > data_start = data_start & ~pagemask; /* (Down) to page boundary. */ > > - bss_start = ADDR_CORRECT (sbrk (0)) + pagemask; > + bss_start = (uintptr_t) sbrk (0) + pagemask; > bss_start &= ~ pagemask; > > if (data_start > bss_start) /* Can't have negative data size. */ > { > - ERROR2 ("unexec: data_start (%u) can't be greater than bss_start > (%u)", > + ERROR2 (("unexec: data_start (0x%"PRIxPTR > + ") can't be greater than bss_start (0x%"PRIxPTR")"), > data_start, bss_start); > } > > @@ -393,7 +402,6 @@ static void > write_segment (int new, char *ptr, char *end) > { > int i, nwrite, ret; > - char buf[80]; > char zeros[UnexBlockSz]; > > for (i = 0; ptr < end;) > @@ -414,9 +422,13 @@ write_segment (int new, char *ptr, char > } > else if (nwrite != ret) > { > + int write_errno = errno; > + char buf[1000]; > + void *addr = ptr; > sprintf (buf, > - "unexec write failure: addr 0x%lx, fileno %d, size > 0x%x, wrote 0x%x, errno %d", > - (unsigned long)ptr, new, nwrite, ret, errno); > + "unexec write failure: addr %p, fileno %d, size 0x%x, > wrote 0x%x, errno %d", > + addr, new, nwrite, ret, errno); > + errno = write_errno; > PERROR (buf); > } > i += nwrite; > > > -- *Gilles* --047d7bfd027c32bb5604d5314011 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
You'll have to wait until monday for the results but I= won't forget!



<= div class=3D"gmail_quote">2013/2/7 Paul Eggert <eggert@cs.ucla.edu>= ;
On 02/07/13 09:47, Glenn M= orris wrote:
> At first glance, it looks like DATA_START, DATA_SEG_BITS, and
> NLIST_STRUCT also went missing in that 2012/05 change. Paul?

That part should be OK. =C2=A0DATA_START and DATA_SEG_BITS are
needed only for the non-USE_LSB_TAG case, which no longer
applies to AIX. =C2=A0NLIST_STRUCT is handled automatically by
Gnulib now.

Since ADDR_CORRECT should be a noop now, it should probably
be removed and replaced by a cast. =C2=A0Casting to 'int' can't=
be right, though, since AIX can be 64-bit. =C2=A0I expect the build
in question here is 64-bit, too, as Gilles's symptom is the
same one that Harald Maier reported in 2009
<http://lists.gnu.org/archive/html/emacs-devel/20= 09-08/msg00353.html>.
Given the date of that report, I expect the problem is that
unexaix has some long-existing problems for 64-bit platforms.
I briefly looked for problems and came up with the following patch,
which should fix both the ADDR_CORRECT problem and the
"Invalid format operation %u" problem. =C2=A0Most likely this wil= l
merely uncover another problem but I hope we can fix that too.

So, Gilles, can you please try this patch? =C2=A0Thanks.

=3D=3D=3D modified file 'src/unexaix.c'
--- src/unexaix.c =C2=A0 =C2=A0 =C2=A0 2013-01-01 09:11:05 +0000
+++ src/unexaix.c =C2=A0 =C2=A0 =C2=A0 2013-02-07 21:11:30 +0000
@@ -51,6 +51,8 @@ what you give them. =C2=A0 Help stamp out sof
=C2=A0#include "getpagesize.h"

=C2=A0#include <sys/types.h>
+#include <inttypes.h>
+#include <stdarg.h>
=C2=A0#include <stdio.h>
=C2=A0#include <sys/stat.h>
=C2=A0#include <errno.h>
@@ -92,23 +94,30 @@ static int pagemask;

=C2=A0#include "lisp.h"

-static void
+static _Noreturn void
=C2=A0report_error (const char *file, int fd)
=C2=A0{
=C2=A0 =C2=A0if (fd)
- =C2=A0 =C2=A0close (fd);
+ =C2=A0 =C2=A0{
+ =C2=A0 =C2=A0 =C2=A0int failed_errno =3D errno;
+ =C2=A0 =C2=A0 =C2=A0close (fd);
+ =C2=A0 =C2=A0 =C2=A0errno =3D failed_errno;
+ =C2=A0 =C2=A0}
=C2=A0 =C2=A0report_file_error ("Cannot unexec", Fcons (build_str= ing (file), Qnil));
=C2=A0}

-#define ERROR0(msg) report_error_1 (new, msg, 0, 0); return -1
-#define ERROR1(msg,x) report_error_1 (new, msg, x, 0); return -1
-#define ERROR2(msg,x,y) report_error_1 (new, msg, x, y); return -1
+#define ERROR0(msg) report_error_1 (new, msg)
+#define ERROR1(msg,x) report_error_1 (new, msg, x)
+#define ERROR2(msg,x,y) report_error_1 (new, msg, x, y)

-static void
-report_error_1 (int fd, const char *msg, int a1, int a2)
+static _Noreturn void ATTRIBUTE_FORMAT_PRINTF (2, 3)
+report_error_1 (int fd, const char *msg, ...)
=C2=A0{
+ =C2=A0va_list ap;
=C2=A0 =C2=A0close (fd);
- =C2=A0error (msg, a1, a2);
+ =C2=A0va_start (ap, msg);
+ =C2=A0verror (msg, ap);
+ =C2=A0va_end (ap);
=C2=A0}

=C2=A0static int make_hdr (int, int, const char *, const char *);
@@ -163,8 +172,8 @@ make_hdr (int new, int a_out,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 const char *a_name, const char *new_name= )
=C2=A0{
=C2=A0 =C2=A0int scns;
- =C2=A0unsigned int bss_start;
- =C2=A0unsigned int data_start;
+ =C2=A0uintptr_t bss_start;
+ =C2=A0uintptr_t data_start;

=C2=A0 =C2=A0struct scnhdr section[MAX_SECTIONS];
=C2=A0 =C2=A0struct scnhdr * f_thdr; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0/* Text section header */
@@ -179,17 +188,17 @@ make_hdr (int new, int a_out,
=C2=A0 =C2=A0pagemask =3D getpagesize () - 1;

=C2=A0 =C2=A0/* Adjust text/data boundary. */
- =C2=A0data_start =3D (long) start_of_data ();
- =C2=A0data_start =3D ADDR_CORRECT (data_start);
+ =C2=A0data_start =3D (uintptr_t) start_of_data ();

=C2=A0 =C2=A0data_start =3D data_start & ~pagemask; /* (Down) to page b= oundary. */

- =C2=A0bss_start =3D ADDR_CORRECT (sbrk (0)) + pagemask;
+ =C2=A0bss_start =3D (uintptr_t) sbrk (0) + pagemask;
=C2=A0 =C2=A0bss_start &=3D ~ pagemask;

=C2=A0 =C2=A0if (data_start > bss_start) =C2=A0/* Can't have negativ= e data size. */
=C2=A0 =C2=A0 =C2=A0{
- =C2=A0 =C2=A0 =C2=A0ERROR2 ("unexec: data_start (%u) can't be gr= eater than bss_start (%u)",
+ =C2=A0 =C2=A0 =C2=A0ERROR2 (("unexec: data_start (0x%"PRIxPTR + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0") can't be grea= ter than bss_start (0x%"PRIxPTR")"),
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 data_start, bss_start); =C2=A0 =C2=A0 =C2=A0}

@@ -393,7 +402,6 @@ static void
=C2=A0write_segment (int new, char *ptr, char *end)
=C2=A0{
=C2=A0 =C2=A0int i, nwrite, ret;
- =C2=A0char buf[80];
=C2=A0 =C2=A0char zeros[UnexBlockSz];

=C2=A0 =C2=A0for (i =3D 0; ptr < end;)
@@ -414,9 +422,13 @@ write_segment (int new, char *ptr, char
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 =C2=A0 =C2=A0else if (nwrite !=3D ret)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 {
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 int write_errno =3D errno;
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 char buf[1000];
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 void *addr =3D ptr;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sprintf (buf,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"unexe= c write failure: addr 0x%lx, fileno %d, size 0x%x, wrote 0x%x, errno %d&quo= t;,
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(unsigned l= ong)ptr, new, nwrite, ret, errno);
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"unexe= c write failure: addr %p, fileno %d, size 0x%x, wrote 0x%x, errno %d",=
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0addr, new, = nwrite, ret, errno);
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 errno =3D write_errno;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PERROR (buf);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 =C2=A0 =C2=A0i +=3D nwrite;





--
Gilles --047d7bfd027c32bb5604d5314011--