From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Petr Hracek Newsgroups: gmane.emacs.bugs Subject: bug#20614: Segmentation fault when building on Power8 Little Endian Date: Thu, 1 Oct 2015 13:44:01 +0200 Message-ID: <560D1C81.2080109@redhat.com> References: <555C3E3C.4090700@redhat.com> <1gpp5vi5xn.fsf@fencepost.gnu.org> <555DD5D3.3020207@redhat.com> <55A3A08A.9060905@redhat.com> <55A4BFB7.3010208@redhat.com> <55F95275.4040209@redhat.com> <56012AA6.7010702@redhat.com> <56025D9A.9080608@redhat.com> <838u7xlbsn.fsf@gnu.org> <56028633.3000303@redhat.com> <83zj0djskx.fsf@gnu.org> <56029707.9040100@redhat.com> <83wpvhjpdd.fsf@gnu.org> <5603D8BE.10300@redhat.com> <834mijkf36.fsf@gnu.org> <56043950.7040108@redhat.com> <83k2rdhaso.fsf@gnu.org> <560BBBF3.6000407@redhat.com> <83r3lf9gq4.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------040500000405040301070806" X-Trace: ger.gmane.org 1443715186 6001 80.91.229.3 (1 Oct 2015 15:59:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 1 Oct 2015 15:59:46 +0000 (UTC) Cc: fw@deneb.enyo.de, 20614@debbugs.gnu.org, Nick Clifton To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Oct 01 17:59:37 2015 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 1ZhgGX-000069-E3 for geb-bug-gnu-emacs@m.gmane.org; Thu, 01 Oct 2015 17:59:29 +0200 Original-Received: from localhost ([::1]:52401 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhgGX-000090-0B for geb-bug-gnu-emacs@m.gmane.org; Thu, 01 Oct 2015 11:59:29 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55972) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhcIM-000145-PE for bug-gnu-emacs@gnu.org; Thu, 01 Oct 2015 07:45:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZhcIJ-0005vo-9t for bug-gnu-emacs@gnu.org; Thu, 01 Oct 2015 07:45:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60978) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhcIJ-0005vJ-37 for bug-gnu-emacs@gnu.org; Thu, 01 Oct 2015 07:45:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZhcII-0003sD-Oe for bug-gnu-emacs@gnu.org; Thu, 01 Oct 2015 07:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Petr Hracek Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 01 Oct 2015 11:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20614 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20614-submit@debbugs.gnu.org id=B20614.144369985014812 (code B ref 20614); Thu, 01 Oct 2015 11:45:02 +0000 Original-Received: (at 20614) by debbugs.gnu.org; 1 Oct 2015 11:44:10 +0000 Original-Received: from localhost ([127.0.0.1]:49949 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZhcHQ-0003qo-TE for submit@debbugs.gnu.org; Thu, 01 Oct 2015 07:44:09 -0400 Original-Received: from mx1.redhat.com ([209.132.183.28]:63925) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZhcHN-0003qf-Tm for 20614@debbugs.gnu.org; Thu, 01 Oct 2015 07:44:07 -0400 Original-Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id AD44C8F30F; Thu, 1 Oct 2015 11:44:04 +0000 (UTC) Original-Received: from [10.40.200.43] (ovpn-200-43.brq.redhat.com [10.40.200.43]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t91Bi10S006377; Thu, 1 Oct 2015 07:44:02 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 In-Reply-To: <83r3lf9gq4.fsf@gnu.org> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 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: 208.118.235.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:107144 Archived-At: This is a multi-part message in MIME format. --------------040500000405040301070806 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit On 10/01/2015 09:43 AM, Eli Zaretskii wrote: >> From: Petr Hracek >> Date: Wed, 30 Sep 2015 12:39:47 +0200 >> Cc: 20614@debbugs.gnu.org >> >> My deep observation with emacs package and binutils: >> 1) binutils-2.23.52.0.1-30.el7_1.2.ppc64le.rpm works completely. >> 2) binutils-2.23.52.0.1-40.el7.ppc64le.rpm works if row >> http://git.savannah.gnu.org/cgit/emacs.git/tree/src/unexelf.c?h=emacs-24#n869 >> is suppressed. >> >> With newer version of binutils I can see the same series:( >> like: >> Dumping under the name emacs >> emacs: Program segment above .bss in >> /builddir/build/BUILD/emacs-24.3/src/temacs >> make[2]: Leaving directory `/builddir/build/BUILD/emacs-24.3/src' >> make[2]: *** [bootstrap-emacs] Error 1 >> >> I have collected list of commits and messages against upstream: >> #1200138 >> https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=43a8475ca01b676fb764aaed0c4ed1cc16fc3c87 #1200138 >> https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=eec2f3ed9f053653ed5d629eb50e08e3ee61e9bd #1203449 >> https://bugzilla.redhat.com/attachment.cgi?id=1003499 # 1175624 .opd >> https://sourceware.org/ml/binutils/2015-01/msg00227.html >> # 1175624 .got which implies .sdata, .sbss, .plt .iplt and .branch_lt also have >> to move: https://sourceware.org/ml/binutils/2015-01/msg00228.html >> # 1175624 And .toc1: https://sourceware.org/ml/binutils/2015-01/msg00232.html >> #1194164 func@localentry expressions, which was added to FSF binutils with git >> commit 45965137 >> #1183838 https://bugzilla.redhat.com/attachment.cgi?id=986213 >> # 1172766 https://bugzilla.redhat.com/attachment.cgi?id=989450 I hope it helps >> you a bit. > I think we need help from someone who understands the Binutils part of > this. Can you ask some of the Binutils maintainers please join this > discussion and analyze the problem? Out binutils maintainers send me reference to following patch. |# Fix incorrectly generated ELF binaries and DSOs| diff -Nrup a/bfd/elf.c b/bfd/elf.c --- a/bfd/elf.c 2015-07-28 10:52:10.941754850 -0600 +++ b/bfd/elf.c 2015-07-28 10:53:34.725982912 -0600 @@ -4081,11 +4081,18 @@ _bfd_elf_map_sections_to_segments (bfd * new_segment = TRUE; } else if ((last_hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) == 0 - && (hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) != 0) + && (hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) != 0 + && ((abfd->flags & D_PAGED) == 0 + || (((last_hdr->lma + last_size - 1) & -maxpagesize) + != (hdr->lma & -maxpagesize)))) { - /* We don't want to put a loadable section after a - nonloadable section in the same segment. - Consider .tbss sections as loadable for this purpose. */ + /* We don't want to put a loaded section after a + nonloaded (ie. bss style) section in the same segment + as that will force the non-loaded section to be loaded. + Consider .tbss sections as loaded for this purpose. + However, like the writable/non-writable case below, + if they are on the same page then they must be put + in the same segment. */ new_segment = TRUE; } else if ((abfd->flags & D_PAGED) == 0) diff -Nrup a/ld/testsuite/ld-powerpc/elfv2so.d b/ld/testsuite/ld-powerpc/elfv2so.d --- a/ld/testsuite/ld-powerpc/elfv2so.d 2015-07-28 10:52:10.921755273 -0600 +++ b/ld/testsuite/ld-powerpc/elfv2so.d 2015-07-28 10:41:10.046732001 -0600 @@ -7,31 +7,31 @@ Disassembly of section \.text: -0+320 <.*\.plt_call\.f4>: +0+300 <.*\.plt_call\.f4>: .*: (18 00 41 f8|f8 41 00 18) std r2,24\(r1\) .*: (38 80 82 e9|e9 82 80 38) ld r12,-32712\(r2\) .*: (a6 03 89 7d|7d 89 03 a6) mtctr r12 .*: (20 04 80 4e|4e 80 04 20) bctr -0+330 <.*\.plt_call\.f3>: +0+310 <.*\.plt_call\.f3>: .*: (18 00 41 f8|f8 41 00 18) std r2,24\(r1\) .*: (28 80 82 e9|e9 82 80 28) ld r12,-32728\(r2\) .*: (a6 03 89 7d|7d 89 03 a6) mtctr r12 .*: (20 04 80 4e|4e 80 04 20) bctr -0+340 <.*\.plt_call\.f2>: +0+320 <.*\.plt_call\.f2>: .*: (18 00 41 f8|f8 41 00 18) std r2,24\(r1\) .*: (30 80 82 e9|e9 82 80 30) ld r12,-32720\(r2\) .*: (a6 03 89 7d|7d 89 03 a6) mtctr r12 .*: (20 04 80 4e|4e 80 04 20) bctr -0+350 <.*\.plt_call\.f1>: +0+330 <.*\.plt_call\.f1>: .*: (18 00 41 f8|f8 41 00 18) std r2,24\(r1\) .*: (40 80 82 e9|e9 82 80 40) ld r12,-32704\(r2\) .*: (a6 03 89 7d|7d 89 03 a6) mtctr r12 .*: (20 04 80 4e|4e 80 04 20) bctr -0+360 : +0+340 : .*: (02 00 4c 3c|3c 4c 00 02) addis r2,r12,2 .*: (d8 81 42 38|38 42 81 d8) addi r2,r2,-32296 .*: (a6 02 08 7c|7c 08 02 a6) mflr r0 @@ -53,7 +53,7 @@ Disassembly of section \.text: .*: (98 01 01 00|00 00 00 00) .* .*: (00 00 00 00|00 01 01 98) .* -0+3b0 <__glink_PLTresolve>: +0+390 <__glink_PLTresolve>: .*: (a6 02 08 7c|7c 08 02 a6) mflr r0 .*: (05 00 9f 42|42 9f 00 05) bcl .* .*: (a6 02 68 7d|7d 68 02 a6) mflr r11 -- Petr Hracek Software Engineer Developer Experience Red Hat, Inc Mob: +420777056169 email: phracek@redhat.com --------------040500000405040301070806 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: 7bit
On 10/01/2015 09:43 AM, Eli Zaretskii wrote:
From: Petr Hracek <phracek@redhat.com>
Date: Wed, 30 Sep 2015 12:39:47 +0200
Cc: 20614@debbugs.gnu.org

