Skip to content

Commit 4a0a817

Browse files
committed
goto-gcc/goto-ld: reproduce original help output
There are configure scripts that parse the --help output to obtain the set of supported targets. Without the original output those build systems are then led to believe that we don't support shared libraries (which in turn breaks some builds).
1 parent 9be731d commit 4a0a817

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)