add a hack that fixes:
authorChris Lattner <sabre@nondot.org>
Thu, 3 Nov 2005 07:17:51 +0000 (07:17 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 3 Nov 2005 07:17:51 +0000 (07:17 +0000)
llvm-gcc main.c -Wl,-native -o a.out -g

This is important because it used by many configure scripts.

John, please pull this onto the 1.6 branch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24163 91177308-0d34-0410-b5e6-96231b3b80d8

tools/gccld/GenerateCode.cpp

index 0d9454937047fe4bbd5c5dd2493e7ad146ebd443..3b5d2b2b0501c3ec53404f22ee12439a23189a81 100644 (file)
@@ -423,7 +423,10 @@ int llvm::GenerateNative(const std::string &OutputFilename,
 
   // Add in the libraries to link.
   for (unsigned index = 0; index < Libraries.size(); index++)
-    if (Libraries[index] != "crtend") {
+    // HACK: If this is libg, discard it.  This gets added by the compiler
+    // driver when doing: 'llvm-gcc main.c -Wl,-native -o a.out -g'. Note that
+    // this should really be fixed by changing the llvm-gcc compiler driver.
+    if (Libraries[index] != "crtend" && Libraries[index] != "g") {
       std::string Tmp = "-l"+Libraries[index];
       StringsToDelete.push_back(strdup(Tmp.c_str()));
       args.push_back(StringsToDelete.back());