better error message when LLVM does not understand a triple

This commit is contained in:
Andrew Kelley 2019-02-07 11:40:56 -05:00
parent a0590bda29
commit 2b2bf53a49
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9

View File

@ -7553,7 +7553,13 @@ static void init(CodeGen *g) {
LLVMTargetRef target_ref;
char *err_msg = nullptr;
if (LLVMGetTargetFromTriple(buf_ptr(&g->triple_str), &target_ref, &err_msg)) {
zig_panic("unable to create target based on: %s", buf_ptr(&g->triple_str));
fprintf(stderr,
"Zig is expecting LLVM to understand this target: '%s'\n"
"However LLVM responded with: \"%s\"\n"
"Zig is unable to continue. This is a bug in Zig:\n"
"https://github.com/ziglang/zig/issues/438\n"
, buf_ptr(&g->triple_str), err_msg);
exit(1);
}
bool is_optimized = g->build_mode != BuildModeDebug;