diff --git a/src/goto-cc/gcc_mode.cpp b/src/goto-cc/gcc_mode.cpp index 55c3d973504..5459ad361c1 100644 --- a/src/goto-cc/gcc_mode.cpp +++ b/src/goto-cc/gcc_mode.cpp @@ -308,13 +308,6 @@ bool gcc_modet::needs_preprocessing(const std::string &file) /// does it. int gcc_modet::doit() { - if(cmdline.isset('?') || - cmdline.isset("help")) - { - help(); - return EX_OK; - } - native_tool_name= compiler_name(cmdline, base_name); @@ -375,6 +368,20 @@ int gcc_modet::doit() return EX_OK; // Exit! } + // In hybrid mode, when --help is requested, just reproduce the output of the + // original compiler. This is so as not to confuse configure scripts that + // depend on particular information (such as the list of supported targets). + if(cmdline.isset("help") && produce_hybrid_binary) + { + help(); + return run_gcc(compiler); + } + else if(cmdline.isset('?') || cmdline.isset("help")) + { + help(); + return EX_OK; + } + if( cmdline.isset("dumpmachine") || cmdline.isset("dumpspecs") || cmdline.isset("dumpversion") || cmdline.isset("print-sysroot") || diff --git a/src/goto-cc/ld_mode.cpp b/src/goto-cc/ld_mode.cpp index b4e9ae14df9..b443a4ef033 100644 --- a/src/goto-cc/ld_mode.cpp +++ b/src/goto-cc/ld_mode.cpp @@ -62,16 +62,18 @@ ld_modet::ld_modet(goto_cc_cmdlinet &_cmdline, const std::string &_base_name) /// does it. int ld_modet::doit() { - if(cmdline.isset("help")) - { - help(); - return EX_OK; - } - native_tool_name = linker_name(cmdline, base_name); - if(cmdline.isset("version") || cmdline.isset("print-sysroot")) + // When --help is requested, just reproduce the output of the original + // compiler. This is so as not to confuse configure scripts that depend on + // particular information (such as the list of supported targets). + if( + cmdline.isset("help") || cmdline.isset("version") || + cmdline.isset("print-sysroot")) + { + help(); return run_ld(); + } messaget::eval_verbosity( cmdline.get_value("verbosity"), messaget::M_ERROR, gcc_message_handler);