From b40aef6c55b837786cd749260e8e8d8a1d328034 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Sun, 6 Dec 2020 17:52:51 +0100 Subject: Error when using -main without -interp Outside of -interp mode, -main has no (known) effect but could be confused for a linker option that sets the program's entrypoint, say. It's safer to reject the option. --- driver/Driver.ml | 2 ++ 1 file changed, 2 insertions(+) (limited to 'driver') diff --git a/driver/Driver.ml b/driver/Driver.ml index 043e43c1..2b34d538 100644 --- a/driver/Driver.ml +++ b/driver/Driver.ml @@ -412,6 +412,8 @@ let _ = fatal_error no_loc "ambiguous '-o' option (multiple source files)"; if !num_input_files = 0 then fatal_error no_loc "no input file"; + if not !option_interp && !main_function_name <> "main" then + fatal_error no_loc "option '-main' requires option '-interp'"; let linker_args = time "Total compilation time" perform_actions () in if not (nolink ()) && linker_args <> [] then begin linker (output_filename_default "a.out") linker_args -- cgit