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