bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20614: Segmentation fault when building on Power8 Little Endian


From: Petr Hracek
Subject: bug#20614: Segmentation fault when building on Power8 Little Endian
Date: Thu, 1 Oct 2015 13:44:01 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]