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

@ -1,4 +1,4 @@
find_program(LLVMCONFIG NAMES llvm-config-3.9 llvm-config)
find_program(LLVMCONFIG NAMES llvm-config-6.0 llvm-config-5.0 llvm-config-4.0 llvm-config-3.9 llvm-config)
if( NOT LLVMCONFIG )
message(FATAL_ERROR "llvm-config not found, try installing llvm-dev llvm")

View File

@ -23,7 +23,9 @@ Required for FAIL*:
"-D__NO_MATH_INLINES -D__STRICT_ANSI__" or "--c_compiler clang++" (the
latter requires the clang++ compiler).
- optional:
* LLVM 3.9 (needed for several importers in tools/import-trace): llvm-3.9-dev
* LLVM 3.9, 4.0, 5.0, or 6.0 (needed for several importers in
tools/import-trace): llvm-3.9-dev, llvm-4.0-dev, llvm-5.0-dev or
llvm-6.0-dev
- built with "make REQUIRES_RTTI=1" (the Debian/Ubuntu packages already
come built this way)
- details below
@ -289,8 +291,9 @@ Database backend setup: MySQL / MariaDB
Building LLVM from sources
=========================================================================================
If your Linux distribution does not provide a library package for LLVM 3.9 or
newer, and you need LLVM support in FAIL*, you may need to build LLVM from the
sources and install it, e.g., locally in your home.
newer (the following steps work for LLVM 3.9), and you need LLVM support in
FAIL*, you may need to build LLVM from the sources and install it, e.g.,
locally in your home.
1. Download the source tarball of LLVM 3.9 from http://llvm.org (or use the git
repository http://llvm.org/git/llvm.git and checkout release_39)

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"