FAIL* works with LLVM 3.9, 4.0, 5.0 or 6.0

Change-Id: I5480c3451daac7c8ea6160a9afe5ce557b73afb1
This commit is contained in:
Horst Schirmeier
2018-07-24 10:33:20 +02:00
parent 5d5927a88a
commit eef19b80a0
5 changed files with 16 additions and 6 deletions

View File

@ -79,7 +79,7 @@ add_library(fail-util ${SRCS})
add_dependencies(fail-util fail-comm)
target_link_libraries(fail-util fail-comm ${ADDITIONAL_LIBS} ${PROTOBUF_LIBRARY} ${Boost_LIBRARIES} ${LibIberty_LIBRARIES} ${ZLIB_LIBRARIES} ${LIBDWARF_LIBRARIES} ${LIBELF_LIBRARIES})
option(BUILD_LLVM_DISASSEMBLER "Build the LLVM-based disassembler (LLVM 3.9 preferred, other versions may not work)" OFF)
option(BUILD_LLVM_DISASSEMBLER "Build the LLVM-based disassembler (LLVM 3.9, 4.0, 5.0 or 6.0 preferred, other versions may not work)" OFF)
if (BUILD_LLVM_DISASSEMBLER)
add_subdirectory(llvmdisassembler)
endif (BUILD_LLVM_DISASSEMBLER)

View File

@ -4,6 +4,14 @@ using namespace fail;
using namespace llvm;
using namespace llvm::object;
// In LLVM 3.9, llvm::Triple::getArchTypeName() returns const char*, since LLVM
// 4.0 it returns StringRef. This overload catches the latter case.
__attribute__((unused))
static std::ostream& operator<<(std::ostream& stream, const llvm::StringRef& s)
{
stream << s.str();
return stream;
}
LLVMtoFailTranslator *LLVMDisassembler::getTranslator() {
if (ltofail == 0) {

View File

@ -23,7 +23,6 @@
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/MemoryObject.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/ADT/StringExtras.h"