2013-01-22 10:15:30 +08:00
|
|
|
//===- lib/Core/TargetInfo.cpp - Linker Target Info Interface -------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Linker
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lld/Core/TargetInfo.h"
|
2013-04-05 02:59:24 +08:00
|
|
|
#include "lld/ReaderWriter/Writer.h"
|
2013-01-22 10:15:30 +08:00
|
|
|
|
|
|
|
#include "llvm/ADT/Triple.h"
|
|
|
|
|
|
|
|
namespace lld {
|
2013-04-05 02:59:24 +08:00
|
|
|
|
|
|
|
TargetInfo::TargetInfo()
|
|
|
|
: Reader(*this)
|
|
|
|
, _deadStrip(false)
|
|
|
|
, _globalsAreDeadStripRoots(false)
|
|
|
|
, _searchArchivesToOverrideTentativeDefinitions(false)
|
|
|
|
, _searchSharedLibrariesToOverrideTentativeDefinitions(false)
|
|
|
|
, _warnIfCoalesableAtomsHaveDifferentCanBeNull(false)
|
|
|
|
, _warnIfCoalesableAtomsHaveDifferentLoadName(false)
|
|
|
|
, _forceLoadAllArchives(false)
|
|
|
|
, _printRemainingUndefines(true)
|
|
|
|
, _allowRemainingUndefines(false)
|
2013-04-06 05:07:44 +08:00
|
|
|
, _logInputFiles(false)
|
2013-04-05 02:59:24 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-01-22 10:15:30 +08:00
|
|
|
TargetInfo::~TargetInfo() {}
|
|
|
|
|
2013-04-05 02:59:24 +08:00
|
|
|
|
|
|
|
error_code TargetInfo::readFile(StringRef path,
|
|
|
|
std::vector<std::unique_ptr<File>> &result) const {
|
|
|
|
OwningPtr<llvm::MemoryBuffer> opmb;
|
|
|
|
if (error_code ec = llvm::MemoryBuffer::getFileOrSTDIN(path, opmb))
|
|
|
|
return ec;
|
2013-04-06 05:08:30 +08:00
|
|
|
|
|
|
|
return this->parseFile(std::unique_ptr<MemoryBuffer>(opmb.take()), result);
|
2013-01-22 10:15:30 +08:00
|
|
|
}
|
|
|
|
|
2013-04-05 02:59:24 +08:00
|
|
|
error_code TargetInfo::writeFile(const File &linkedFile) const {
|
|
|
|
return this->writer().writeFile(linkedFile, _outputPath);
|
2013-01-22 10:15:30 +08:00
|
|
|
}
|
|
|
|
|
2013-04-05 02:59:24 +08:00
|
|
|
void TargetInfo::addImplicitFiles(InputFiles& inputs) const {
|
|
|
|
this->writer().addFiles(inputs);
|
2013-01-22 10:15:30 +08:00
|
|
|
}
|
|
|
|
|
2013-04-05 02:59:24 +08:00
|
|
|
void TargetInfo::addPasses(PassManager &pm) const {
|
2013-01-22 10:15:30 +08:00
|
|
|
}
|
2013-04-05 02:59:24 +08:00
|
|
|
|
|
|
|
|
2013-01-22 10:15:30 +08:00
|
|
|
} // end namespace lld
|