My deep observation with emacs package and binutils:
1) binutils-2.23.52.0.1-30.el7_1.2.ppc64le.rpm works completely.
2) binutils-2.23.52.0.1-40.el7.ppc64le.rpm works if row
http://git.savannah.gnu.org/cgit/emacs.git/tree/src/unexelf.c?h=emacs-24#n869
is suppressed.

With newer version of binutils I can see the same series:( 
like:
Dumping under the name emacs
emacs: Program segment above .bss in
/builddir/build/BUILD/emacs-24.3/src/temacs
make[2]: Leaving directory `/builddir/build/BUILD/emacs-24.3/src'
make[2]: *** [bootstrap-emacs] Error 1

I have collected list of commits and messages against upstream:
#1200138
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=43a8475ca01b676fb764aaed0c4ed1cc16fc3c87 #1200138
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=eec2f3ed9f053653ed5d629eb50e08e3ee61e9bd #1203449
https://bugzilla.redhat.com/attachment.cgi?id=1003499 # 1175624 .opd
https://sourceware.org/ml/binutils/2015-01/msg00227.html
# 1175624 .got which implies .sdata, .sbss, .plt .iplt and .branch_lt also have
to move: https://sourceware.org/ml/binutils/2015-01/msg00228.html
# 1175624 And .toc1: https://sourceware.org/ml/binutils/2015-01/msg00232.html 
#1194164 func@localentry expressions, which was added to FSF binutils with git
commit 45965137
#1183838 https://bugzilla.redhat.com/attachment.cgi?id=986213
# 1172766 https://bugzilla.redhat.com/attachment.cgi?id=989450 I hope it helps
you a bit. 
I think we need help from someone who understands the Binutils part of
this.  Can you ask some of the Binutils maintainers please join this
discussion and analyze the problem?
Out binutils maintainers send me reference to following patch.
# Fix incorrectly generated ELF binaries and DSOs

diff -Nrup a/bfd/elf.c b/bfd/elf.c
--- a/bfd/elf.c	2015-07-28 10:52:10.941754850 -0600
+++ b/bfd/elf.c	2015-07-28 10:53:34.725982912 -0600
@@ -4081,11 +4081,18 @@ _bfd_elf_map_sections_to_segments (bfd *
 	      new_segment = TRUE;
 	    }
 	  else if ((last_hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) == 0
-		   && (hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) != 0)
+		   && (hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) != 0
+		   && ((abfd->flags & D_PAGED) == 0
+		       || (((last_hdr->lma + last_size - 1) & -maxpagesize)
+			   != (hdr->lma & -maxpagesize))))
 	    {
-	      /* We don't want to put a loadable section after a
-		 nonloadable section in the same segment.
-		 Consider .tbss sections as loadable for this purpose.  */
+	      /* We don't want to put a loaded section after a
+		 nonloaded (ie. bss style) section in the same segment
+		 as that will force the non-loaded section to be loaded.
+		 Consider .tbss sections as loaded for this purpose.
+		 However, like the writable/non-writable case below,
+		 if they are on the same page then they must be put
+		 in the same segment.  */
 	      new_segment = TRUE;
 	    }
 	  else if ((abfd->flags & D_PAGED) == 0)
diff -Nrup a/ld/testsuite/ld-powerpc/elfv2so.d b/ld/testsuite/ld-powerpc/elfv2so.d
--- a/ld/testsuite/ld-powerpc/elfv2so.d	2015-07-28 10:52:10.921755273 -0600
+++ b/ld/testsuite/ld-powerpc/elfv2so.d	2015-07-28 10:41:10.046732001 -0600
@@ -7,31 +7,31 @@
 
 Disassembly of section \.text:
 
-0+320 <.*\.plt_call\.f4>:
+0+300 <.*\.plt_call\.f4>:
 .*:	(18 00 41 f8|f8 41 00 18) 	std     r2,24\(r1\)
 .*:	(38 80 82 e9|e9 82 80 38) 	ld      r12,-32712\(r2\)
 .*:	(a6 03 89 7d|7d 89 03 a6) 	mtctr   r12
 .*:	(20 04 80 4e|4e 80 04 20) 	bctr
 
-0+330 <.*\.plt_call\.f3>:
+0+310 <.*\.plt_call\.f3>:
 .*:	(18 00 41 f8|f8 41 00 18) 	std     r2,24\(r1\)
 .*:	(28 80 82 e9|e9 82 80 28) 	ld      r12,-32728\(r2\)
 .*:	(a6 03 89 7d|7d 89 03 a6) 	mtctr   r12
 .*:	(20 04 80 4e|4e 80 04 20) 	bctr
 
-0+340 <.*\.plt_call\.f2>:
+0+320 <.*\.plt_call\.f2>:
 .*:	(18 00 41 f8|f8 41 00 18) 	std     r2,24\(r1\)
 .*:	(30 80 82 e9|e9 82 80 30) 	ld      r12,-32720\(r2\)
 .*:	(a6 03 89 7d|7d 89 03 a6) 	mtctr   r12
 .*:	(20 04 80 4e|4e 80 04 20) 	bctr
 
-0+350 <.*\.plt_call\.f1>:
+0+330 <.*\.plt_call\.f1>:
 .*:	(18 00 41 f8|f8 41 00 18) 	std     r2,24\(r1\)
 .*:	(40 80 82 e9|e9 82 80 40) 	ld      r12,-32704\(r2\)
 .*:	(a6 03 89 7d|7d 89 03 a6) 	mtctr   r12
 .*:	(20 04 80 4e|4e 80 04 20) 	bctr
 
-0+360 <f1>:
+0+340 <f1>:
 .*:	(02 00 4c 3c|3c 4c 00 02) 	addis   r2,r12,2
 .*:	(d8 81 42 38|38 42 81 d8) 	addi    r2,r2,-32296
 .*:	(a6 02 08 7c|7c 08 02 a6) 	mflr    r0
@@ -53,7 +53,7 @@ Disassembly of section \.text:
 .*:	(98 01 01 00|00 00 00 00) 	.*
 .*:	(00 00 00 00|00 01 01 98) 	.*
 
-0+3b0 <__glink_PLTresolve>:
+0+390 <__glink_PLTresolve>:
 .*:	(a6 02 08 7c|7c 08 02 a6) 	mflr    r0
 .*:	(05 00 9f 42|42 9f 00 05) 	bcl     .*
 .*:	(a6 02 68 7d|7d 68 02 a6) 	mflr    r11



-- 
Petr Hracek
Software Engineer
Developer Experience
Red Hat, Inc
Mob: +420777056169
email: phracek@redhat.com
--------------040500000405040301070806--