> The reason we only exit with zero here is because the
> semihosting API doesn't provide a way for the application
> to report a non-zero exit code. In this case you're
> distinguishing "application exit" from the other
> failure reasons, which seems OK, though. I'm just
> wary of patches trying to fix this issue because
> in the past they've generally ignored the fact that
> we're implementing a fixed API here and can't make
> random additions to it just because they happen to work
> with newlib or whatever.
OK, I see.
> Returning a negative exit code is bogus, though. You
> probably just want
> if (args == ADP_Stopped_ApplicationExit) {
> code = EXIT_SUCCESS;
> } else {
> code = EXIT_FAILURE;
> }
The idea was to distinguish the supported arguments from the unknown ones
(newlib only uses the listed two) but that would also work for me.
--
Eric Botcazou