From: Nick Clifton <nickc@redhat.com>
To: Richard.Earnshaw@arm.com
Cc: newlib@sources.redhat.com, gdb-patches@sources.redhat.com
Subject: Re: ARM crt0.o: Add NULL to end of argv[]
Date: Mon, 18 Nov 2002 08:30:00 -0000 [thread overview]
Message-ID: <m3wunayeb3.fsf@north-pole.nickc.cambridge.redhat.com> (raw)
In-Reply-To: <200211181552.gAIFqmt05403@pc960.cambridge.arm.com>
Hi Richard,
>
> > + /* Push a NULL argument onto the end of the list. */
> > + mov r2, #0
> > + #ifdef __thumb__
> > + push {r2}
> > + #else
> > + stmfd sp!, {r1}
> > + #endif
> > #endif
>
> That can't be right. The arm and thumb code push different registers!!!!
Doh!
> And even if you change that I'm not convinced. Surely you need to
> push this extra value *before* you reverse the list. Otherwise the
> first argument will be null, not the last.
Argh. I should not have gotten out of bed this morning. You are
right of course, I was putting the NULL at the wrong end of the list,
and it was only by chance that the test I as using to check the patch
was detecting a NULL at argv[argc]. *sigh*
Fixed by applying the patch below.
Cheers
Nick
Index: newlib/libc/sys/arm/crt0.S
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/arm/crt0.S,v
retrieving revision 1.7
diff -c -3 -p -w -r1.7 crt0.S
*** newlib/libc/sys/arm/crt0.S 18 Nov 2002 15:21:24 -0000 1.7
--- newlib/libc/sys/arm/crt0.S 18 Nov 2002 16:29:18 -0000
*************** __change_mode:
*** 95,100 ****
--- 95,106 ----
#endif
/* Parse string at r1 */
mov r0, #0 /* count of arguments so far */
+ /* Push a NULL argument onto the end of the list. */
+ #ifdef __thumb__
+ push {r0}
+ #else
+ stmfd sp!, {r0}
+ #endif
.LC10:
/* Skip leading blanks */
#ifdef __thumb__
*************** __change_mode:
*** 179,192 ****
strhi r5, [r2, #-4]!
strhi r4, [r3], #4
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
--- 185,190 ----
prev parent reply other threads:[~2002-11-18 16:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-18 7:20 Nick Clifton
2002-11-18 7:50 ` Richard Earnshaw
2002-11-18 7:53 ` Richard Earnshaw
2002-11-18 8:30 ` Nick Clifton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3wunayeb3.fsf@north-pole.nickc.cambridge.redhat.com \
--to=nickc@redhat.com \
--cc=Richard.Earnshaw@arm.com \
--cc=gdb-patches@sources.redhat.com \
--cc=newlib@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox