static bool applyEmulation(llvm::Triple &triple,
llvm::opt::InputArgList &args,
raw_ostream &diag);
+ static void addPlatformSearchDirs(ELFLinkingContext &ctx,
+ llvm::Triple &triple,
+ llvm::Triple &baseTriple);
+
GnuLdDriver() LLVM_DELETED_FUNCTION;
};
bool alignSegments() const { return _alignSegments; }
void setAlignSegments(bool align) { _alignSegments = align; }
- /// \brief add platform specific search directories.
- virtual void addDefaultSearchDirs(llvm::Triple & /*triple*/) {
- addSearchPath("=/usr/lib");
- }
-
// We can parse several linker scripts via command line whose ASTs are stored
// in the current linking context via addLinkerScript().
void addLinkerScript(std::unique_ptr<script::Parser> script) {
return true;
}
+void GnuLdDriver::addPlatformSearchDirs(ELFLinkingContext &ctx,
+ llvm::Triple &triple,
+ llvm::Triple &baseTriple) {
+ if (triple.getOS() == llvm::Triple::NetBSD &&
+ triple.getArch() == llvm::Triple::x86 &&
+ baseTriple.getArch() == llvm::Triple::x86_64) {
+ ctx.addSearchPath("=/usr/lib/i386");
+ return;
+ }
+ ctx.addSearchPath("=/usr/lib");
+}
+
std::unique_ptr<ELFLinkingContext>
GnuLdDriver::createELFLinkingContext(llvm::Triple triple) {
std::unique_ptr<ELFLinkingContext> p;
// Add the default search directory specific to the target.
if (!(hasNoStdLib = parsedArgs->hasArg(OPT_nostdlib)))
- ctx->addDefaultSearchDirs(baseTriple);
+ addPlatformSearchDirs(*ctx, triple, baseTriple);
// Handle --demangle option(For compatibility)
if (parsedArgs->getLastArg(OPT_demangle))
return false;
}
}
-
- void addDefaultSearchDirs(llvm::Triple &baseTriple) override {
- if (_triple.getOS() == llvm::Triple::NetBSD &&
- baseTriple.getArch() == llvm::Triple::x86_64) {
- addSearchPath("=/usr/lib/i386");
- return;
- }
- ELFLinkingContext::addDefaultSearchDirs(baseTriple);
- }
};
} // end namespace elf
} // end namespace lld