From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: YAMAMOTO Mitsuharu Newsgroups: gmane.emacs.devel Subject: Re: MacOSX emacs crashes after 10.4.3 update Date: Tue, 08 Nov 2005 10:18:45 +0900 Organization: Faculty of Science, Chiba University Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Trace: sea.gmane.org 1131412766 18908 80.91.229.2 (8 Nov 2005 01:19:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 8 Nov 2005 01:19:26 +0000 (UTC) Cc: Nozomu Ando , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 08 02:19:16 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EZI8e-0001xh-2m for ged-emacs-devel@m.gmane.org; Tue, 08 Nov 2005 02:19:04 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EZI8d-0002z5-1D for ged-emacs-devel@m.gmane.org; Mon, 07 Nov 2005 20:19:03 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EZI8R-0002yq-PG for emacs-devel@gnu.org; Mon, 07 Nov 2005 20:18:51 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EZI8Q-0002yV-OV for emacs-devel@gnu.org; Mon, 07 Nov 2005 20:18:51 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EZI8Q-0002yS-ME for emacs-devel@gnu.org; Mon, 07 Nov 2005 20:18:50 -0500 Original-Received: from [133.82.132.2] (helo=mathmail.math.s.chiba-u.ac.jp) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EZI8Q-0003RI-3l for emacs-devel@gnu.org; Mon, 07 Nov 2005 20:18:50 -0500 Original-Received: from church.math.s.chiba-u.ac.jp (church [133.82.132.36]) by mathmail.math.s.chiba-u.ac.jp (Postfix) with ESMTP id AD0F42CAB; Tue, 8 Nov 2005 10:18:45 +0900 (JST) Original-To: Seiji Zenitani In-Reply-To: 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) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:45573 Archived-At: >>>>> On Sun, 6 Nov 2005 16:46:45 +0900, Seiji Zenitani 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 mituharu@math.s.chiba-u.ac.jp 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