Bug 1068 - Segmentation fault in libiberty/xexit.c:51
Summary: Segmentation fault in libiberty/xexit.c:51
Status: RESOLVED DUPLICATE of bug 1069
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.16
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-14 13:39 UTC by Paul Woegerer
Modified: 2005-07-14 16:46 UTC (History)
2 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: crx-unknown-elf
Build: i686-pc-linux-gnu
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Woegerer 2005-07-14 13:39:58 UTC
The i686-pc-linux-gnu build of the assembler from binutils 2.16 crx-port
creates a segmentation fault with the assembly file below. This time the
problem is located in libiberty/xexit.c where the function pointer named
_xexit_cleanup in line 44 is NOT initialized to NULL.

The following patch for xexit.c (Revision 1.7) fixes this problem:

-------------------------------------------- patch for libiberty/xexit.c

*** xexit.c     2005-07-14 10:19:14.399002000 +0200
--- xexit_fixed.c       2005-07-14 10:37:09.358001000 +0200
***************
*** 41,47 ****

  /* This variable is set by xatexit if it is called.  This way, xmalloc
     doesn't drag xatexit into the link.  */
! void (*_xexit_cleanup) (void);

  void
  xexit (int code)
--- 41,47 ----

  /* This variable is set by xatexit if it is called.  This way, xmalloc
     doesn't drag xatexit into the link.  */
! void (*_xexit_cleanup) (void) = NULL;

  void
  xexit (int code) 

--------------------------------------------- libiberty-xexit-segfault.s 

        .size  
__ZNK1S1fElllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllc,
.-__ZNK1S1fElllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllc
        .section        .text
        .align  4
        .globl  _main
        .type   _main, @function
_main:
        bal     ra,
__ZNK1S1fElllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllc
        .size   _main, .-_main
Comment 1 Ian Lance Taylor 2005-07-14 16:45:08 UTC
Your patch can not be correct, because global variables are implicitly
initialized to NULL.  There must be something else going on.  Can you show
precisely how you configured the binutils?  Is this unmodified FSF binutils 2.16
sources?
Comment 2 Ian Lance Taylor 2005-07-14 16:46:57 UTC
I see now that this was duplicated as PR 1069, and fixed there.

*** This bug has been marked as a duplicate of 1069 ***