diff options
author | Xavier Leroy <xavier.leroy@college-de-france.fr> | 2020-12-06 17:52:51 +0100 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@college-de-france.fr> | 2020-12-06 17:52:51 +0100 |
commit | b40aef6c55b837786cd749260e8e8d8a1d328034 (patch) | |
tree | 73c56c03c1b22ee2eb58fa45f9783302de7832f1 /driver | |
parent | 5e3898945c063801d4a93f44182d160ccfe4badc (diff) | |
download | compcert-kvx-b40aef6c55b837786cd749260e8e8d8a1d328034.tar.gz compcert-kvx-b40aef6c55b837786cd749260e8e8d8a1d328034.zip |
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.
Diffstat (limited to 'driver')
-rw-r--r-- | driver/Driver.ml | 2 |
1 files changed, 2 insertions, 0 deletions
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 |