[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: MacOSX emacs crashes after 10.4.3 update
From: |
YAMAMOTO Mitsuharu |
Subject: |
Re: MacOSX emacs crashes after 10.4.3 update |
Date: |
Tue, 08 Nov 2005 10:18:45 +0900 |
User-agent: |
Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/22.0.50 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) |
>>>>> On Sun, 6 Nov 2005 16:46:45 +0900, Seiji Zenitani <address@hidden> said:
> Yamamoto-san,
>> > Have you tried setting the environment variable >
>> MACOSX_DEPLOYMENT_TARGET=10.4 ? E.g.
>>
>> > MACOSX_DEPLOYMENT_TARGET=10.4 ./make-package (...)
>>
>> > I heard that helps you build binaries that run on all 10.4
>> versions.
>>
>> Do you have any references explaining why it works (or why binary
>> compatibility is broken without it)?
> I hope Nozomu Ando-san's description (in Japanese language) will be
> helpful.
> http://homepage.mac.com/nand/macosx/emacs_cross.html
Thanks for the info. He says "MACOSX_DEPLOYMENT_TARGET=10.4 ..." is
not a fix but a workaround.
I'm very new to Tiger and I just started using it after the 10.4.3
release, but now I think I understand the situation. This is not a
Carbon-specific issue, but every build on Mac OS X 10.4/Darwin 8 PPC
is affected.
http://darwinsource.opendarwin.org/10.4.3/xnu-792.6.22/bsd/sys/cdefs.h
(about "long double compatibility")
http://darwinsource.opendarwin.org/10.4.3/SystemStubs-5/
Ironically, this mechanism seems to be introduced for binary
compatibility.
Ando-san, what do you think about the following change? It clears a
part of the __bss section on unexec, where the cleared part is located
after the static uninitialized variables in the Emacs source. I tried
to make an executable on 10.4.3 (linked with libncurses.5.dynlib),
then it could be executed on 10.3.9.
YAMAMOTO Mitsuharu
address@hidden
Index: src/unexmacosx.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/unexmacosx.c,v
retrieving revision 1.15
diff -c -r1.15 unexmacosx.c
*** src/unexmacosx.c 7 Aug 2005 12:33:18 -0000 1.15
--- src/unexmacosx.c 8 Nov 2005 00:44:25 -0000
***************
*** 193,198 ****
--- 193,221 ----
return write (outfd, src, count) == count;
}
+ /* Clear n bytes in outfd starting at offset dest. Return true if
+ successful, false otherwise. */
+ static int
+ unexec_clear (off_t dest, size_t count)
+ {
+ char buf[UNEXEC_COPY_BUFSZ];
+ ssize_t bytes;
+
+ bzero (buf, UNEXEC_COPY_BUFSZ);
+ if (lseek (outfd, dest, SEEK_SET) != dest)
+ return 0;
+
+ while (count > 0)
+ {
+ bytes = count > UNEXEC_COPY_BUFSZ ? UNEXEC_COPY_BUFSZ : count;
+ if (write (outfd, buf, bytes) != bytes)
+ return 0;
+ count -= bytes;
+ }
+
+ return 1;
+ }
+
/* Copy n bytes from starting offset src in infd to starting offset
dest in outfd. Return true if successful, false otherwise. */
static int
***************
*** 684,697 ****
if (!unexec_write (header_offset, sectp, sizeof (struct section)))
unexec_error ("cannot write section %s's header", SECT_DATA);
}
! else if (strncmp (sectp->sectname, SECT_BSS, 16) == 0
! || strncmp (sectp->sectname, SECT_COMMON, 16) == 0)
{
sectp->flags = S_REGULAR;
if (!unexec_write (sectp->offset, (void *) sectp->addr, sectp->size))
! unexec_error ("cannot write section %s", SECT_DATA);
if (!unexec_write (header_offset, sectp, sizeof (struct section)))
! unexec_error ("cannot write section %s's header", SECT_DATA);
}
else if (strncmp (sectp->sectname, "__la_symbol_ptr", 16) == 0
|| strncmp (sectp->sectname, "__nl_symbol_ptr", 16) == 0
--- 707,737 ----
if (!unexec_write (header_offset, sectp, sizeof (struct section)))
unexec_error ("cannot write section %s's header", SECT_DATA);
}
! else if (strncmp (sectp->sectname, SECT_COMMON, 16) == 0)
{
sectp->flags = S_REGULAR;
if (!unexec_write (sectp->offset, (void *) sectp->addr, sectp->size))
! unexec_error ("cannot write section %s", SECT_COMMON);
if (!unexec_write (header_offset, sectp, sizeof (struct section)))
! unexec_error ("cannot write section %s's header", SECT_COMMON);
! }
! else if (strncmp (sectp->sectname, SECT_BSS, 16) == 0)
! {
! extern char *my_endbss_static;
! unsigned long my_end = (unsigned long)my_endbss_static;
!
! assert (sectp->addr <= my_end
! && my_end <= sectp->addr + sectp->size);
!
! sectp->flags = S_REGULAR;
! if (!unexec_write (sectp->offset, (void *) sectp->addr,
! my_end - sectp->addr))
! unexec_error ("cannot write section %s", SECT_BSS);
! if (!unexec_clear (sectp->offset + (my_end - sectp->addr),
! sectp->size - (my_end - sectp->addr)))
! unexec_error ("cannot write section %s", SECT_BSS);
! if (!unexec_write (header_offset, sectp, sizeof (struct section)))
! unexec_error ("cannot write section %s's header", SECT_BSS);
}
else if (strncmp (sectp->sectname, "__la_symbol_ptr", 16) == 0
|| strncmp (sectp->sectname, "__nl_symbol_ptr", 16) == 0