[PATCH] D53854: [Driver] Use -push-/-pop-state and -as-needed for libc++ on Fuchsia

Petr Hosek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 3 21:28:15 PDT 2018


phosek closed this revision.
phosek added inline comments.


================
Comment at: lib/Driver/ToolChains/Fuchsia.cpp:128
         if (OnlyLibstdcxxStatic)
-          CmdArgs.push_back("-Bstatic");
+          CmdArgs.push_back("-static");
         ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
----------------
mcgrathr wrote:
> mcgrathr wrote:
> > MaskRay wrote:
> > > If Fuchsia doesn't use gold, it is fine. gold diverges from ld.bfd (lld) in that `-static` switches the whole link to its special static mode. (as usually while you link libstdc++/libc++ statically, you can still link other libraries normally)
> > > 
> > > In ld.bfd/lld, `-Bstatic` is synonym with `-static`.
> > I think this part of the change was unintentional and should be undone.
> > Using `--pop-state` obviates the need for `-Bdynamic` to undo `-Bstatic`, but `-Bstatic` is still the right switch here.
> Actually, it's wrong two ways: the `--pop-state` should come before `-lm`.  Neither `-static` nor `-Bstatic` should apply to `-lm` (or to `-lc` that comes later, which `-static` might).  `-static` vs `-Bstatic` is only a latent bug given lld, but the `-lm` issue breaks the Zircon build today.
> 
Addressed in D54082.


Repository:
  rC Clang

https://reviews.llvm.org/D53854





More information about the cfe-commits mailing list