[PATCH] D87418: [LLD] Allow configuring default ld.lld backend

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 14:41:43 PDT 2020


MaskRay added inline comments.


================
Comment at: lld/CMakeLists.txt:196
 
+set(LLD_DEFAULT_LD_LLD_BACKEND "ELF"
+    CACHE STRING "Default backend for ld.lld, can be either ELF (default) or MINGW")
----------------
mati865 wrote:
> MaskRay wrote:
> > pcc wrote:
> > > MaskRay wrote:
> > > > How about a boolean variable `LLD_DEFAULT_LD_LLD_IS_MINGW`?
> > > > 
> > > > Then you can write `#if LLD_DEFAULT_LD_LLD_IS_MINGW`, a Bazel based build system which does not need to this variable (my users) does not need any change.
> > > > Additionally, the gn build will not break.
> > > The other build systems aren't really supported though, so we should probably do whatever makes sense for the cmake build and let the other build systems deal with it.
> > If mingw is an anomaly, I think a boolean variable makes more sense than a string variable with multiple values. The convenience for other build systems is a  byproduct.
> That was my initial attempt...
> 
> I thought the other targets in the future could need the same thing so I replaced it with generic solution.
> 
> I'm fine either way.
This change only affects `ld.lld` (the Gnu flavor). AFAIK there are just two possible values: ELF and MinGW. So a boolean variable works the best.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87418



More information about the llvm-commits mailing list