From fe68e8b457edffc16b930def7dd9ca45da393062 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20P=C3=B6chtrager?= Date: Tue, 24 Oct 2017 21:59:53 +0200 Subject: [PATCH] Fix for #135 --- wrapper/target.cpp | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/wrapper/target.cpp b/wrapper/target.cpp index 48f0c48..a4f18b5 100644 --- a/wrapper/target.cpp +++ b/wrapper/target.cpp @@ -794,17 +794,31 @@ bool Target::setup() { } } - if (isClang() && clangversion >= ClangVersion(3, 8)) { - // - // Silence: - // warning: libLTO.dylib relative to clang installed dir not found; - // using 'ld' default search path instead - // - // '-flto' will of course work nevertheless, it's just a buggy - // cross-compilation warning. - // - if (wliblto == -1) - fargs.push_back("-Wno-liblto"); + if (isClang()) { + if (clangversion >= ClangVersion(3, 8)) { + // + // Silence: + // warning: libLTO.dylib relative to clang installed dir not found; + // using 'ld' default search path instead + // + // '-flto' will of course work nevertheless, it's just a buggy + // cross-compilation warning. + // + if (wliblto == -1) + fargs.push_back("-Wno-liblto"); + } + } else if (isGCC()) { + if (args.empty() || (args.size() == 1 && args[0] == "-v")) { + // + // HACK: + // Discard all arguments besides the first one + // (which is -apple-darwinXX-gcc) to fix the issue + // described in #135. + // + + while (fargs.size() > 1) + fargs.erase(fargs.end() - 1); + } } return true;