public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* ld crash in vinfo
@ 2003-06-20 20:59 Shaun Jackman
  2003-06-21  7:28 ` Nick Clifton
  0 siblings, 1 reply; 4+ messages in thread
From: Shaun Jackman @ 2003-06-20 20:59 UTC (permalink / raw)
  To: binutils

ld is crashing on me when trying to build a dll for arm-wince-pe. I've
attached a back-trace below. Any idea what's causing this?

Thanks,
Shaun


GNU ld version 2.13.91 20030506
arm-wince-pe-gcc (GCC) 3.3

/usr/local/wince/lib/gcc-lib/arm-wince-pe/3.3/collect2 -X -opathportjni.exe -e_DllMain -L.libs -L/usr/local/wince/lib/gcc-lib/arm-wince-pe/3.3 -L/usr/local/wince/lib/gcc-lib/arm-wince-pe/3.3/../../../../arm-wince-pe/lib --base-file=pathportjni.base pathportjni-exports.o --dll --subsystem=wince:3.00 -lpathportjni -lpathport -lsupc++ -lm -lc -lgcc -lcoredll -lwinsock
collect2: ld terminated with signal 11 [Segmentation fault], core dumped

(gdb) bt
#0  0x4207a703 in strlen () from /lib/tls/libc.so.6
#1  0x42062412 in fputs () from /lib/tls/libc.so.6
#2  0x080590d0 in vfinfo (fp=0x4212ff80, fmt=0x80a3a07 ":%d: %s\n",
    arg=0xbfffd628 "") at ../../../binutils-2.13.91/ld/ldmisc.c:181
#3  0x08059884 in einfo (fmt=0x80a3a01 "%P: %s:%d: %s\n")
    at ../../../binutils-2.13.91/ld/ldmisc.c:442
#4  0x0805e2c7 in def_error (err=0x809404c "parse error")
    at /a/gnu/cross-gcc-build-arm/binutils/ld/../../../binutils-2.13.91/ld/deffilep.y:846
#5  0x0805d740 in def_parse () at /usr/share/bison/bison.simple:799
#6  0x0805dec5 in def_file_add_directive (my_def=0x0,
    param=0x84ecf68 "-heap 0x100000,0x1000 ", len=48)
    at /a/gnu/cross-gcc-build-arm/binutils/ld/../../../binutils-2.13.91/ld/deffilep.y:631
#7  0x0805eb28 in process_def_file (abfd=0x80bb908, info=0x80b68c0)
    at ../../../binutils-2.13.91/ld/pe-dll.c:562
#8  0x0806283d in pe_dll_build_sections (abfd=0x80bb908, info=0x80b68c0)
    at ../../../binutils-2.13.91/ld/pe-dll.c:2673
#9  0x0805c266 in gld_armpe_after_open () at earmpe.c:1008
#10 0x08058ada in ldemul_after_open ()
    at ../../../binutils-2.13.91/ld/ldemul.c:66
#11 0x08052d2a in lang_process () at ../../../binutils-2.13.91/ld/ldlang.c:4297
#12 0x080553e9 in main (argc=1, argv=0xbfffdd04)
---Type <return> to continue, or q <return> to quit---
    at ../../../binutils-2.13.91/ld/ldmain.c:469
#13 0x420156a4 in __libc_start_main () from /lib/tls/libc.so.6


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ld crash in vinfo
  2003-06-20 20:59 ld crash in vinfo Shaun Jackman
@ 2003-06-21  7:28 ` Nick Clifton
  2003-06-23 14:51   ` Shaun Jackman
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Clifton @ 2003-06-21  7:28 UTC (permalink / raw)
  To: Shaun Jackman; +Cc: binutils

Hi Shaun,

> ld is crashing on me when trying to build a dll for
> arm-wince-pe. I've attached a back-trace below. Any idea what's
> causing this?

Would it be possible for you to generate a *small* test case that
reproduces the problem ?

Cheers
        Nick
        

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ld crash in vinfo
  2003-06-21  7:28 ` Nick Clifton
@ 2003-06-23 14:51   ` Shaun Jackman
  2003-06-26 17:01     ` Nick Clifton
  0 siblings, 1 reply; 4+ messages in thread
From: Shaun Jackman @ 2003-06-23 14:51 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

This crashes for me.

cat > hello.def <<EOF
LIBRARY     hello
STACKSIZE   0x100000, 0x1000
HEAPSIZE    0x100000, 0x1000
EXPORTS
_hello
EOF
arm-wince-pe-gcc -nostdlib -e _DllMain -Wl,--dll -Wl,--subsystem=wince:3.00  -Wl,--base-file=hello.base -o hello.dll  -lsupc++ -lm -lc -lgcc
arm-wince-pe-dlltool -D hello.dll -d hello.def -b hello.base -e hello.exp
arm-wince-pe-gcc -nostdlib -e _DllMain -Wl,--dll -Wl,--subsystem=wince:3.00  -Wl,--base-file=hello.base -o hello.dll  hello.exp -lsupc++ -lm -lc -lgcc

I'm interested in knowing if you see the same thing.

Thanks,
Shaun


