[ cc'd to ports (re: ports/34661).  The problem here is that "gcl", in
  ports/lang, is not building due to a core dump.  This "patch" might
  fix it.  ]

I wrote:

> > PR ports/34661 :-)

>      Using 4-STABLE (sorry, I'm not using -current), I took a quick stab
> at the problem (having dealt with XEmacs undump issues in a past life),
> but I haven't gotten anywhere, yet:

     Well, the problem appears to be that undump() isn't properly
adjusting the ELF section headers.  The bug also seems to exist in
XEmacs (and probably GNU Emacs as well), but it's only triggered if a
small section (less than 32 bytes in size) exists before the BSS
section.  Hacky, ugly, not-for-public-consumption kludgy patch attached.
Apply in the "o" subdirectory.  Line numbers will be off, but the patch
should apply fine otherwise.  Due to non-functioning makefile
dependencies, you'll have to manually delete "o/unixsave.o" (or do a
"make clean") after applying this patch.

     I'm not sure if the patch is 100% correct, but it should be close.

     I probably won't have any more time to clean up the patch (e.g.,
eliminate the code duplication and debugging code), and so it would be
nice if someone else could do that and submit it.

-- 
        Darryl Okahata
        [EMAIL PROTECTED]

DISCLAIMER: this message is the author's personal opinion and does not
constitute the support, opinion, or policy of Agilent Technologies, or
of the little green men that have been following him all day.

*** unexelf.c.orig      Thu Mar 22 14:54:58 2001
--- unexelf.c   Wed Apr  3 21:48:40 2002
***************
*** 935,944 ****
              >= OLD_SECTION_H (old_bss_index-1).sh_offset)
            NEW_SECTION_H (nn).sh_offset += new_data2_size;
  #else
          if (round_up (NEW_SECTION_H (nn).sh_offset,
                        OLD_SECTION_H (old_bss_index).sh_addralign)
!             >= new_data2_offset)
            NEW_SECTION_H (nn).sh_offset += new_data2_size;
  #endif
          /* Any section that was originally placed after the section
             header table should now be off by the size of one section
--- 948,972 ----
              >= OLD_SECTION_H (old_bss_index-1).sh_offset)
            NEW_SECTION_H (nn).sh_offset += new_data2_size;
  #else
+ # if 1
+         if (round_up (NEW_SECTION_H (nn).sh_offset,
+                       OLD_SECTION_H (nn).sh_addralign > 0 ? OLD_SECTION_H 
+(nn).sh_addralign : 1) == new_data2_offset && OLD_SECTION_H(nn).sh_size > 0 ||
+             round_up (NEW_SECTION_H (nn).sh_offset,
+                       OLD_SECTION_H (nn).sh_addralign > 0 ? OLD_SECTION_H 
+(nn).sh_addralign : 1)
+             > new_data2_offset) {
+ # else
          if (round_up (NEW_SECTION_H (nn).sh_offset,
                        OLD_SECTION_H (old_bss_index).sh_addralign)
!             >= new_data2_offset) {
! # endif
! # ifdef DEBUG
!           fprintf(stderr,
!                   "Rounding up section %d, old: 0x%08x, new: 0x%08x\n",
!                   nn, NEW_SECTION_H (nn).sh_offset,
!                   NEW_SECTION_H (nn).sh_offset + new_data2_size);
! # endif
            NEW_SECTION_H (nn).sh_offset += new_data2_size;
+         }
  #endif
          /* Any section that was originally placed after the section
             header table should now be off by the size of one section

Reply via email to