[PATCH] D56215: [lld] [ELF] Include default search paths for NetBSD driver

Kamil Rytarowski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 2 17:07:24 PST 2019


krytarowski added a comment.

I assume that we need to reimplement this in the context of lld:

  NetBSD::NetBSD(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
      : Generic_ELF(D, Triple, Args) {
    if (!Args.hasArg(options::OPT_nostdlib)) {
      // When targeting a 32-bit platform, try the special directory used on
      // 64-bit hosts, and only fall back to the main library directory if that
      // doesn't work.
      // FIXME: It'd be nicer to test if this directory exists, but I'm not sure
      // what all logic is needed to emulate the '=' prefix here.
      switch (Triple.getArch()) {
      case llvm::Triple::x86:
        getFilePaths().push_back("=/usr/lib/i386");
        break;
      case llvm::Triple::arm:
      case llvm::Triple::armeb:
      case llvm::Triple::thumb:
      case llvm::Triple::thumbeb:
        switch (Triple.getEnvironment()) {
        case llvm::Triple::EABI:
        case llvm::Triple::GNUEABI:
          getFilePaths().push_back("=/usr/lib/eabi");
          break;
        case llvm::Triple::EABIHF:
        case llvm::Triple::GNUEABIHF:
          getFilePaths().push_back("=/usr/lib/eabihf");
          break;
        default:
          getFilePaths().push_back("=/usr/lib/oabi");
          break;
        }
        break;
      case llvm::Triple::mips64:
      case llvm::Triple::mips64el:
        if (tools::mips::hasMipsAbiArg(Args, "o32"))
          getFilePaths().push_back("=/usr/lib/o32");
        else if (tools::mips::hasMipsAbiArg(Args, "64"))
          getFilePaths().push_back("=/usr/lib/64");
        break;
      case llvm::Triple::ppc:
        getFilePaths().push_back("=/usr/lib/powerpc");
        break;
      case llvm::Triple::sparc:
        getFilePaths().push_back("=/usr/lib/sparc");
        break;
      default:
        break;
      }
  
      getFilePaths().push_back("=/usr/lib");
    }
  }

https://github.com/llvm-mirror/clang/blob/e030444510df2ffaf23eeae35692dc363bc28439/lib/Driver/ToolChains/NetBSD.cpp#L334-L379


Repository:
  rLLD LLVM Linker

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

https://reviews.llvm.org/D56215





More information about the cfe-commits mailing list