r341114 - Revert r341107. That change breaks lto-android in a way is untested.
Sterling Augustine via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 30 13:42:49 PDT 2018
Author: saugustine
Date: Thu Aug 30 13:42:49 2018
New Revision: 341114
URL: http://llvm.org/viewvc/llvm-project?rev=341114&view=rev
Log:
Revert r341107. That change breaks lto-android in a way is untested.
Modified:
cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
Modified: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp?rev=341114&r1=341113&r2=341114&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp Thu Aug 30 13:42:49 2018
@@ -1126,41 +1126,23 @@ static void AddLibgcc(const llvm::Triple
bool IsIAMCU = Triple.isOSIAMCU();
bool StaticLibgcc = Args.hasArg(options::OPT_static_libgcc) ||
Args.hasArg(options::OPT_static);
- // The driver ignores -shared-libgcc and therefore treats such cases as
- // unspecified. Breaking out the two variables as below makes the current
- // behavior explicit.
- bool UnspecifiedLibgcc = !StaticLibgcc;
- bool SharedLibgcc = !StaticLibgcc;
-
- // 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() && UnspecifiedLibgcc) || StaticLibgcc;
- if (LibGccFirst)
+ if (!D.CCCIsCXX())
CmdArgs.push_back("-lgcc");
- bool AsNeeded = D.CCCIsCC() && !StaticLibgcc && !isCygMing;
- if (AsNeeded)
- CmdArgs.push_back("--as-needed");
-
- if (UnspecifiedLibgcc || SharedLibgcc)
+ if (StaticLibgcc || isAndroid) {
+ if (D.CCCIsCXX())
+ CmdArgs.push_back("-lgcc");
+ } else {
+ if (!D.CCCIsCXX() && !isCygMing)
+ CmdArgs.push_back("--as-needed");
CmdArgs.push_back("-lgcc_s");
+ if (!D.CCCIsCXX() && !isCygMing)
+ CmdArgs.push_back("--no-as-needed");
+ }
- else if (StaticLibgcc && !isAndroid && !IsIAMCU)
+ if (StaticLibgcc && !isAndroid && !IsIAMCU)
CmdArgs.push_back("-lgcc_eh");
-
- if (AsNeeded)
- CmdArgs.push_back("--no-as-needed");
-
- if (!LibGccFirst)
+ else if (!Args.hasArg(options::OPT_shared) && D.CCCIsCXX())
CmdArgs.push_back("-lgcc");
// According to Android ABI, we have to link with libdl if we are
More information about the cfe-commits
mailing list