1 //===- LTO.h ----------------------------------------------------*- C++ -*-===//
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file provides a way to combine bitcode files into one ELF
11 // file by compiling them using LLVM.
13 // If LTO is in use, your input files are not in regular ELF files
14 // but instead LLVM bitcode files. In that case, the linker has to
15 // convert bitcode files into the native format so that we can create
16 // an ELF file that contains native code. This file provides that
19 //===----------------------------------------------------------------------===//
24 #include "lld/Common/LLVM.h"
25 #include "llvm/ADT/DenseSet.h"
26 #include "llvm/ADT/SmallString.h"
42 class BitcodeCompiler {
47 void add(BitcodeFile &F);
48 std::vector<InputFile *> compile();
51 std::unique_ptr<llvm::lto::LTO> LTOObj;
52 std::vector<SmallString<0>> Buff;
53 std::vector<std::unique_ptr<MemoryBuffer>> Files;
54 llvm::DenseSet<StringRef> UsedStartStop;