[PATCH] D114023: [Driver] Pass --fix-cortex-a53-843419 automatically on Fuchsia

Roland McGrath via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 30 10:52:30 PST 2021


mcgrathr accepted this revision.
mcgrathr added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/lib/Driver/ToolChains/Fuchsia.cpp:91
+    std::string CPU = getCPUName(D, Args, Triple);
+    if (CPU.empty() || CPU == "generic" || CPU == "cortex-a53")
+      CmdArgs.push_back("--fix-cortex-a53-843419");
----------------
phosek wrote:
> mcgrathr wrote:
> > How does this relate to -march, -mtune, and/or -mcpu?
> > It's not at all clear to me how we discern automatically when a A53 might be included in the supported target CPU set.  I'm not entirely sure we should have automatic injection in some cases where A53 is a valid target but not all.  That is, if some compiler option combinations that produce code meant to be compatible with an A53 won't automatically get the --fix option, then perhaps it's better to require the explicit --fix option when supporting A53 is the explicit intent.
> This is the same logic as used by the [Gnu driver](https://github.com/llvm/llvm-project/blob/7a7c059d867554e116244ad5639d05d75ed1a7cd/clang/lib/Driver/ToolChains/Gnu.cpp#L451). `getCPUName` only considers `-mcpu`, it ignores `-march` and `-mtune` as far as I can tell.
If the empty or "generic" case is what will apply when no `-mcpu` switch is given regardless of `-march` then I guess this is adequate since we're not really concerned with any architectures older than A53 where someone might use `-mcpu=...` as a proxy for "X and later" where X<A53.

I think this area needs to be more clearly specified and documented eventually, however.  Ideally the determinant would whether the combination of `-march` and/or `-mcpu` switches indicates generating code that is compatible with an A53 CPU, since only if running on an A53 is ruled out should we omit the erratum workaround.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114023/new/

https://reviews.llvm.org/D114023



More information about the cfe-commits mailing list