<div dir="auto"><div>Hi Sterling,<div dir="auto"><br></div><div dir="auto">For a rollback, it's useful to list in the commit message why the change is being rolled back. Thanks!</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 29 Jan 2019, 10:27 Sterling Augustine via cfe-commits, <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: saugustine<br>
Date: Tue Jan 29 10:27:51 2019<br>
New Revision: 352524<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=352524&view=rev" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=352524&view=rev</a><br>
Log:<br>
Rollback unwindlib patch.<br>
<br>
Removed:<br>
cfe/trunk/test/Driver/compiler-rt-unwind.c<br>
Modified:<br>
cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td<br>
cfe/trunk/include/clang/Driver/Options.td<br>
cfe/trunk/include/clang/Driver/ToolChain.h<br>
cfe/trunk/lib/Driver/ToolChain.cpp<br>
cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp<br>
<br>
Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=352524&r1=352523&r2=352524&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=352524&r1=352523&r2=352524&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)<br>
+++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Tue Jan 29 10:27:51 2019<br>
@@ -51,10 +51,6 @@ def err_drv_invalid_rtlib_name : Error<<br>
"invalid runtime library name in argument '%0'">;<br>
def err_drv_unsupported_rtlib_for_platform : Error<<br>
"unsupported runtime library '%0' for platform '%1'">;<br>
-def err_drv_invalid_unwindlib_name : Error<<br>
- "invalid unwind library name in argument '%0'">;<br>
-def err_drv_incompatible_unwindlib : Error<<br>
- "--rtlib=libgcc requires --unwindlib=libgcc">;<br>
def err_drv_invalid_stdlib_name : Error<<br>
"invalid library name in argument '%0'">;<br>
def err_drv_invalid_output_with_multiple_archs : Error<<br>
<br>
Modified: cfe/trunk/include/clang/Driver/Options.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=352524&r1=352523&r2=352524&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=352524&r1=352523&r2=352524&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Driver/Options.td (original)<br>
+++ cfe/trunk/include/clang/Driver/Options.td Tue Jan 29 10:27:51 2019<br>
@@ -2568,8 +2568,6 @@ def std_EQ : Joined<["-", "--"], "std="><br>
}]>;<br>
def stdlib_EQ : Joined<["-", "--"], "stdlib=">, Flags<[CC1Option]>,<br>
HelpText<"C++ standard library to use">, Values<"libc++,libstdc++,platform">;<br>
-def unwindlib_EQ : Joined<["-", "--"], "unwindlib=">, Flags<[CC1Option]>,<br>
- HelpText<"Unwind library to use">, Values<"libgcc,compiler-rt,platform">;<br>
def sub__library : JoinedOrSeparate<["-"], "sub_library">;<br>
def sub__umbrella : JoinedOrSeparate<["-"], "sub_umbrella">;<br>
def system_header_prefix : Joined<["--"], "system-header-prefix=">,<br>
<br>
Modified: cfe/trunk/include/clang/Driver/ToolChain.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=352524&r1=352523&r2=352524&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=352524&r1=352523&r2=352524&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)<br>
+++ cfe/trunk/include/clang/Driver/ToolChain.h Tue Jan 29 10:27:51 2019<br>
@@ -367,10 +367,6 @@ public:<br>
return ToolChain::CST_Libstdcxx;<br>
}<br>
<br>
- virtual RuntimeLibType GetDefaultUnwindLibType() const {<br>
- return ToolChain::RLT_Libgcc;<br>
- }<br>
-<br>
virtual std::string getCompilerRTPath() const;<br>
<br>
virtual std::string getCompilerRT(const llvm::opt::ArgList &Args,<br>
@@ -515,10 +511,6 @@ public:<br>
// given compilation arguments.<br>
virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const;<br>
<br>
- // GetUnwindLibType - Determine the unwind library type to use with the<br>
- // given compilation arguments.<br>
- virtual RuntimeLibType GetUnwindLibType(const llvm::opt::ArgList &Args) const;<br>
-<br>
/// AddClangCXXStdlibIncludeArgs - Add the clang -cc1 level arguments to set<br>
/// the include paths to use for the given C++ standard library type.<br>
virtual void<br>
<br>
Modified: cfe/trunk/lib/Driver/ToolChain.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=352524&r1=352523&r2=352524&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=352524&r1=352523&r2=352524&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)<br>
+++ cfe/trunk/lib/Driver/ToolChain.cpp Tue Jan 29 10:27:51 2019<br>
@@ -679,33 +679,6 @@ ToolChain::RuntimeLibType ToolChain::Get<br>
return GetDefaultRuntimeLibType();<br>
}<br>
<br>
-ToolChain::RuntimeLibType ToolChain<br>
-::GetUnwindLibType(<br>
- const ArgList &Args) const {<br>
- const Arg *A = Args.getLastArg(options::OPT_unwindlib_EQ);<br>
- // If nothing has been specified, follow the runtime lib type.<br>
- if (!A)<br>
- return GetRuntimeLibType(Args);<br>
-<br>
- StringRef LibName = A->getValue();<br>
- if (LibName == "compiler-rt") {<br>
- if (GetRuntimeLibType(Args) == RLT_Libgcc)<br>
- getDriver().Diag(diag::err_drv_incompatible_unwindlib);<br>
- return ToolChain::RLT_CompilerRT;<br>
- }<br>
- else if (LibName == "libgcc")<br>
- return ToolChain::RLT_Libgcc;<br>
- else if (LibName == "platform") {<br>
- return GetRuntimeLibType(Args);<br>
- }<br>
-<br>
- if (A)<br>
- getDriver().Diag(diag::err_drv_invalid_unwindlib_name)<br>
- << A->getAsString(Args);<br>
-<br>
- return GetDefaultUnwindLibType();<br>
-}<br>
-<br>
ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{<br>
const Arg *A = Args.getLastArg(options::OPT_stdlib_EQ);<br>
StringRef LibName = A ? A->getValue() : CLANG_DEFAULT_CXX_STDLIB;<br>
<br>
Modified: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp?rev=352524&r1=352523&r2=352524&view=diff" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp?rev=352524&r1=352523&r2=352524&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp (original)<br>
+++ cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp Tue Jan 29 10:27:51 2019<br>
@@ -1131,70 +1131,41 @@ bool tools::isObjCAutoRefCount(const Arg<br>
return Args.hasFlag(options::OPT_fobjc_arc, options::OPT_fno_objc_arc, false);<br>
}<br>
<br>
-enum class LibGccType { UnspecifiedLibGcc, StaticLibGcc, SharedLibGcc };<br>
-<br>
-static LibGccType getLibGccType(const ArgList &Args) {<br>
- bool Static = Args.hasArg(options::OPT_static_libgcc) ||<br>
- Args.hasArg(options::OPT_static);<br>
-<br>
- bool Shared = Args.hasArg(options::OPT_shared_libgcc);<br>
- if (Shared)<br>
- return LibGccType::SharedLibGcc;<br>
- if (Static)<br>
- return LibGccType::StaticLibGcc;<br>
- return LibGccType::UnspecifiedLibGcc;<br>
-}<br>
-<br>
-static void AddUnwindLibrary(const ToolChain &TC, const Driver &D,<br>
- ArgStringList &CmdArgs, const ArgList &Args) {<br>
- // Targets that don't use unwind libraries.<br>
- if (TC.getTriple().isAndroid() || TC.getTriple().isOSIAMCU() ||<br>
- TC.getTriple().isOSBinFormatWasm())<br>
- return;<br>
-<br>
- ToolChain::RuntimeLibType UNW = TC.GetUnwindLibType(Args);<br>
- switch (UNW) {<br>
- case ToolChain::RLT_Libgcc: {<br>
- LibGccType LGT = getLibGccType(Args);<br>
- if (LGT == LibGccType::UnspecifiedLibGcc || LGT == LibGccType::SharedLibGcc)<br>
- CmdArgs.push_back("-lgcc_s");<br>
- else if (LGT == LibGccType::StaticLibGcc)<br>
- CmdArgs.push_back("-lgcc_eh");<br>
- break;<br>
- }<br>
- case ToolChain::RLT_CompilerRT:<br>
- CmdArgs.push_back("-lunwind");<br>
- break;<br>
- }<br>
-}<br>
+static void AddLibgcc(const llvm::Triple &Triple, const Driver &D,<br>
+ ArgStringList &CmdArgs, const ArgList &Args) {<br>
+ bool isAndroid = Triple.isAndroid();<br>
+ bool isCygMing = Triple.isOSCygMing();<br>
+ bool IsIAMCU = Triple.isOSIAMCU();<br>
+ bool StaticLibgcc = Args.hasArg(options::OPT_static_libgcc) ||<br>
+ Args.hasArg(options::OPT_static);<br>
<br>
-// Gcc adds libgcc arguments in various ways:<br>
-//<br>
-// gcc <none>: -lgcc --as-needed -lgcc_s --no-as-needed<br>
-// g++ <none>: -lgcc_s -lgcc<br>
-// gcc shared: -lgcc_s -lgcc<br>
-// g++ shared: -lgcc_s -lgcc<br>
-// gcc static: -lgcc -lgcc_eh<br>
-// g++ static: -lgcc -lgcc_eh<br>
-//<br>
-// Also, certain targets need additional adjustments.<br>
+ bool SharedLibgcc = Args.hasArg(options::OPT_shared_libgcc);<br>
+ bool UnspecifiedLibgcc = !StaticLibgcc && !SharedLibgcc;<br>
<br>
-static void AddLibgcc(const ToolChain &TC, const Driver &D,<br>
- ArgStringList &CmdArgs, const ArgList &Args) {<br>
- bool isAndroid = TC.getTriple().isAndroid();<br>
- LibGccType LGT = getLibGccType(Args);<br>
+ // Gcc adds libgcc arguments in various ways:<br>
+ //<br>
+ // gcc <none>: -lgcc --as-needed -lgcc_s --no-as-needed<br>
+ // g++ <none>: -lgcc_s -lgcc<br>
+ // gcc shared: -lgcc_s -lgcc<br>
+ // g++ shared: -lgcc_s -lgcc<br>
+ // gcc static: -lgcc -lgcc_eh<br>
+ // g++ static: -lgcc -lgcc_eh<br>
+ //<br>
+ // Also, certain targets need additional adjustments.<br>
<br>
- bool LibGccFirst = (D.CCCIsCC() && LGT == LibGccType::UnspecifiedLibGcc) ||<br>
- LGT == LibGccType::StaticLibGcc;<br>
+ bool LibGccFirst = (D.CCCIsCC() && UnspecifiedLibgcc) || StaticLibgcc;<br>
if (LibGccFirst)<br>
CmdArgs.push_back("-lgcc");<br>
<br>
- bool AsNeeded = D.CCCIsCC() && LGT == LibGccType::UnspecifiedLibGcc &&<br>
- !isAndroid && !TC.getTriple().isOSCygMing();<br>
+ bool AsNeeded = D.CCCIsCC() && UnspecifiedLibgcc && !isAndroid && !isCygMing;<br>
if (AsNeeded)<br>
CmdArgs.push_back("--as-needed");<br>
<br>
- AddUnwindLibrary(TC, D, CmdArgs, Args);<br>
+ if ((UnspecifiedLibgcc || SharedLibgcc) && !isAndroid)<br>
+ CmdArgs.push_back("-lgcc_s");<br>
+<br>
+ else if (StaticLibgcc && !isAndroid && !IsIAMCU)<br>
+ CmdArgs.push_back("-lgcc_eh");<br>
<br>
if (AsNeeded)<br>
CmdArgs.push_back("--no-as-needed");<br>
@@ -1207,7 +1178,7 @@ static void AddLibgcc(const ToolChain &T<br>
//<br>
// NOTE: This fixes a link error on Android MIPS as well. The non-static<br>
// libgcc for MIPS relies on _Unwind_Find_FDE and dl_iterate_phdr from libdl.<br>
- if (isAndroid && LGT != LibGccType::StaticLibGcc)<br>
+ if (isAndroid && !StaticLibgcc)<br>
CmdArgs.push_back("-ldl");<br>
}<br>
<br>
@@ -1219,7 +1190,6 @@ void tools::AddRunTimeLibs(const ToolCha<br>
switch (RLT) {<br>
case ToolChain::RLT_CompilerRT:<br>
CmdArgs.push_back(TC.getCompilerRTArgString(Args, "builtins"));<br>
- AddUnwindLibrary(TC, D, CmdArgs, Args);<br>
break;<br>
case ToolChain::RLT_Libgcc:<br>
// Make sure libgcc is not used under MSVC environment by default<br>
@@ -1231,7 +1201,7 @@ void tools::AddRunTimeLibs(const ToolCha<br>
<< Args.getLastArg(options::OPT_rtlib_EQ)->getValue() << "MSVC";<br>
}<br>
} else<br>
- AddLibgcc(TC, D, CmdArgs, Args);<br>
+ AddLibgcc(TC.getTriple(), D, CmdArgs, Args);<br>
break;<br>
}<br>
}<br>
<br>
Removed: cfe/trunk/test/Driver/compiler-rt-unwind.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/compiler-rt-unwind.c?rev=352523&view=auto" rel="noreferrer noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/compiler-rt-unwind.c?rev=352523&view=auto</a><br>
==============================================================================<br>
--- cfe/trunk/test/Driver/compiler-rt-unwind.c (original)<br>
+++ cfe/trunk/test/Driver/compiler-rt-unwind.c (removed)<br>
@@ -1,50 +0,0 @@<br>
-// General tests that the driver handles combinations of --rtlib=XXX and<br>
-// --unwindlib=XXX properly.<br>
-//<br>
-// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \<br>
-// RUN: --target=x86_64-unknown-linux \<br>
-// RUN: --gcc-toolchain="" \<br>
-// RUN: | FileCheck --check-prefix=RTLIB-EMPTY %s<br>
-// RTLIB-EMPTY: "{{.*}}lgcc"<br>
-// RTLIB-EMPTY: "{{.*}}-lgcc_s"<br>
-//<br>
-// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \<br>
-// RUN: --target=x86_64-unknown-linux -rtlib=gcc \<br>
-// RUN: --gcc-toolchain="" \<br>
-// RUN: | FileCheck --check-prefix=RTLIB-GCC %s<br>
-// RTLIB-GCC: "{{.*}}lgcc"<br>
-// RTLIB-GCC: "{{.*}}lgcc_s"<br>
-//<br>
-// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \<br>
-// RUN: --target=x86_64-unknown-linux -rtlib=gcc --unwindlib=compiler-rt \<br>
-// RUN: --gcc-toolchain="" \<br>
-// RUN: | FileCheck --check-prefix=RTLIB-GCC-UNWINDLIB-COMPILER-RT %s<br>
-// RTLIB-GCC-UNWINDLIB-COMPILER-RT: "{{.*}}lgcc"<br>
-// RTLIB-GCC-UNWINDLIB-COMPILER-RT: "{{.*}}lunwind"<br>
-//<br>
-// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \<br>
-// RUN: --target=x86_64-unknown-linux -rtlib=compiler-rt \<br>
-// RUN: --gcc-toolchain="" \<br>
-// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT %s<br>
-// RTLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins-x86_64.a"<br>
-// RTLIB-COMPILER-RT: "{{.*}}-lunwind"<br>
-//<br>
-// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \<br>
-// RUN: --target=x86_64-unknown-linux -rtlib=compiler-rt --unwindlib=gcc \<br>
-// RUN: --gcc-toolchain="" \<br>
-// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-GCC %s<br>
-// RTLIB-COMPILER-RT-UNWINDLIB-GCC: "{{.*}}libclang_rt.builtins-x86_64.a"<br>
-// RTLIB-COMPILER-RT-UNWINDLIB-GCC: "{{.*}}lgcc_s"<br>
-//<br>
-// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \<br>
-// RUN: --target=x86_64-unknown-linux -rtlib=compiler-rt --unwindlib=gcc \<br>
-// RUN: -static --gcc-toolchain="" \<br>
-// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC %s<br>
-// RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC: "{{.*}}libclang_rt.builtins-x86_64.a"<br>
-// RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC: "{{.*}}lgcc_eh"<br>
-//<br>
-// RUN: not %clang -no-canonical-prefixes %s -o %t.o 2> %t.err \<br>
-// RUN: --target=x86_64-unknown-linux -rtlib=libgcc --unwindlib=compiler-rt \<br>
-// RUN: --gcc-toolchain="" \<br>
-// RUN: FileCheck --input-file=%t.err --check-prefix=RTLIB-GCC-UNWINDLIB-COMPILER_RT %s<br>
-// RTLIB-GCC-UNWINDLIB-COMPILER_RT: "{{[.|\\\n]*}}--rtlib=libgcc requires --unwindlib=libgcc"<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank" rel="noreferrer">cfe-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div></div>