From ab1facc33a5f0f29e1854de4066a8c1e6677454f Mon Sep 17 00:00:00 2001 From: Sagi Mor Date: Sat, 7 Jan 2023 20:09:43 +0200 Subject: [PATCH] toolchain/toolchain-wrapper: make gcc --help -v work correctly make "gcc --help -v" display all the options, some packages depend on this https://bugs.busybox.net/show_bug.cgi?id=15231 Signed-off-by: Sagi Mor [Arnout: move the handling to the beginning and directly call execv] Signed-off-by: Arnout Vandecappelle (cherry picked from commit 9954315fc5b2026552a0f0175307ec8784b51578) Signed-off-by: Peter Korsgaard --- toolchain/toolchain-wrapper.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/toolchain/toolchain-wrapper.c b/toolchain/toolchain-wrapper.c index f66e588bfd..e436889760 100644 --- a/toolchain/toolchain-wrapper.c +++ b/toolchain/toolchain-wrapper.c @@ -310,6 +310,17 @@ int main(int argc, char **argv) perror(__FILE__ ": overflow"); return 3; } + + /* skip all processing --help is specified */ + for (i = 1; i < argc; i++) { + if (!strcmp(argv[i], "--help")) { + argv[0] = path; + if (execv(path, argv)) + perror(path); + return 1; + } + } + #ifdef BR_CCACHE ret = snprintf(ccache_path, sizeof(ccache_path), "%s/bin/ccache", absbasedir); if (ret >= sizeof(ccache_path)) {