Skip to content

Commit

Permalink
apply changes from retdec fork
Browse files Browse the repository at this point in the history
  • Loading branch information
sandsmark committed Dec 14, 2017
1 parent a093ef4 commit 3c47bd2
Show file tree
Hide file tree
Showing 27 changed files with 542 additions and 105 deletions.
73 changes: 38 additions & 35 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -797,41 +797,44 @@ endif()

add_subdirectory(cmake/modules)

if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
install(DIRECTORY include/llvm include/llvm-c
DESTINATION include
COMPONENT llvm-headers
FILES_MATCHING
PATTERN "*.def"
PATTERN "*.h"
PATTERN "*.td"
PATTERN "*.inc"
PATTERN "LICENSE.TXT"
PATTERN ".svn" EXCLUDE
)

install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm
DESTINATION include
COMPONENT llvm-headers
FILES_MATCHING
PATTERN "*.def"
PATTERN "*.h"
PATTERN "*.gen"
PATTERN "*.inc"
# Exclude include/llvm/CMakeFiles/intrinsics_gen.dir, matched by "*.def"
PATTERN "CMakeFiles" EXCLUDE
PATTERN "config.h" EXCLUDE
PATTERN ".svn" EXCLUDE
)

if (NOT CMAKE_CONFIGURATION_TYPES)
add_custom_target(installhdrs
DEPENDS ${name}
COMMAND "${CMAKE_COMMAND}"
-DCMAKE_INSTALL_COMPONENT=llvm-headers
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
endif()
endif()
# == Decompiler OFF BEGIN ==
# To fix build with MSVC project, do not install any includes.
# if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
# install(DIRECTORY include/llvm include/llvm-c
# DESTINATION include
# COMPONENT llvm-headers
# FILES_MATCHING
# PATTERN "*.def"
# PATTERN "*.h"
# PATTERN "*.td"
# PATTERN "*.inc"
# PATTERN "LICENSE.TXT"
# PATTERN ".svn" EXCLUDE
# )
#
# install(DIRECTORY ${LLVM_INCLUDE_DIR}/llvm
# DESTINATION include
# COMPONENT llvm-headers
# FILES_MATCHING
# PATTERN "*.def"
# PATTERN "*.h"
# PATTERN "*.gen"
# PATTERN "*.inc"
# # Exclude include/llvm/CMakeFiles/intrinsics_gen.dir, matched by "*.def"
# PATTERN "CMakeFiles" EXCLUDE
# PATTERN "config.h" EXCLUDE
# PATTERN ".svn" EXCLUDE
# )
#
# if (NOT CMAKE_CONFIGURATION_TYPES)
# add_custom_target(installhdrs
# DEPENDS ${name}
# COMMAND "${CMAKE_COMMAND}"
# -DCMAKE_INSTALL_COMPONENT=llvm-headers
# -P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
# endif()
# endif()
# == Decompiler OFF END ==

# This must be at the end of the LLVM root CMakeLists file because it must run
# after all targets are created.
Expand Down
37 changes: 25 additions & 12 deletions cmake/modules/AddLLVM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -558,10 +558,13 @@ macro(add_llvm_library name)
set(install_type ARCHIVE)
endif()

install(TARGETS ${name}
EXPORT LLVMExports
${install_type} DESTINATION ${install_dir}
COMPONENT ${name})
# == Decompiler OFF BEGIN ==
# To fix build with MSVC project, do not install any libraries.
# install(TARGETS ${name}
# EXPORT LLVMExports
# ${install_type} DESTINATION ${install_dir}
# COMPONENT ${name})
# == Decompiler OFF END ==

if (NOT CMAKE_CONFIGURATION_TYPES)
add_custom_target(install-${name}
Expand Down Expand Up @@ -592,10 +595,13 @@ macro(add_llvm_loadable_module name)
else()
set(dlldir "lib${LLVM_LIBDIR_SUFFIX}")
endif()
install(TARGETS ${name}
EXPORT LLVMExports
LIBRARY DESTINATION ${dlldir}
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
# == Decompiler OFF BEGIN ==
# To fix build with MSVC project, do not install any loadable modules.
# install(TARGETS ${name}
# EXPORT LLVMExports
# LIBRARY DESTINATION ${dlldir}
# ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
# == Decompiler OFF END ==
endif()
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
endif()
Expand Down Expand Up @@ -768,10 +774,17 @@ macro(add_llvm_tool name)
list(FIND LLVM_TOOLCHAIN_TOOLS ${name} LLVM_IS_${name}_TOOLCHAIN_TOOL)
if (LLVM_IS_${name}_TOOLCHAIN_TOOL GREATER -1 OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
if( LLVM_BUILD_TOOLS )
install(TARGETS ${name}
EXPORT LLVMExports
RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR}
COMPONENT ${name})
# == Decompiler BEGIN ==
# To fix build with MSVC project, install only llvm-as and llvm-dis.
if("${name}" STREQUAL "llvm-as" OR "${name}" STREQUAL "llvm-dis")
# We always build LLVM in the release mode. Without forcing the release
# mode here (directory "Release"), MSVC always tries to install it from
# the non-existing "Debug" directory, even when CMAKE_BUILD_TYPE is
# "Release. I have no idea why.
install(FILES "${CMAKE_BINARY_DIR}/Release/bin/${name}.exe"
DESTINATION "${CMAKE_BINARY_DIR}/../../../../decompiler/bin")
endif()
# == Decompiler END ==

if (NOT CMAKE_CONFIGURATION_TYPES)
add_custom_target(install-${name}
Expand Down
41 changes: 22 additions & 19 deletions cmake/modules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,25 @@ configure_file(
${llvm_cmake_builddir}/LLVMConfigVersion.cmake
@ONLY)

if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
install(EXPORT LLVMExports DESTINATION ${LLVM_INSTALL_PACKAGE_DIR})

install(FILES
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/LLVMConfig.cmake
${llvm_cmake_builddir}/LLVMConfigVersion.cmake
LLVM-Config.cmake
DESTINATION ${LLVM_INSTALL_PACKAGE_DIR})

install(DIRECTORY .
DESTINATION ${LLVM_INSTALL_PACKAGE_DIR}
FILES_MATCHING PATTERN *.cmake
PATTERN .svn EXCLUDE
PATTERN LLVMConfig.cmake EXCLUDE
PATTERN LLVMConfigVersion.cmake EXCLUDE
PATTERN LLVM-Config.cmake EXCLUDE
PATTERN GetHostTriple.cmake EXCLUDE
PATTERN CheckAtomic.cmake EXCLUDE)
endif()
# == Decompiler OFF BEGIN ==
# To fix build with MSVC project, do not install anything from below.
# if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
# install(EXPORT LLVMExports DESTINATION ${LLVM_INSTALL_PACKAGE_DIR})
#
# install(FILES
# ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/LLVMConfig.cmake
# ${llvm_cmake_builddir}/LLVMConfigVersion.cmake
# LLVM-Config.cmake
# DESTINATION ${LLVM_INSTALL_PACKAGE_DIR})
#
# install(DIRECTORY .
# DESTINATION ${LLVM_INSTALL_PACKAGE_DIR}
# FILES_MATCHING PATTERN *.cmake
# PATTERN .svn EXCLUDE
# PATTERN LLVMConfig.cmake EXCLUDE
# PATTERN LLVMConfigVersion.cmake EXCLUDE
# PATTERN LLVM-Config.cmake EXCLUDE
# PATTERN GetHostTriple.cmake EXCLUDE
# PATTERN CheckAtomic.cmake EXCLUDE)
# endif()
# == Decompiler OFF END ==
9 changes: 6 additions & 3 deletions cmake/modules/TableGen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,12 @@ macro(add_tablegen target project)
endif(CMAKE_SIZEOF_VOID_P MATCHES "8")
endif( MINGW )
if (${project} STREQUAL LLVM AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
install(TARGETS ${target}
EXPORT LLVMExports
RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR})
# == Decompiler OFF BEGIN ==
# To fix build with MSVC project, do not install the tablegen.
# install(TARGETS ${target}
# EXPORT LLVMExports
# RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR})
# == Decompiler OFF END ==
endif()
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${target})
endmacro()
3 changes: 3 additions & 0 deletions include/llvm/Object/MachO.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ class MachOBindEntry {
uint32_t flags() const;
int64_t addend() const;
int ordinal() const;
// DECOMPILER BEGIN (#1790)
bool malformed() const;
// DECOMPILER END (#1790)

bool operator==(const MachOBindEntry &) const;

Expand Down
Loading

0 comments on commit 3c47bd2

Please sign in to comment.