emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/emacs-24 r111252: Improve AIX port some mor


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-24 r111252: Improve AIX port some more.
Date: Tue, 12 Feb 2013 10:43:11 -0800
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111252
fixes bug: http://debbugs.gnu.org/13650
committer: Paul Eggert <address@hidden>
branch nick: emacs-24
timestamp: Tue 2013-02-12 10:43:11 -0800
message:
  Improve AIX port some more.
  
  With this, it should be as good as it was in 23.3, though it's
  still pretty bad: the dumped emacs does not run.  See Mark Fleishman in
  http://lists.gnu.org/archive/html/help-gnu-emacs/2011-04/msg00287.html
  * unexaix.c (start_of_text): Remove.
  (_data, _text): Declare as char[], not int, as AIX manual suggests.
  (bias, lnnoptr, text_scnptr, data_scnptr, load_scnptr)
  (orig_load_scnptr, orig_data_scnptr):
  Now off_t, not long, since they are file offsets.
  (make_hdr): Use _data, not start_of_data ().
  This is the key part of the fix.
  (make_hdr, unrelocate_symbols): Use off_t for file offsets.
  (unrelocate_symbols): Cast pointers to intptr_t, not to ulong.
modified:
  src/ChangeLog
  src/unexaix.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-02-12 18:33:42 +0000
+++ b/src/ChangeLog     2013-02-12 18:43:11 +0000
@@ -1,5 +1,19 @@
 2013-02-12  Paul Eggert  <address@hidden>
 
+       Improve AIX port some more (Bug#13650).
+       With this, it should be as good as it was in 23.3, though it's
+       still pretty bad: the dumped emacs does not run.  See Mark Fleishman in
+       http://lists.gnu.org/archive/html/help-gnu-emacs/2011-04/msg00287.html
+       * unexaix.c (start_of_text): Remove.
+       (_data, _text): Declare as char[], not int, as AIX manual suggests.
+       (bias, lnnoptr, text_scnptr, data_scnptr, load_scnptr)
+       (orig_load_scnptr, orig_data_scnptr):
+       Now off_t, not long, since they are file offsets.
+       (make_hdr): Use _data, not start_of_data ().
+       This is the key part of the fix.
+       (make_hdr, unrelocate_symbols): Use off_t for file offsets.
+       (unrelocate_symbols): Cast pointers to intptr_t, not to ulong.
+
        * pre-crt0.c (data_start): Initialize to 1.
        This ports to compilers that optimize the external declaration
        'int x = 0;' as if it were 'int x;' to shrink the executable.

=== modified file 'src/unexaix.c'
--- a/src/unexaix.c     2013-02-11 20:32:54 +0000
+++ b/src/unexaix.c     2013-02-12 18:43:11 +0000
@@ -61,10 +61,8 @@
 
 #include "mem-limits.h"
 
-char *start_of_text (void);                    /* Start of text */
-
-extern int _data;
-extern int _text;
+extern char _data[];
+extern char _text[];
 
 #include <filehdr.h>
 #include <aouthdr.h>
@@ -73,15 +71,15 @@
 
 static struct filehdr f_hdr;           /* File header */
 static struct aouthdr f_ohdr;          /* Optional file header (a.out) */
-static long bias;                      /* Bias to add for growth */
-static long lnnoptr;                   /* Pointer to line-number info within 
file */
+static off_t bias;                     /* Bias to add for growth */
+static off_t lnnoptr;                  /* Pointer to line-number info within 
file */
 
-static long text_scnptr;
-static long data_scnptr;
+static off_t text_scnptr;
+static off_t data_scnptr;
 #define ALIGN(val, pwr) (((val) + ((1L<<(pwr))-1)) & ~((1L<<(pwr))-1))
-static long load_scnptr;
-static long orig_load_scnptr;
-static long orig_data_scnptr;
+static off_t load_scnptr;
+static off_t orig_load_scnptr;
+static off_t orig_data_scnptr;
 static int unrelocate_symbols (int, int, const char *, const char *);
 
 #ifndef MAX_SECTIONS
@@ -188,7 +186,7 @@
   pagemask = getpagesize () - 1;
 
   /* Adjust text/data boundary. */
-  data_start = (uintptr_t) start_of_data ();
+  data_start = (uintptr_t) _data;
 
   data_start = data_start & ~pagemask; /* (Down) to page boundary. */
 
@@ -288,7 +286,7 @@
 
   /* fix scnptr's */
   {
-    ulong ptr = section[0].s_scnptr;
+    off_t ptr = section[0].s_scnptr;
 
     bias = -1;
     for (scns = 0; scns < f_hdr.f_nscns; scns++)
@@ -384,12 +382,12 @@
   char *end;
   char *ptr;
 
-  lseek (new, (long) text_scnptr, SEEK_SET);
-  ptr = start_of_text () + text_scnptr;
+  lseek (new, text_scnptr, SEEK_SET);
+  ptr = _text + text_scnptr;
   end = ptr + f_ohdr.tsize;
   write_segment (new, ptr, end);
 
-  lseek (new, (long) data_scnptr, SEEK_SET);
+  lseek (new, data_scnptr, SEEK_SET);
   ptr = (char *) f_ohdr.data_start;
   end = ptr + f_ohdr.dsize;
   write_segment (new, ptr, end);
@@ -549,13 +547,13 @@
   int i;
   LDHDR ldhdr;
   LDREL ldrel;
-  ulong t_reloc = (ulong) &_text - f_ohdr.text_start;
+  off_t t_reloc = (intptr_t) _text - f_ohdr.text_start;
 #ifndef ALIGN_DATA_RELOC
-  ulong d_reloc = (ulong) &_data - f_ohdr.data_start;
+  off_t d_reloc = (intptr_t) _data - f_ohdr.data_start;
 #else
   /* This worked (and was needed) before AIX 4.2.
      I have no idea why. -- Mike */
-  ulong d_reloc = (ulong) &_data - ALIGN (f_ohdr.data_start, 2);
+  off_t d_reloc = (intptr_t) _data - ALIGN (f_ohdr.data_start, 2);
 #endif
   int * p;
 
@@ -640,16 +638,3 @@
     }
   return 0;
 }
-
-/*
- *     Return the address of the start of the text segment prior to
- *     doing an unexec.  After unexec the return value is undefined.
- *     See crt0.c for further explanation and _start.
- *
- */
-
-char *
-start_of_text (void)
-{
-  return ((char *) 0x10000000);
-}


reply via email to

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