bero created this revision. bero added a reviewer: llvm-commits. bero added a project: clang. Herald added subscribers: cfe-commits, dexonsmith, inglorion, mehdi_amini.
Fix clang -Os/-Oz with LTO $ clang -Os -fuse-ld=lld -flto test.c ld.lld: error: -plugin-opt=Os: number expected, but got 's' clang-9: error: linker command failed with exit code 1 (use -v to see invocation) $ clang -Oz -fuse-ld=lld -flto test.c ld.lld: error: -plugin-opt=Oz: number expected, but got 'z' clang-9: error: linker command failed with exit code 1 (use -v to see invocation) https://bugs.llvm.org/show_bug.cgi?id=42445 Repository: rC Clang https://reviews.llvm.org/D63976 Files: llvm-9.0.0-20190629/clang/lib/Driver/ToolChains/CommonArgs.cpp Index: llvm-9.0.0-20190629/clang/lib/Driver/ToolChains/CommonArgs.cpp =================================================================== --- llvm-9.0.0-20190629/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ llvm-9.0.0-20190629/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -389,8 +389,11 @@ if (A->getOption().matches(options::OPT_O4) || A->getOption().matches(options::OPT_Ofast)) OOpt = "3"; - else if (A->getOption().matches(options::OPT_O)) + else if (A->getOption().matches(options::OPT_O)) { OOpt = A->getValue(); + if(OOpt == "s" || OOpt == "z") + OOpt = "3"; + } else if (A->getOption().matches(options::OPT_O0)) OOpt = "0"; if (!OOpt.empty())
Index: llvm-9.0.0-20190629/clang/lib/Driver/ToolChains/CommonArgs.cpp =================================================================== --- llvm-9.0.0-20190629/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ llvm-9.0.0-20190629/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -389,8 +389,11 @@ if (A->getOption().matches(options::OPT_O4) || A->getOption().matches(options::OPT_Ofast)) OOpt = "3"; - else if (A->getOption().matches(options::OPT_O)) + else if (A->getOption().matches(options::OPT_O)) { OOpt = A->getValue(); + if(OOpt == "s" || OOpt == "z") + OOpt = "3"; + } else if (A->getOption().matches(options::OPT_O0)) OOpt = "0"; if (!OOpt.empty())
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits