[PATCH] D41500: ananas: Add shared library support

Ed Schouten via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 27 06:40:01 PST 2017


ed added inline comments.


================
Comment at: lib/Driver/ToolChains/Ananas.cpp:93
     CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crti.o")));
-    CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtbegin.o")));
+    if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_pie)) {
+      CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtbeginS.o")));
----------------
This logic is used multiple times. Would it make sense to do something like this?

    bool IsShared = Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_pie);
    CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(IsShared ? "crtbeginS.o" : "crtbegin.o")));


================
Comment at: lib/Driver/ToolChains/Ananas.cpp:118
   if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
-    CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtend.o")));
+    if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_pie))
+      CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtendS.o")));
----------------
    CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(IsShared ? "crtendS.o" : "crtend.o")));


Repository:
  rC Clang

https://reviews.llvm.org/D41500





More information about the cfe-commits mailing list