ref: 3e74db0e8da377cee03ec3c7825ddad168045055
parent: 58f2b962bf6b7b3197b146be69b983b62620026d
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Aug 25 05:01:53 EDT 2017
[driver] Improve message error generation We need the message errors of the linker because the user needs them to catch symbol errors. The fprintf of spawn was only seen with -d, so in case of missing some tool we were failing without seeing any message. Changing _Exit to abort forces validatetools() to print a message. In the same way, if the first tool that fails if different of CC1 or LD then we have to print an internal error message, because CC1 and LD are the only tools authorized to fail.
--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
@@ -280,12 +280,12 @@
dup2(t->out, 1);
if (t->in > -1)
dup2(t->in, 0);
- if (!dflag && tool != CC1)
+ if (!dflag && tool != CC1 && tool != LD)
dup2(devnullfd, 2);
execvp(t->cmd, t->args.s);
fprintf(stderr, "scc: execvp %s: %s\n",
t->cmd, strerror(errno));
- _exit(1);
+ abort();
default:
if (t->in > -1)
close(t->in);
@@ -334,7 +334,8 @@
if (waitpid(t->pid, &st, 0) < 0 ||
!WIFEXITED(st) ||
WEXITSTATUS(st) != 0) {
- if (!WIFEXITED(st) || tool != CC1 && tool != CC2) {
+ if (!WIFEXITED(st) ||
+ !failure && tool != CC1 && tool != LD) {
fprintf(stderr,
"scc:%s: internal error\n", t->bin);
}