Commit 5bdcc54a authored by Shawn Webb's avatar Shawn Webb
Browse files

HBSD: Hack llvm-ar to exibit the same behavior on error as elftc-ar



elftc-ar doesn't exit with a non-zero exitcode on an error condition.
The ports build framework gets tricked by elftc-ar in these error
conditions. llvm-ar does the right thing, but that causes some ports[0]
to fail to build. For now, introduce a hack in llvm-ar to match the
(what I think is incorrect) behavior in elftc-ar.

From here, I'll report on the freebsd-toolchain mailing list, where
there's already an experimental patch for using llvm-ar, llvm-nm, and
llvm-objdump for building base. I'll also report to elftc-ar about the
errant error handling. We'll keep the patch until either elftc-ar or
the majority of ports entries are fixed.
Signed-off-by: Shawn Webb's avatarShawn Webb <shawn.webb@hardenedbsd.org>
parent 44ce1496
......@@ -150,7 +150,7 @@ LLVM_ATTRIBUTE_NORETURN static void fail(Twine Error) {
} else {
WithColor::error(errs(), ToolName) << Error << "\n";
}
exit(1);
exit(0);
}
static void failIfError(std::error_code EC, Twine Context = "") {
......@@ -1283,11 +1283,11 @@ int main(int argc, char **argv) {
if (Is("dlltool"))
return dlltoolDriverMain(makeArrayRef(argv, argc));
if (Is("ranlib"))
return ranlib_main(argc, argv);
return (ranlib_main(argc, argv) || 0);
if (Is("lib"))
return libDriverMain(makeArrayRef(argv, argc));
if (Is("ar"))
return ar_main(argc, argv);
return (ar_main(argc, argv) || 0);
fail("not ranlib, ar, lib or dlltool");
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment