#include "llvm/IR/Verifier.h"
#include "llvm/InitializePasses.h"
#include "llvm/LTO/LTOModule.h"
-#include "llvm/Linker.h"
+#include "llvm/Linker/Linker.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/SubtargetFeature.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/Host.h"
#include "llvm/Support/MemoryBuffer.h"
-#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/ToolOutputFile.h"
+#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/system_error.h"
#include "llvm/Target/TargetLibraryInfo.h"
#include "llvm/Target/TargetLowering.h"
// create output file
std::string ErrInfo;
- tool_output_file Out(path, ErrInfo, sys::fs::F_Binary);
+ tool_output_file Out(path, ErrInfo, sys::fs::F_None);
if (!ErrInfo.empty()) {
errMsg = "could not open bitcode file for writing: ";
errMsg += path;
delete NativeObjectFile;
// read .o file into memory buffer
- OwningPtr<MemoryBuffer> BuffPtr;
+ std::unique_ptr<MemoryBuffer> BuffPtr;
if (error_code ec = MemoryBuffer::getFile(name, BuffPtr, -1, false)) {
errMsg = ec.message();
sys::fs::remove(NativeObjectPath);
return NULL;
}
- NativeObjectFile = BuffPtr.take();
+ NativeObjectFile = BuffPtr.release();
// remove temp files
sys::fs::remove(NativeObjectPath);
std::vector<const char*> &MustPreserveList,
SmallPtrSet<GlobalValue*, 8> &AsmUsed,
Mangler &Mangler) {
- SmallString<64> Buffer;
- Mangler.getNameWithPrefix(Buffer, &GV);
-
+ // There are no restrictions to apply to declarations.
if (GV.isDeclaration())
return;
+
+ // There is nothing more restrictive than private linkage.
+ if (GV.hasPrivateLinkage())
+ return;
+
+ SmallString<64> Buffer;
+ TargetMach->getNameWithPrefix(Buffer, &GV, Mangler);
+
if (MustPreserveSymbols.count(Buffer))
MustPreserveList.push_back(GV.getName().data());
if (AsmUndefinedRefs.count(Buffer))
passes.add(createVerifierPass());
// Add an appropriate DataLayout instance for this module...
- passes.add(new DataLayout(*TargetMach->getDataLayout()));
+ mergedModule->setDataLayout(TargetMach->getDataLayout());
+ passes.add(new DataLayoutPass(mergedModule));
// Add appropriate TargetLibraryInfo for this module.
passes.add(new TargetLibraryInfo(Triple(TargetMach->getTargetTriple())));
PassManager codeGenPasses;
- codeGenPasses.add(new DataLayout(*TargetMach->getDataLayout()));
+ codeGenPasses.add(new DataLayoutPass(mergedModule));
formatted_raw_ostream Out(out);
case DS_Warning:
Severity = LTO_DS_WARNING;
break;
+ case DS_Remark:
+ Severity = LTO_DS_REMARK;
+ break;
case DS_Note:
Severity = LTO_DS_NOTE;
break;