On Sat, 2003-06-21 at 01:22, Nick Clifton wrote:
> Hi Shaun,
> 
> > ld is crashing on me when trying to build a dll for
> > arm-wince-pe. I've attached a back-trace below. Any idea what's
> > causing this?
> 
> Would it be possible for you to generate a *small* test case that
> reproduces the problem ?
> 
> Cheers
>         Nick
>         
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ld crash in vinfo
  2003-06-23 14:51   ` Shaun Jackman
@ 2003-06-26 17:01     ` Nick Clifton
  0 siblings, 0 replies; 4+ messages in thread
From: Nick Clifton @ 2003-06-26 17:01 UTC (permalink / raw)
  To: Shaun Jackman; +Cc: binutils

Hi Shaun,

> This crashes for me.
>
> cat > hello.def <<EOF
> LIBRARY     hello
> STACKSIZE   0x100000, 0x1000
> HEAPSIZE    0x100000, 0x1000
> EXPORTS
> _hello
> EOF
> arm-wince-pe-gcc -nostdlib -e _DllMain -Wl,--dll -Wl,--subsystem=wince:3.00  -Wl,--base-file=hello.base -o hello.dll  -lsupc++ -lm -lc -lgcc
> arm-wince-pe-dlltool -D hello.dll -d hello.def -b hello.base -e hello.exp
> arm-wince-pe-gcc -nostdlib -e _DllMain -Wl,--dll -Wl,--subsystem=wince:3.00  -Wl,--base-file=hello.base -o hello.dll  hello.exp -lsupc++ -lm -lc -lgcc
>
> I'm interested in knowing if you see the same thing.

I do indeed.  This test case exposed several bugs in the linker's
.def file parser.  The attached patch should fix them though.  Please
could you try it out and let me know if it works ?

Cheers
        Nick

2003-06-26  Nick Clifton  <nickc@redhat.com>

	* deffilep.y (def_file_add_directive): Cope with NUL seperated
	directives.  Fix reporting of unparseable directives.
        (def_error): Check for a NULL def_filename.
          

Index: deffilep.y
===================================================================
RCS file: /cvs/src/src/ld/deffilep.y,v
retrieving revision 1.14
diff -c -3 -p -r1.14 deffilep.y
*** deffilep.y	18 Mar 2003 21:33:43 -0000	1.14
--- deffilep.y	26 Jun 2003 16:56:46 -0000
*************** def_file_add_directive (my_def, param, l
*** 601,618 ****
  {
    def_file *save_def = def;
    const char *pend = param + len;
!   const char *tend = param;
    int i;
  
    def = my_def;
  
    while (param < pend)
      {
!       while (param < pend && ISSPACE (*param))
  	param++;
  
!       for (tend = param + 1;
! 	   tend < pend && !(ISSPACE (tend[-1]) && *tend == '-');
  	   tend++)
  	;
  
--- 601,626 ----
  {
    def_file *save_def = def;
    const char *pend = param + len;
!   char * tend = (char *) param;
    int i;
  
    def = my_def;
  
    while (param < pend)
      {
!       while (param < pend && (ISSPACE (*param) || * param == '\n' || * param == 0))
  	param++;
  
!       if (param == pend)
! 	break;
! 
!       /* Scan forward until we encounter any of:
!           - the end of the buffer
! 	  - the start of a new option
! 	  - a newline seperating options
!           - a NUL seperating options.  */
!       for (tend = (char *) (param + 1);
! 	   tend < pend && !(ISSPACE (tend[-1]) && *tend == '-') && (*tend != '\n') && (*tend != 0);
  	   tend++)
  	;
  
*************** def_file_add_directive (my_def, param, l
*** 628,642 ****
  	      lex_parse_string = param + len + 1;
  	      lex_forced_token = diropts[i].token;
  	      saw_newline = 0;
! 	      def_parse ();
  	      break;
  	    }
  	}
  
        if (!diropts[i].param)
! 	/* xgettext:c-format */
! 	einfo (_("Warning: .drectve `%.*s' unrecognized\n"),
! 	       tend - param, param);
  
        lex_parse_string = 0;
        param = tend;
--- 636,657 ----
  	      lex_parse_string = param + len + 1;
  	      lex_forced_token = diropts[i].token;
  	      saw_newline = 0;
! 	      if (def_parse ())
! 		continue;
  	      break;
  	    }
  	}
  
        if (!diropts[i].param)
! 	{
! 	  char saved;
! 
! 	  saved = * tend;
! 	  * tend = 0;
! 	  /* xgettext:c-format */
! 	  einfo (_("Warning: .drectve `%s' unrecognized\n"), param);
! 	  * tend = saved;
! 	}
  
        lex_parse_string = 0;
        param = tend;
*************** static int
*** 843,849 ****
  def_error (err)
       const char *err;
  {
!   einfo ("%P: %s:%d: %s\n", def_filename, linenumber, err);
  
    return 0;
  }
--- 858,864 ----
  def_error (err)
       const char *err;
  {
!   einfo ("%P: %s:%d: %s\n", def_filename ? def_filename : "<unknown-file>", linenumber, err);
  
    return 0;
  }

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-06-26 17:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-20 20:59 ld crash in vinfo Shaun Jackman
2003-06-21  7:28 ` Nick Clifton
2003-06-23 14:51   ` Shaun Jackman
2003-06-26 17:01     ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).