GNU bug report logs - #20614
Segmentation fault when building on Power8 Little Endian

Previous Next

Package: emacs;

Reported by: Petr Hracek <phracek <at> redhat.com>

Date: Wed, 20 May 2015 07:59:01 UTC

Severity: important

Tags: patch

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #150 received at 20614 <at> debbugs.gnu.org (full text, mbox):

From: Petr Hracek <phracek <at> redhat.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 20614 <at> debbugs.gnu.org
Subject: Re: bug#20614: Segmentation fault when building on Power8 Little
 Endian
Date: Mon, 5 Oct 2015 16:07:43 +0200
On 10/05/2015 01:40 PM, Eli Zaretskii wrote:
>> Cc: 20614 <at> debbugs.gnu.org
>> From: Petr Hracek <phracek <at> redhat.com>
>> 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 <unexec.h>

 extern void fatal (const char *msgid, ...);
+extern int valid_pointer_p (void *);

 #include <sys/types.h>
 #include <stdint.h>
@@ -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 <at> x4u2.desy.de (Karsten Kuenne)
          and oliva <at> 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 <at> redhat.com





This bug report was last modified 9 years and 171 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.