[PATCH] D87929: [lld-macho] Support -weak_lx, -weak_library, -weak_framework

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 08:44:57 PDT 2020


int3 marked an inline comment as done.
int3 added inline comments.


================
Comment at: lld/MachO/Driver.cpp:672-676
+  for (InputFile *file : inputFiles)
+    if (auto *dylibFile = dyn_cast<DylibFile>(file))
+      if (weakImportPaths.contains(file->getName()))
+        dylibFile->forceWeakImport = true;
+
----------------
gkm wrote:
> How about setting the `forceWeakImport` flag immediately after construction? Perhaps create `void addWeakFile(StringRef path)` and/or `void addFile(StringRef path, bool isWeak)` APIs around `void addFile(StringRef path)` that sets the flag when `addFlag()` returns a `DylibFile`. That way you don't need `weakImportPaths`.
I agree this is kind of janky, but I think having an `isWeak` parameter that only has an effect when the resulting path contains a DylibFile is also kind of ugly...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87929



More information about the llvm-commits mailing list