forked from OSchip/llvm-project
[ELF] Determine default search directories from Context.
Target specific LinkingContext's determine the default search directory. No change in functionality. llvm-svn: 227784
This commit is contained in:
parent
b0a52838fa
commit
148cd8e8e9
|
@ -87,10 +87,6 @@ private:
|
|||
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;
|
||||
};
|
||||
|
||||
|
|
|
@ -291,6 +291,11 @@ public:
|
|||
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");
|
||||
}
|
||||
|
||||
private:
|
||||
ELFLinkingContext() LLVM_DELETED_FUNCTION;
|
||||
|
||||
|
|
|
@ -311,18 +311,6 @@ bool GnuLdDriver::applyEmulation(llvm::Triple &triple,
|
|||
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");
|
||||
}
|
||||
|
||||
#define LLVM_TARGET(targetName) \
|
||||
if ((p = elf::targetName##LinkingContext::create(triple))) return p;
|
||||
|
||||
|
@ -403,8 +391,9 @@ bool GnuLdDriver::parse(int argc, const char *argv[],
|
|||
for (auto libDir : parsedArgs->filtered(OPT_L))
|
||||
ctx->addSearchPath(libDir->getValue());
|
||||
|
||||
// Add the default search directory specific to the target.
|
||||
if (!parsedArgs->hasArg(OPT_nostdlib))
|
||||
addPlatformSearchDirs(*ctx, triple, baseTriple);
|
||||
ctx->addDefaultSearchDirs(baseTriple);
|
||||
|
||||
// Handle --demangle option(For compatibility)
|
||||
if (parsedArgs->getLastArg(OPT_demangle))
|
||||
|
|
|
@ -36,6 +36,15 @@ public:
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue