You're absolutely right...thanks Karl! Clearly my constructors aren't doing any comparisons that set the zero flag (since this works for me) per Karl's comment, the comparison of r5 to zero should be done again after the constructor returns and before the bne... and then there are probably more elegant solutions. --- In lpc2000@yahoogroups.com, "Karl Olsen" <kro@p...> wrote: > --- In lpc2000@yahoogroups.com, "dave_albert" <david_albert@h...> > wrote: > > Here's a snippet of code I use to call C++ constructors in crt0.S > > I call it after clearing .bss and initializing .data: > > > > > > /* Call global C++ object constructors */ > > > > ldr r4, =__CTOR_LIST__ @ Null terminated list of ctors > > Ctor_Loop: > > ldr r5, [r4], #+4 @ Fetch constructor address > > cmp r5, #0 @ Test for end of list > > addne lr, pc, #4 @ Save return address > > movne pc, r5 @ Call constructor > > bne Ctor_Loop @ Continue for all constructors > > > > Won't the called constructor likely modify the zero flag so that > the "bne Ctor_Loop" might terminate the loop prematurely? > > Karl Olsen
Message
Re: Constructors
2004-09-22 by dave_albert
Attachments
- No local attachments were found for this message.