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: Mon, 5 Oct 2015 16:07:43 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0

On 10/05/2015 01:40 PM, Eli Zaretskii wrote:
Cc: 20614@debbugs.gnu.org
From: Petr Hracek <phracek@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@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






reply via email to

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