all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ENDOH Hiroaki <hiroakiendoh@gmail.com>
To: emacs-devel@gnu.org
Subject: Failed to build Emacs v26.3.50 on macOS v10.15.4 with Xcode 11.4.1
Date: Tue, 28 Apr 2020 11:58:41 +0900	[thread overview]
Message-ID: <CAKMtQdjatZSQsf_v838rYW9ZHA74jRNd0TGm6wBpjJsTb3hQrw@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 359 bytes --]

Hi, Emacs team.

I got the build error of Emacs v26.3.50 on macOS v10.15.4 with Xcode 11.4.1.
Using the attached diff.patch, you would get success build Emacs v26.3.50.

The reproduction procedure, error log and workarounds are summarized below.
https://github.com/hiroakit/emacs-on-apple/issues/1

Would you be able to check it?

Best regards,
Hiroaki ENDOH

[-- Attachment #2: diff.patch --]
[-- Type: application/octet-stream, Size: 3042 bytes --]

--- a/src/unexmacosx.c	2020-04-27 23:26:24.000000000 +0900
+++ b/src/unexmacosx.c	2020-04-27 23:58:54.000000000 +0900
@@ -97,9 +97,9 @@ along with GNU Emacs.  If not, see <http
 
 #include "unexec.h"
 #include "lisp.h"
+#include "sysstdio.h"
 
 #include <errno.h>
-#include <stdio.h>
 #include <fcntl.h>
 #include <stdarg.h>
 #include <stdint.h>
@@ -303,9 +303,9 @@ unexec_error (const char *format, ...)
   va_list ap;
 
   va_start (ap, format);
-  fprintf (stderr, "unexec: ");
+  fputs ("unexec: ", stderr);
   vfprintf (stderr, format, ap);
-  fprintf (stderr, "\n");
+  putc ('\n', stderr);
   va_end (ap);
   exit (1);
 }
@@ -447,7 +447,7 @@ unexec_regions_recorder (task_t task, vo
 
   while (num && num_unexec_regions < MAX_UNEXEC_REGIONS)
     {
-      /* Subtract the size of trailing null bytes from filesize.  It
+      /* Subtract the size of trailing NUL bytes from filesize.  It
 	 can be smaller than vmsize in segment commands.  In such a
 	 case, trailing bytes are initialized with zeros.  */
       for (p = ranges->address + ranges->size; p > ranges->address; p--)
@@ -503,22 +503,34 @@ unexec_regions_sort_compare (const void 
 static void
 unexec_regions_merge (void)
 {
-  int i, n;
-  unexec_region_info r;
-  vm_size_t padsize;
-
   qsort (unexec_regions, num_unexec_regions, sizeof (unexec_regions[0]),
 	 &unexec_regions_sort_compare);
-  n = 0;
-  r = unexec_regions[0];
-  padsize = r.range.address & (pagesize - 1);
-  if (padsize)
-    {
-      r.range.address -= padsize;
-      r.range.size += padsize;
-      r.filesize += padsize;
+
+  /* Align each region start address to a page boundary.  */
+  for (unexec_region_info *cur = unexec_regions;
+       cur < unexec_regions + num_unexec_regions; cur++)
+    {
+      vm_size_t padsize = cur->range.address & (pagesize - 1);
+      if (padsize)
+	{
+	  cur->range.address -= padsize;
+	  cur->range.size += padsize;
+	  cur->filesize += padsize;
+
+	  unexec_region_info *prev = cur == unexec_regions ? NULL : cur - 1;
+	  if (prev
+	      && prev->range.address + prev->range.size > cur->range.address)
+	    {
+	      prev->range.size = cur->range.address - prev->range.address;
+	      if (prev->filesize > prev->range.size)
+		prev->filesize = prev->range.size;
+	    }
+	}
     }
-  for (i = 1; i < num_unexec_regions; i++)
+
+  int n = 0;
+  unexec_region_info r = unexec_regions[0];
+  for (int i = 1; i < num_unexec_regions; i++)
     {
       if (r.range.address + r.range.size == unexec_regions[i].range.address
 	  && r.range.size - r.filesize < 2 * pagesize)
@@ -530,17 +542,6 @@ unexec_regions_merge (void)
 	{
 	  unexec_regions[n++] = r;
 	  r = unexec_regions[i];
-	  padsize = r.range.address & (pagesize - 1);
-	  if (padsize)
-	    {
-	      if ((unexec_regions[n-1].range.address
-		   + unexec_regions[n-1].range.size) == r.range.address)
-		unexec_regions[n-1].range.size -= padsize;
-
-	      r.range.address -= padsize;
-	      r.range.size += padsize;
-	      r.filesize += padsize;
-	    }
 	}
     }
   unexec_regions[n++] = r;

             reply	other threads:[~2020-04-28  2:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-28  2:58 ENDOH Hiroaki [this message]
2020-04-28  7:30 ` Failed to build Emacs v26.3.50 on macOS v10.15.4 with Xcode 11.4.1 Eli Zaretskii
2020-04-29  5:47   ` ENDOH Hiroaki
2020-04-29  8:03     ` Eli Zaretskii

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=CAKMtQdjatZSQsf_v838rYW9ZHA74jRNd0TGm6wBpjJsTb3hQrw@mail.gmail.com \
    --to=hiroakiendoh@gmail.com \
    --cc=emacs-devel@gnu.org \
    /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.