ARM crt0.o: Add NULL to end of argv[]

Nick Clifton nickc@redhat.com
Mon Nov 18 07:20:00 GMT 2002


Hi Guys,

  I am applying the patch below to fix a small bug in the ARM crt0.o
  file for newlib.  The code was creating an argv[] array from the
  command line, but it was not terminating the array with a NULL
  pointer.  This is required by the ISO C specification, and this
  patch fixes the problem.

Cheers
        Nick

2002-11-18  Nick Clifton  <nickc@redhat.com>

	* libc/sys/arm/crt0.S: Add NULL to end of argv array.

Index: newlib/libc/sys/arm/crt0.S
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/arm/crt0.S,v
retrieving revision 1.6
diff -c -3 -p -w -r1.6 crt0.S
*** newlib/libc/sys/arm/crt0.S	30 Apr 2002 18:23:38 -0000	1.6
--- newlib/libc/sys/arm/crt0.S	18 Nov 2002 15:19:11 -0000
*************** __change_mode:	
*** 181,186 ****
--- 181,193 ----
  	bhi	.LC13
  #endif
  
+ 	/* Push a NULL argument onto the end of the list.  */
+ 	mov	r2, #0
+ #ifdef __thumb__
+ 	push	{r2}
+ #else
+ 	stmfd	sp!, {r1}
+ #endif
  #endif
  
  #ifdef __USES_INITFINI__



More information about the Newlib mailing list