[PATCH] D125974: Limit bitcode option ignorelist to Darwin

Michiel Derhaeg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 19 07:23:09 PDT 2022


MichielDerhaeg created this revision.
MichielDerhaeg added reviewers: steven_wu, compnerd.
Herald added a project: All.
MichielDerhaeg requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.

This ignore list prevents embedding of bitcode for some platforms
without jumping through some hoops as several of the flags are passed by default.
E.g. On Android, since NDK 21, `-ffunction-sections`, `-fdata-sections`,
`-mstackrealign`, etc.. are added by default.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125974

Files:
  clang/lib/Driver/ToolChains/Clang.cpp


Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -4802,9 +4802,11 @@
         options::OPT_Xassembler,
         options::OPT_mllvm,
     };
-    for (const auto &A : Args)
-      if (llvm::is_contained(kBitcodeOptionIgnorelist, A->getOption().getID()))
-        D.Diag(diag::err_drv_unsupported_embed_bitcode) << A->getSpelling();
+    if (RawTriple.isOSDarwin())
+      for (const auto &A : Args)
+        if (llvm::is_contained(kBitcodeOptionIgnorelist,
+                               A->getOption().getID()))
+          D.Diag(diag::err_drv_unsupported_embed_bitcode) << A->getSpelling();
 
     // Render the CodeGen options that need to be passed.
     Args.addOptOutFlag(CmdArgs, options::OPT_foptimize_sibling_calls,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125974.430668.patch
Type: text/x-patch
Size: 876 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220519/00512514/attachment.bin>


More information about the cfe-commits mailing list