On 2012-07-16 00:33, Anton Korobeynikov wrote:
>> I've just done a clean build on FreeBSD 8.3/x86-64 and this test passes.  
>> I've also tested on 9.0-RELEASE and 10-CURRENT and I can't reproduce this 
>> test failure.  Is there something odd about this buildbot?
> http://lab.llvm.org:8011/buildslaves/kistanova7 says it's 8.2

Aha, FreeBSD 8.x still uses binutils 2.15, which does support the
--enable-new-dtags flag, but not --hash-style.  The test failure case
seems to try and build a hello.c.tmp.exe, and run it, but I guess the
actual link fails?  It isn't entirely clear from the log file.

So I added a check for major release, before using the --hash-style
option, to the patch I already had for cleaning up the FreeBSD linker
flags.  Please review the attached freebsd-link-flags-3.diff.
Index: tools/clang/lib/Driver/Tools.cpp
===================================================================
--- tools/clang/lib/Driver/Tools.cpp	(revision 160886)
+++ tools/clang/lib/Driver/Tools.cpp	(working copy)
@@ -5003,9 +5003,15 @@ void freebsd::Link::ConstructJob(Compilation &C, c
                                  const char *LinkingOutput) const {
   const Driver &D = getToolChain().getDriver();
   ArgStringList CmdArgs;
-  CmdArgs.push_back("--hash-style=both");
-  CmdArgs.push_back("--enable-new-dtags");
 
+  // Silence warning for "clang -g foo.o -o foo"
+  Args.ClaimAllArgs(options::OPT_g_Group);
+  // and "clang -emit-llvm foo.o -o foo"
+  Args.ClaimAllArgs(options::OPT_emit_llvm);
+  // and for "clang -w foo.o -o foo". Other warning options are already
+  // handled somewhere else.
+  Args.ClaimAllArgs(options::OPT_w);
+
   if (!D.SysRoot.empty())
     CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
 
@@ -5021,6 +5027,14 @@ void freebsd::Link::ConstructJob(Compilation &C, c
       CmdArgs.push_back("-dynamic-linker");
       CmdArgs.push_back("/libexec/ld-elf.so.1");
     }
+    if (getToolChain().getTriple().getOSMajorVersion() >= 9) {
+      llvm::Triple::ArchType Arch = getToolChain().getArch();
+      if (Arch == llvm::Triple::arm || Arch == llvm::Triple::sparc ||
+          Arch == llvm::Triple::x86 || Arch == llvm::Triple::x86_64) {
+        CmdArgs.push_back("--hash-style=both");
+      }
+    }
+    CmdArgs.push_back("--enable-new-dtags");
   }
 
   // When building 32-bit code on FreeBSD/amd64, we have to explicitly
@@ -5432,7 +5446,7 @@ void linuxtools::Link::ConstructJob(Compilation &C
   Args.ClaimAllArgs(options::OPT_g_Group);
   // and "clang -emit-llvm foo.o -o foo"
   Args.ClaimAllArgs(options::OPT_emit_llvm);
-  // and for "clang -g foo.o -o foo". Other warning options are already
+  // and for "clang -w foo.o -o foo". Other warning options are already
   // handled somewhere else.
   Args.ClaimAllArgs(options::OPT_w);
 
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to