[PATCH] D60274: [ELF] Implement Dependent Libraries Feature

ben via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 5 10:42:42 PDT 2019


bd1976llvm added a comment.

In D60274#1456450 <https://reviews.llvm.org/D60274#1456450>, @compnerd wrote:

> The early check for ELF is the problem.  I care very little about `.linker-options` itself as long as the ability to ensure that framework linkage is provided (i.e. `-framework ...`, and '-L ...` can be passed along as options to the linker).


Maybe we were not on the same page after the RFC then. I am only attempting to support "comment lib" pragmas here. If we want to support framework linking with this approach the best I can offer is to change the handleDepLib function to:

static void processDepLib(StringRef Specifier, const InputFile *F) {

  if (Config->DepLibs)
    if (fs::exists(Specifier))
      Driver->addFile(Specifier, /*WithLOption=*/false);
    else if (Optional<std::string> S = findFromSearchPaths(Specifier))
      Driver->addFile(*S, /*WithLOption=*/true);
    else if (Optional<std::string> S = searchLibrary(Specifier))
      Driver->addFile(*S, /*WithLOption=*/true);
    else if (Optional<std::string> S = searchFramework(Specifier))
      Driver->addFile(*S, /*WithLOption=*/true);
    else
      error(toString(F) + ": unable to find library from dependent library specifier: " + Specifier);

}

We could modify this function to warn/error if it finds two matching libraries for a specifier to *perhaps" address some of you earlier concerns.

This dependent libraries proposal doesn't handle -L options at all. If you need that and fine control over framework linking then we will need to put in .linker-options support into LLD; but, it is not clear exactly how that should work and I think it is another change distinct from this one.


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

https://reviews.llvm.org/D60274





More information about the llvm-commits mailing list