Skip to content

Commit fd457d2

Browse files
authored
Merge pull request #7588 from tautschnig/bugfixes/goto-ld
goto-gcc/goto-ld: reproduce original help output
2 parents 42c350e + 4a0a817 commit fd457d2

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

src/goto-cc/gcc_mode.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -308,13 +308,6 @@ bool gcc_modet::needs_preprocessing(const std::string &file)
308308
/// does it.
309309
int gcc_modet::doit()
310310
{
311-
if(cmdline.isset('?') ||
312-
cmdline.isset("help"))
313-
{
314-
help();
315-
return EX_OK;
316-
}
317-
318311
native_tool_name=
319312
compiler_name(cmdline, base_name);
320313

@@ -375,6 +368,20 @@ int gcc_modet::doit()
375368
return EX_OK; // Exit!
376369
}
377370

371+
// In hybrid mode, when --help is requested, just reproduce the output of the
372+
// original compiler. This is so as not to confuse configure scripts that
373+
// depend on particular information (such as the list of supported targets).
374+
if(cmdline.isset("help") && produce_hybrid_binary)
375+
{
376+
help();
377+
return run_gcc(compiler);
378+
}
379+
else if(cmdline.isset('?') || cmdline.isset("help"))
380+
{
381+
help();
382+
return EX_OK;
383+
}
384+
378385
if(
379386
cmdline.isset("dumpmachine") || cmdline.isset("dumpspecs") ||
380387
cmdline.isset("dumpversion") || cmdline.isset("print-sysroot") ||

src/goto-cc/ld_mode.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,18 @@ ld_modet::ld_modet(goto_cc_cmdlinet &_cmdline, const std::string &_base_name)
6262
/// does it.
6363
int ld_modet::doit()
6464
{
65-
if(cmdline.isset("help"))
66-
{
67-
help();
68-
return EX_OK;
69-
}
70-
7165
native_tool_name = linker_name(cmdline, base_name);
7266

73-
if(cmdline.isset("version") || cmdline.isset("print-sysroot"))
67+
// When --help is requested, just reproduce the output of the original
68+
// compiler. This is so as not to confuse configure scripts that depend on
69+
// particular information (such as the list of supported targets).
70+
if(
71+
cmdline.isset("help") || cmdline.isset("version") ||
72+
cmdline.isset("print-sysroot"))
73+
{
74+
help();
7475
return run_ld();
76+
}
7577

7678
messaget::eval_verbosity(
7779
cmdline.get_value("verbosity"), messaget::M_ERROR, gcc_message_handler);

0 commit comments

Comments
 (0)