From: Gilles Pion <gilles.pion@gmail.com>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: 13650@debbugs.gnu.org
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 [thread overview]
Message-ID: <CAN8zRaCFEUROw+J6oN2GUROwynBwtF6TdejEc+d28MDZWqV+Tw@mail.gmail.com> (raw)
In-Reply-To: <511419F0.7040704@cs.ucla.edu>
[-- Attachment #1: Type: text/plain, Size: 4828 bytes --]
You'll have to wait until monday for the results but I won't forget!
2013/2/7 Paul Eggert <eggert@cs.ucla.edu>
> 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
> <http://lists.gnu.org/archive/html/emacs-devel/2009-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. 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 <sys/types.h>
> +#include <inttypes.h>
> +#include <stdarg.h>
> #include <stdio.h>
> #include <sys/stat.h>
> #include <errno.h>
> @@ -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*
[-- Attachment #2: Type: text/html, Size: 6177 bytes --]
next prev parent reply other threads:[~2013-02-08 7:09 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-07 9:49 bug#13650: Emacs pretest 24.2.93 - compilation error on AIX 5.3 using gcc 4.7-2 Gilles Pion
2013-02-07 10:57 ` Gilles Pion
2013-02-07 17:47 ` Glenn Morris
2013-02-07 21:17 ` Paul Eggert
2013-02-07 21:42 ` Glenn Morris
2013-02-08 7:09 ` Gilles Pion [this message]
2013-02-11 7:51 ` Gilles Pion
2013-02-11 21:18 ` Paul Eggert
2013-02-12 8:06 ` Gilles Pion
2013-02-12 19:03 ` Paul Eggert
2013-02-13 11:27 ` Gilles Pion
2013-02-13 18:37 ` Glenn Morris
2013-02-13 23:13 ` Paul Eggert
2013-02-13 23:33 ` Glenn Morris
2013-02-14 2:49 ` Paul Eggert
2013-02-14 7:28 ` Gilles Pion
2013-02-14 7:32 ` Paul Eggert
2013-02-14 7:43 ` Gilles Pion
2013-02-14 7:56 ` Paul Eggert
2013-02-14 8:09 ` Gilles Pion
2013-02-14 14:57 ` Paul Eggert
2013-02-14 15:11 ` Gilles Pion
2013-02-14 15:46 ` Stefan Monnier
2013-02-14 22:23 ` Paul Eggert
2013-02-14 23:51 ` Glenn Morris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAN8zRaCFEUROw+J6oN2GUROwynBwtF6TdejEc+d28MDZWqV+Tw@mail.gmail.com \
--to=gilles.pion@gmail.com \
--cc=13650@debbugs.gnu.org \
--cc=eggert@cs.ucla.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.