From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#9927: 24.1.50; unexec/unexmacosx doesn't grok GCC 4.6+ sections Date: Wed, 17 Sep 2014 11:39:39 -0700 Organization: UCLA Computer Science Department Message-ID: <5419D56B.3050807@cs.ucla.edu> References: <6A5F6D17-397A-48F7-87E9-D77C09B60EC6@Freenet.DE> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050701050404050705020806" X-Trace: ger.gmane.org 1410981078 31681 80.91.229.3 (17 Sep 2014 19:11:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Sep 2014 19:11:18 +0000 (UTC) Cc: Peter Dyballa , Samuel Bronson To: 9927@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 17 21:11:08 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XUKdA-0001Ze-6K for geb-bug-gnu-emacs@m.gmane.org; Wed, 17 Sep 2014 21:11:08 +0200 Original-Received: from localhost ([::1]:46872 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUKd9-0004mh-8J for geb-bug-gnu-emacs@m.gmane.org; Wed, 17 Sep 2014 15:11:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50294) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUKd0-0004mZ-Lu for bug-gnu-emacs@gnu.org; Wed, 17 Sep 2014 15:11:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XUKcu-0001Us-P2 for bug-gnu-emacs@gnu.org; Wed, 17 Sep 2014 15:10:58 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:52031) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUKcu-0001UI-M4 for bug-gnu-emacs@gnu.org; Wed, 17 Sep 2014 15:10:52 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XUK95-0004cg-9R for bug-gnu-emacs@gnu.org; Wed, 17 Sep 2014 14:40:03 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <6A5F6D17-397A-48F7-87E9-D77C09B60EC6@Freenet.DE> Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 17 Sep 2014 18:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9927 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 9927-submit@debbugs.gnu.org id=B9927.141097919117743 (code B ref 9927); Wed, 17 Sep 2014 18:40:02 +0000 Original-Received: (at 9927) by debbugs.gnu.org; 17 Sep 2014 18:39:51 +0000 Original-Received: from localhost ([127.0.0.1]:43580 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XUK8s-0004c7-QH for submit@debbugs.gnu.org; Wed, 17 Sep 2014 14:39:51 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:38396) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XUK8o-0004bv-10 for 9927@debbugs.gnu.org; Wed, 17 Sep 2014 14:39:46 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id A7AD439E8011; Wed, 17 Sep 2014 11:39:44 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id j3MWfc6POdsQ; Wed, 17 Sep 2014 11:39:39 -0700 (PDT) Original-Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id BFF0039E8015; Wed, 17 Sep 2014 11:39:39 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:93430 Archived-At: This is a multi-part message in MIME format. --------------050701050404050705020806 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit If I understand that branch correctly, the attached patch should suffice to port to GCC 4.6+ on OS X. It's relative to trunk bzr 117895. I don't have easy access to OS X to try it, though. Peter and/or Samuel, does it work for you? --------------050701050404050705020806 Content-Type: text/x-patch; name="gcc4.6.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="gcc4.6.patch" === modified file 'src/ChangeLog' --- src/ChangeLog 2014-09-17 18:27:36 +0000 +++ src/ChangeLog 2014-09-17 18:29:28 +0000 @@ -1,3 +1,7 @@ +2014-09-17 Samuel Bronson + + * unexmacosx.c (copy_data_segment): Port to GCC 4.6+ (Bug#9927). + 2014-09-17 Paul Eggert Fix minor problems found by static checking. === modified file 'src/unexmacosx.c' --- src/unexmacosx.c 2014-09-01 02:37:22 +0000 +++ src/unexmacosx.c 2014-09-17 18:28:19 +0000 @@ -879,6 +879,27 @@ if (!unexec_write (header_offset, sectp, sizeof (struct section))) unexec_error ("cannot write section %.16s's header", sectp->sectname); } + else if (strncmp (sectp->sectname, "__bss", 5) == 0 + || strncmp (sectp->sectname, "__pu_bss", 8) == 0) + { + sectp->flags = S_REGULAR; + + /* These sections are produced by GCC 4.6+. + + FIXME: We possibly ought to clear uninitialized local + variables in statically linked libraries like for + SECT_BSS (__bss) above, but setting up the markers we + need in lastfile.c would be rather messy. See + darwin_output_aligned_bss () in gcc/config/darwin.c for + the root of the problem, keeping in mind that the + sections are numbered by their alignment in GCC 4.6, but + by log2(alignment) in GCC 4.7. */ + + if (!unexec_write (sectp->offset, (void *) sectp->addr, sectp->size)) + unexec_error ("cannot copy section %.16s", sectp->sectname); + if (!unexec_write (header_offset, sectp, sizeof (struct section))) + unexec_error ("cannot write section %.16s's header", sectp->sectname); + } else if (strncmp (sectp->sectname, "__la_symbol_ptr", 16) == 0 || strncmp (sectp->sectname, "__nl_symbol_ptr", 16) == 0 || strncmp (sectp->sectname, "__got", 16) == 0 @@ -890,6 +911,7 @@ || strncmp (sectp->sectname, "__program_vars", 16) == 0 || strncmp (sectp->sectname, "__mod_init_func", 16) == 0 || strncmp (sectp->sectname, "__mod_term_func", 16) == 0 + || strncmp (sectp->sectname, "__static_data", 16) == 0 || strncmp (sectp->sectname, "__objc_", 7) == 0) { if (!unexec_copy (sectp->offset, old_file_offset, sectp->size)) --------------050701050404050705020806--