all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Failed to build Emacs v26.3.50 on macOS v10.15.4 with Xcode 11.4.1
@ 2020-04-28  2:58 ENDOH Hiroaki
  2020-04-28  7:30 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: ENDOH Hiroaki @ 2020-04-28  2:58 UTC (permalink / raw)
  To: emacs-devel

[-- 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;

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-29  8:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-28  2:58 Failed to build Emacs v26.3.50 on macOS v10.15.4 with Xcode 11.4.1 ENDOH Hiroaki
2020-04-28  7:30 ` Eli Zaretskii
2020-04-29  5:47   ` ENDOH Hiroaki
2020-04-29  8:03     ` Eli Zaretskii

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.