This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGa23bf1786be7: [clang] [MinGW] Pass LTO options to the linker (authored by mstorsjo).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D158411/new/ https://reviews.llvm.org/D158411 Files: clang/lib/Driver/ToolChains/MinGW.cpp clang/test/Driver/mingw-lto.c Index: clang/test/Driver/mingw-lto.c =================================================================== --- clang/test/Driver/mingw-lto.c +++ clang/test/Driver/mingw-lto.c @@ -1,4 +1,6 @@ // The default linker doesn't support LLVM bitcode // RUN: not %clang --target=i686-pc-windows-gnu %s -flto -fuse-ld=bfd // When using lld, this is allowed though. -// RUN: %clang --target=i686-pc-windows-gnu -### %s -flto -fuse-ld=lld -B%S/Inputs/lld +// RUN: %clang --target=i686-pc-windows-gnu -### %s -flto -fuse-ld=lld -B%S/Inputs/lld -femulated-tls 2>&1 | FileCheck %s + +// CHECK: "-plugin-opt=-emulated-tls" Index: clang/lib/Driver/ToolChains/MinGW.cpp =================================================================== --- clang/lib/Driver/ToolChains/MinGW.cpp +++ clang/lib/Driver/ToolChains/MinGW.cpp @@ -238,6 +238,12 @@ AddLinkerInputs(TC, Inputs, Args, CmdArgs, JA); + if (D.isUsingLTO()) { + assert(!Inputs.empty() && "Must have at least one input."); + addLTOOptions(TC, Args, CmdArgs, Output, Inputs[0], + D.getLTOMode() == LTOK_Thin); + } + if (C.getDriver().IsFlangMode()) { addFortranRuntimeLibraryPath(TC, Args, CmdArgs); addFortranRuntimeLibs(TC, CmdArgs);
Index: clang/test/Driver/mingw-lto.c =================================================================== --- clang/test/Driver/mingw-lto.c +++ clang/test/Driver/mingw-lto.c @@ -1,4 +1,6 @@ // The default linker doesn't support LLVM bitcode // RUN: not %clang --target=i686-pc-windows-gnu %s -flto -fuse-ld=bfd // When using lld, this is allowed though. -// RUN: %clang --target=i686-pc-windows-gnu -### %s -flto -fuse-ld=lld -B%S/Inputs/lld +// RUN: %clang --target=i686-pc-windows-gnu -### %s -flto -fuse-ld=lld -B%S/Inputs/lld -femulated-tls 2>&1 | FileCheck %s + +// CHECK: "-plugin-opt=-emulated-tls" Index: clang/lib/Driver/ToolChains/MinGW.cpp =================================================================== --- clang/lib/Driver/ToolChains/MinGW.cpp +++ clang/lib/Driver/ToolChains/MinGW.cpp @@ -238,6 +238,12 @@ AddLinkerInputs(TC, Inputs, Args, CmdArgs, JA); + if (D.isUsingLTO()) { + assert(!Inputs.empty() && "Must have at least one input."); + addLTOOptions(TC, Args, CmdArgs, Output, Inputs[0], + D.getLTOMode() == LTOK_Thin); + } + if (C.getDriver().IsFlangMode()) { addFortranRuntimeLibraryPath(TC, Args, CmdArgs); addFortranRuntimeLibs(TC, CmdArgs);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits