Subject: bug#17540: AIX - gcc 7.8.2 - Emacs pretest 24.3.91 - bootstrap-emacs SIGSEV

From: Paul Eggert <[email-masked]>
Date: Thu, 22 May 2014 01:18:08 -0700

I tried building Emacs pretest 24.3.91 on an AIX 7.1 POWER host and got 
the same problem.  The attached patch fixed things for me, so I 
installed it as emacs-24 bzr 117140.  Could you please try the attached 
patch on your AIX host, in 32-bit mode?  Please patch just 
src/unexaix.c, as the patch to 'configure.ac' is likely to cause you 
more trouble than it's worth if you're trying to build on AIX 6.  Thanks.

PS.  As far as I know Emacs has never worked on 64-bit AIX, so I didn't 
look at getting that working.
=== modified file 'ChangeLog'
--- ChangeLog	2014-05-18 22:41:22 +0000
+++ ChangeLog	2014-05-22 04:45:28 +0000
@@ -1,3 +1,9 @@
+2014-05-22  Paul Eggert  <[email-masked]>
+
+	Fix port to 32-bit AIX (Bug#17540).
+	* configure.ac (opsys): On Power Architecture, treat release 7 of
+	AIX like releases 5 and 6.
+
 2014-05-18  Glenn Morris  <[email-masked]>
 
 	* configure.ac (INSTALL_INFO):

=== modified file 'configure.ac'
--- configure.ac	2014-05-18 22:41:22 +0000
+++ configure.ac	2014-05-22 04:39:25 +0000
@@ -550,7 +550,7 @@
   rs6000-ibm-aix[56]* )
     opsys=aix4-2
   ;;
-  powerpc-ibm-aix[56]*  )
+  powerpc-ibm-aix[5-9]* | powerpc-ibm-aix[1-9][0-9]* )
     opsys=aix4-2
   ;;

=== modified file 'src/ChangeLog'
--- src/ChangeLog	2014-05-21 15:03:18 +0000
+++ src/ChangeLog	2014-05-22 04:44:33 +0000
@@ -1,3 +1,10 @@
+2014-05-22  Paul Eggert  <[email-masked]>
+
+	Fix port to 32-bit AIX (Bug#17540).
+	* unexaix.c (copy_text_and_data): Don't add text_scnptr to ptr
+	twice.  _text already includes this offset.
+	(unrelocate_symbols): Don't cast 64-bit integer to pointer.
+
 2014-05-21  Eli Zaretskii  <[email-masked]>
 
 	* xdisp.c (move_it_in_display_line_to): Avoid infinite recursion:

=== modified file 'src/unexaix.c'
--- src/unexaix.c	2014-01-01 07:43:34 +0000
+++ src/unexaix.c	2014-05-22 04:38:15 +0000
@@ -379,7 +379,7 @@
   char *ptr;
 
   lseek (new, text_scnptr, SEEK_SET);
-  ptr = _text + text_scnptr;
+  ptr = _text;
   end = ptr + f_ohdr.tsize;
   write_segment (new, ptr, end);
 
@@ -606,7 +606,7 @@
 	      PERROR (a_name);
 	    }
 
-          p = (int *) (ldrel.l_vaddr + d_reloc);
+          p = (int *) (intptr_t) (ldrel.l_vaddr + d_reloc);
 
 	  switch (ldrel.l_symndx) {
 	  case SYMNDX_TEXT: