This is always an ugly place to poke around. :(
The code in newlib/libc/stdlib/exit.c walks the atexit chain for the
reentrancy structure for JUST the current task. The code in libc_wrapup()
does it for both the current task and the global reentrancy structure
(which tends to be where driver atexit()'s were registered.
So I think the _wrapup_reent(0) in libc_wrapup() should be commented out.
If you concur, then I will make the change and improve the comment on this
line of code to explain things:
libc_wrapup(); /* Why? XXX */
--joel
That does the job. cdtest.exe works correctly now.