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: Mon, 5 Oct 2015 16:07:43 +0200 Message-ID: <5612842F.7050102@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> <560D1EAA.3080608@redhat.com> <83bnciaidw.fsf@gnu.org> <560D3DC5.2050804@redhat.com> <837fn6a881.fsf@gnu.org> <560E420B.9070200@redhat.com> <83d1wx7j0e.fsf@gnu.org> <560E7F90.1070609@redhat.com> <83wpv55qog.fsf@gnu.org> <5612295F.4000607@redhat.com> <83twq5zpne.fsf@gnu.org> <56123FF0.3040104@redhat.com> <83oagdzmbj.fsf@gnu.org> <56125DBE.5090305@redhat.com> <83io6lzgpw.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1444054105 10541 80.91.229.3 (5 Oct 2015 14:08:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 5 Oct 2015 14:08:25 +0000 (UTC) Cc: 20614@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 05 16:08:17 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 1Zj6R3-0001Cz-8G for geb-bug-gnu-emacs@m.gmane.org; Mon, 05 Oct 2015 16:08:13 +0200 Original-Received: from localhost ([::1]:45930 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zj6R2-0005b3-Ey for geb-bug-gnu-emacs@m.gmane.org; Mon, 05 Oct 2015 10:08:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60915) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zj6Qx-0005ZW-JB for bug-gnu-emacs@gnu.org; Mon, 05 Oct 2015 10:08:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zj6Qt-0007QA-03 for bug-gnu-emacs@gnu.org; Mon, 05 Oct 2015 10:08:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:38112) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zj6Qs-0007Q5-TD for bug-gnu-emacs@gnu.org; Mon, 05 Oct 2015 10:08:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Zj6Qs-0008Gt-Fu for bug-gnu-emacs@gnu.org; Mon, 05 Oct 2015 10:08: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: Mon, 05 Oct 2015 14:08: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.144405407031774 (code B ref 20614); Mon, 05 Oct 2015 14:08:02 +0000 Original-Received: (at 20614) by debbugs.gnu.org; 5 Oct 2015 14:07:50 +0000 Original-Received: from localhost ([127.0.0.1]:55316 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zj6Qg-0008GP-0j for submit@debbugs.gnu.org; Mon, 05 Oct 2015 10:07:50 -0400 Original-Received: from mx1.redhat.com ([209.132.183.28]:20628) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zj6Qc-0008GE-8g for 20614@debbugs.gnu.org; Mon, 05 Oct 2015 10:07:47 -0400 Original-Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 55DACA2A0E; Mon, 5 Oct 2015 14:07:45 +0000 (UTC) Original-Received: from [10.40.200.18] (ovpn-200-18.brq.redhat.com [10.40.200.18]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t95E7hMY027502; Mon, 5 Oct 2015 10:07:44 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 In-Reply-To: <83io6lzgpw.fsf@gnu.org> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 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:107318 Archived-At: On 10/05/2015 01:40 PM, Eli Zaretskii wrote: >> Cc: 20614@debbugs.gnu.org >> From: Petr Hracek >> Date: Mon, 5 Oct 2015 13:23:42 +0200 >> >> But if fails with >> /home/phracek/rpmbuild/BUILD/emacs-24.3/src/unexelf.c:1263: undefined >> reference to `valid_pointer_p' > That function is static, so it's only known in alloc.c. Either remove > the 'static' qualifier from it, or copy it to unexelf.c. Well, with this patch (contains several traces): diff --git a/src/unexelf.c b/src/unexelf.c index d365940..e8765fd 100644 --- a/src/unexelf.c +++ b/src/unexelf.c @@ -389,6 +389,7 @@ temacs: #include extern void fatal (const char *msgid, ...); +extern int valid_pointer_p (void *); #include #include @@ -845,8 +846,7 @@ unexec (const char *new_name, const char *old_name) ElfW (Word) alignment = (NEW_PROGRAM_H (n)).p_align; if ((OLD_SECTION_H (old_bss_index)).sh_addralign > alignment) alignment = OLD_SECTION_H (old_bss_index).sh_addralign; - -#ifdef __sgi +#if defined __sgi || defined __powerpc64__ /* According to r02kar@x4u2.desy.de (Karsten Kuenne) and oliva@gnu.org (Alexandre Oliva), on IRIX 5.2, we always get "Program segment above .bss" when dumping @@ -866,8 +866,10 @@ unexec (const char *new_name, const char *old_name) == round_up (old_bss_addr, alignment))) break; } +#ifndef __powerpc64__ if (n < 0) fatal ("Couldn't find segment next to .bss in %s\n", old_name, 0); +#endif /* Make sure that the size includes any padding before the old .bss section. */ @@ -1251,6 +1253,14 @@ temacs: be no harm in that provided that r_offset is always the first member. */ nn = section.sh_info; + int ret = 0; + ret = valid_pointer_p ( old_section_names ); + fprintf(stderr, "old_section_names %d\n", ret); + ret = valid_pointer_p (NEW_SECTION_H (nn).sh_name); + fprintf(stderr, "NEW_SECTION_H (nn).sh_name) %d\n", ret); + ret = valid_pointer_p (old_section_names + NEW_SECTION_H (nn).sh_name); + fprintf(stderr, "old_section + NEW_SECTION %d\n", ret); + if (valid_pointer_p (old_section_names + NEW_SECTION_H (nn).sh_name) > 0) if (!strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".data") || !strcmp ((old_section_names + NEW_SECTION_H (nn).sh_name), ".sdata") Result is following: Finding pointers to doc strings...done Dumping under the name emacs ~~~~ some debugging data ~~~~ old_section_names 1 NEW_SECTION_H (nn).sh_name) 0 old_section + NEW_SECTION 1 old_section_names 1 NEW_SECTION_H (nn).sh_name) 0 old_section + NEW_SECTION 0 ~~~ end debugging data ~~~~ 87482 pure bytes used cd ../lisp; make -w compile-first EMACS=/home/phracek/rpmbuild/BUILD/emacs-24.3/src/bootstrap-emacs make[3]: Entering directory `/home/phracek/rpmbuild/BUILD/emacs-24.3/lisp' Compiling /home/phracek/rpmbuild/BUILD/emacs-24.3/lisp/emacs-lisp/macroexp.el /bin/sh: /home/phracek/rpmbuild/BUILD/emacs-24.3/src/bootstrap-emacs: cannot execute binary file make[3]: *** [/home/phracek/rpmbuild/BUILD/emacs-24.3/lisp/emacs-lisp/macroexp.elc] Error 126 make[3]: Leaving directory `/home/phracek/rpmbuild/BUILD/emacs-24.3/lisp' make[2]: *** [bootstrap-emacs] Error 2 make[2]: Leaving directory `/home/phracek/rpmbuild/BUILD/emacs-24.3/src' make[1]: *** [src] Error 2 make[1]: Leaving directory `/home/phracek/rpmbuild/BUILD/emacs-24.3' Some information about bootstrap-emacs binary: $ file /home/phracek/rpmbuild/BUILD/emacs-24.3/src/bootstrap-emacs /home/phracek/rpmbuild/BUILD/emacs-24.3/src/bootstrap-emacs: ELF 64-bit LSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), corrupted program header size, stripped $ If condition valid_pointer_p is set to >= 0 then it segfaults again. Where can be a problem now? -- Petr Hracek Software Engineer Developer Experience Red Hat, Inc Mob: +420777056169 email: phracek@redhat.com