r198096 - Propagate "-arch x86_64h" setting to the linker. <rdar://problem/15711488>

Bob Wilson bob.wilson at apple.com
Fri Dec 27 21:26:14 PST 2013


Author: bwilson
Date: Fri Dec 27 23:26:14 2013
New Revision: 198096

URL: http://llvm.org/viewvc/llvm-project?rev=198096&view=rev
Log:
Propagate "-arch x86_64h" setting to the linker. <rdar://problem/15711488>

This is a follow-up to r194907, which added a new -arch setting to make it
easier to specify AVX2 targets. The "-arch x86_64h" option needs to be passed
on to the linker, but it was getting canonicalized to x86_64 by the code
in getArchTypeForDarwinArchName.

Modified:
    cfe/trunk/lib/Driver/Driver.cpp
    cfe/trunk/test/Driver/darwin-ld.c

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=198096&r1=198095&r2=198096&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Dec 27 23:26:14 2013
@@ -1868,17 +1868,24 @@ static llvm::Triple computeTargetTriple(
   if (Target.isOSDarwin()) {
     // If an explict Darwin arch name is given, that trumps all.
     if (!DarwinArchName.empty()) {
-      Target.setArch(
-        tools::darwin::getArchTypeForDarwinArchName(DarwinArchName));
+      if (DarwinArchName == "x86_64h")
+        Target.setArchName(DarwinArchName);
+      else
+        Target.setArch(
+          tools::darwin::getArchTypeForDarwinArchName(DarwinArchName));
       return Target;
     }
 
     // Handle the Darwin '-arch' flag.
     if (Arg *A = Args.getLastArg(options::OPT_arch)) {
-      llvm::Triple::ArchType DarwinArch
-        = tools::darwin::getArchTypeForDarwinArchName(A->getValue());
-      if (DarwinArch != llvm::Triple::UnknownArch)
-        Target.setArch(DarwinArch);
+      if (StringRef(A->getValue()) == "x86_64h")
+        Target.setArchName(DarwinArchName);
+      else {
+        llvm::Triple::ArchType DarwinArch
+          = tools::darwin::getArchTypeForDarwinArchName(A->getValue());
+        if (DarwinArch != llvm::Triple::UnknownArch)
+          Target.setArch(DarwinArch);
+      }
     }
   }
 

Modified: cfe/trunk/test/Driver/darwin-ld.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-ld.c?rev=198096&r1=198095&r2=198096&view=diff
==============================================================================
--- cfe/trunk/test/Driver/darwin-ld.c (original)
+++ cfe/trunk/test/Driver/darwin-ld.c Fri Dec 27 23:26:14 2013
@@ -143,4 +143,8 @@
 // LINK_EXPORT_DYNAMIC: {{ld(.exe)?"}}
 // LINK_EXPORT_DYNAMIC: "-export_dynamic"
 
-
+// RUN: %clang -target x86_64h-apple-darwin -### %t.o 2> %t.log
+// RUN: FileCheck -check-prefix=LINK_X86_64H_ARCH %s < %t.log
+//
+// LINK_X86_64H_ARCH: {{ld(.exe)?"}}
+// LINK_X86_64H_ARCH: "x86_64h"





More information about the cfe-commits mailing list