From 4fdbb1884391168a2688816ef6ffa6f63ae0caf0 Mon Sep 17 00:00:00 2001 From: Roman Venediktov Date: Fri, 20 Dec 2024 15:58:09 +0100 Subject: [PATCH] Added failing if assembly compiler failed --- src/X86_64.ml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/X86_64.ml b/src/X86_64.ml index 627739a4b..7a6a82af6 100644 --- a/src/X86_64.ml +++ b/src/X86_64.ml @@ -1505,11 +1505,17 @@ let build cmd prog = (Buffer.contents buf) cmd#get_runtime_path (match cmd#march with `X86_32 -> "runtime32" | `AMD64 -> "runtime") in - Sys.command gcc_cmdline + let result = Sys.command gcc_cmdline in + if result <> 0 then + failwith + (Printf.sprintf "Assembly compiler failed with exit code %d" result) | `Compile -> let cmd = Printf.sprintf "%s %s %s -c -g %s.s" compiler compiler_flags debug_flags cmd#basename in - Sys.command cmd + let result = Sys.command cmd in + if result <> 0 then + failwith + (Printf.sprintf "Assembly compiler failed with exit code %d" result) | _ -> invalid_arg "must not happen"