[PATCH] D29066: Forward -bitcode_process_mode to ld64 in marker-only mode

Mehdi AMINI via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 23 21:43:47 PST 2017


mehdi_amini updated this revision to Diff 85530.
mehdi_amini added a comment.

Add a test


https://reviews.llvm.org/D29066

Files:
  clang/lib/Driver/Tools.cpp
  clang/test/Driver/embed-bitcode.c


Index: clang/test/Driver/embed-bitcode.c
===================================================================
--- clang/test/Driver/embed-bitcode.c
+++ clang/test/Driver/embed-bitcode.c
@@ -34,6 +34,13 @@
 // CHECK-LTO-NOT: warning: argument unused during compilation: '-fembed-bitcode'
 // CHECK-LTO-NOT: -cc1
 // CHECK-LTO-NOT: -fembed-bitcode=all
+// RUN: touch %t.o
+// RUN: %clang  %t.o -fembed-bitcode  -fembed-bitcode-marker -mlinker-version=277  2>&1 -### | FileCheck %s -check-prefix=CHECK-LTO-MARKER-277
+// RUN: %clang  %t.o -fembed-bitcode  -fembed-bitcode-marker -mlinker-version=278  2>&1 -### | FileCheck %s -check-prefix=CHECK-LTO-MARKER-278
+// CHECK-LTO-MARKER-277-NOT: bitcode_process_mode
+// CHECK-LTO-MARKER-278: bitcode_process_mode
+
+
 
 // RUN: %clang -c %s -fembed-bitcode-marker -fintegrated-as 2>&1 -### | FileCheck %s -check-prefix=CHECK-MARKER
 // CHECK-MARKER: -cc1
Index: clang/lib/Driver/Tools.cpp
===================================================================
--- clang/lib/Driver/Tools.cpp
+++ clang/lib/Driver/Tools.cpp
@@ -8435,9 +8435,13 @@
   // for embed-bitcode, use -bitcode_bundle in linker command
   if (C.getDriver().embedBitcodeEnabled()) {
     // Check if the toolchain supports bitcode build flow.
-    if (MachOTC.SupportsEmbeddedBitcode())
+    if (MachOTC.SupportsEmbeddedBitcode()) {
       CmdArgs.push_back("-bitcode_bundle");
-    else
+      if (C.getDriver().embedBitcodeMarkerOnly() && Version[0] >= 278) {
+        CmdArgs.push_back("-bitcode_process_mode");
+        CmdArgs.push_back("marker");
+      }
+    } else
       D.Diag(diag::err_drv_bitcode_unsupported_on_toolchain);
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29066.85530.patch
Type: text/x-patch
Size: 1654 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170124/542fb58c/attachment.bin>


More information about the cfe-commits mailing list