This is actually needed, otherwise libc won't be added at all. For
instance when building libclang.so all the libc symbols won't be
found, with ld warning about libc being an "implicit dependency".

((This patch sits on top of a couple of unreviewed patches that make clang 
actually work on Solaris, see:

http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20150810/292800.html
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20150817/293971.html

It should be trivial to rebase against master if it is reviewed first though)

Xan
>From 8e81d6b095542c0ff1e28cf1f09d675f8afe1a25 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Xan=20L=C3=B3pez?= <x...@igalia.com>
Date: Mon, 17 Aug 2015 16:04:26 +0200
Subject: [PATCH 4/4] [Solaris] Add -lc also when linking shared libraries

This is actually needed, otherwise libc won't be added at all. For
instance when building libclang.so all the libc symbols won't be
found, with ld warning about libc being an "implicit dependency".
---
 lib/Driver/Tools.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index cf01d7b..2034c0f 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -6899,9 +6899,9 @@ void solaris::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
     if (getToolChain().getDriver().CCCIsCXX())
       getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs);
     CmdArgs.push_back("-lgcc_s");
+    CmdArgs.push_back("-lc");
     if (!Args.hasArg(options::OPT_shared)) {
       CmdArgs.push_back("-lgcc");
-      CmdArgs.push_back("-lc");
       CmdArgs.push_back("-lm");
     }
   }
-- 
2.4.3

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to