From 376d60b9fd305097c356c92f67a9879ac0c84588 Mon Sep 17 00:00:00 2001 From: Alex Denisov Date: Wed, 5 Jan 2022 22:54:56 +0100 Subject: [PATCH] Force builds against libLLVM.dylib and drop LLVM 7 --- .github/workflows/ci-ubuntu-18.yml | 2 +- .../{ci-ubuntu-20.yml => ci-ubuntu-20.04.yml} | 2 +- CMakeLists.txt | 11 --- LLVMCompatibility/10.x.x/CMakeLists.txt | 1 - LLVMCompatibility/11.x.x/CMakeLists.txt | 1 - LLVMCompatibility/12.x.x/CMakeLists.txt | 1 - LLVMCompatibility/13.x.x/CMakeLists.txt | 1 - LLVMCompatibility/7.x.x/CMakeLists.txt | 13 ---- LLVMCompatibility/7.x.x/LLVMCompatibility.cpp | 69 ------------------- LLVMCompatibility/7.x.x/LLVMCompatibility.h | 36 ---------- LLVMCompatibility/8.x.x/CMakeLists.txt | 1 - LLVMCompatibility/9.x.x/CMakeLists.txt | 1 - cmake/packaging/cpack.DEB-ubuntu.cmake | 2 - infrastructure/helpers/variables.yaml | 26 +++---- lib/CMakeLists.txt | 20 +----- tools/mull-cxx/CMakeLists.txt | 12 +--- tools/mull-runner/CMakeLists.txt | 2 +- 17 files changed, 14 insertions(+), 187 deletions(-) rename .github/workflows/{ci-ubuntu-20.yml => ci-ubuntu-20.04.yml} (97%) delete mode 100644 LLVMCompatibility/7.x.x/CMakeLists.txt delete mode 100644 LLVMCompatibility/7.x.x/LLVMCompatibility.cpp delete mode 100644 LLVMCompatibility/7.x.x/LLVMCompatibility.h diff --git a/.github/workflows/ci-ubuntu-18.yml b/.github/workflows/ci-ubuntu-18.yml index 14807fc76..1a0071d35 100644 --- a/.github/workflows/ci-ubuntu-18.yml +++ b/.github/workflows/ci-ubuntu-18.yml @@ -19,7 +19,7 @@ jobs: container: ubuntu:18.04 strategy: matrix: - LLVM_VERSION: ["7.0", "8.0", "9.0", "10.0"] + LLVM_VERSION: ["8.0", "9.0", "10.0"] steps: - name: For debugging diff --git a/.github/workflows/ci-ubuntu-20.yml b/.github/workflows/ci-ubuntu-20.04.yml similarity index 97% rename from .github/workflows/ci-ubuntu-20.yml rename to .github/workflows/ci-ubuntu-20.04.yml index 05e017541..b88e1bfd2 100644 --- a/.github/workflows/ci-ubuntu-20.yml +++ b/.github/workflows/ci-ubuntu-20.04.yml @@ -19,7 +19,7 @@ jobs: container: ubuntu:20.04 strategy: matrix: - LLVM_VERSION: ["7.0", "8.0", "9.0", "10.0", "11.0", "12.0", "13.0"] + LLVM_VERSION: ["8.0", "9.0", "10.0", "11.0", "12.0"] steps: - name: Install software diff --git a/CMakeLists.txt b/CMakeLists.txt index a472c48d5..a7e0d6937 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -202,17 +202,6 @@ set (MULL_INCLUDE_DIRS ${CMAKE_CURRENT_LIST_DIR}/LLVMCompatibility/${LLVM_COMPATIBILITY_DIR} ) -if ("LLVM" IN_LIST LLVM_AVAILABLE_LIBS) - set (MULL_LLVM_COMPATIBILITY_LIBRARIES - LLVM - ) -else() - set (MULL_LLVM_COMPATIBILITY_LIBRARIES - LLVMSupport - LLVMCore - ) -endif() - include(${CMAKE_CURRENT_LIST_DIR}/cmake/cpack.cmake) include(${CMAKE_CURRENT_LIST_DIR}/cmake/version.cmake) diff --git a/LLVMCompatibility/10.x.x/CMakeLists.txt b/LLVMCompatibility/10.x.x/CMakeLists.txt index aaf5c968d..4520aad95 100644 --- a/LLVMCompatibility/10.x.x/CMakeLists.txt +++ b/LLVMCompatibility/10.x.x/CMakeLists.txt @@ -10,4 +10,3 @@ set_target_properties(LLVMCompatibility PROPERTIES target_include_directories(LLVMCompatibility SYSTEM PUBLIC ${LLVM_INCLUDE_DIRS} ) -add_dependencies(LLVMCompatibility ${MULL_LLVM_COMPATIBILITY_LIBRARIES}) \ No newline at end of file diff --git a/LLVMCompatibility/11.x.x/CMakeLists.txt b/LLVMCompatibility/11.x.x/CMakeLists.txt index aaf5c968d..4520aad95 100644 --- a/LLVMCompatibility/11.x.x/CMakeLists.txt +++ b/LLVMCompatibility/11.x.x/CMakeLists.txt @@ -10,4 +10,3 @@ set_target_properties(LLVMCompatibility PROPERTIES target_include_directories(LLVMCompatibility SYSTEM PUBLIC ${LLVM_INCLUDE_DIRS} ) -add_dependencies(LLVMCompatibility ${MULL_LLVM_COMPATIBILITY_LIBRARIES}) \ No newline at end of file diff --git a/LLVMCompatibility/12.x.x/CMakeLists.txt b/LLVMCompatibility/12.x.x/CMakeLists.txt index aaf5c968d..4520aad95 100644 --- a/LLVMCompatibility/12.x.x/CMakeLists.txt +++ b/LLVMCompatibility/12.x.x/CMakeLists.txt @@ -10,4 +10,3 @@ set_target_properties(LLVMCompatibility PROPERTIES target_include_directories(LLVMCompatibility SYSTEM PUBLIC ${LLVM_INCLUDE_DIRS} ) -add_dependencies(LLVMCompatibility ${MULL_LLVM_COMPATIBILITY_LIBRARIES}) \ No newline at end of file diff --git a/LLVMCompatibility/13.x.x/CMakeLists.txt b/LLVMCompatibility/13.x.x/CMakeLists.txt index aaf5c968d..4520aad95 100644 --- a/LLVMCompatibility/13.x.x/CMakeLists.txt +++ b/LLVMCompatibility/13.x.x/CMakeLists.txt @@ -10,4 +10,3 @@ set_target_properties(LLVMCompatibility PROPERTIES target_include_directories(LLVMCompatibility SYSTEM PUBLIC ${LLVM_INCLUDE_DIRS} ) -add_dependencies(LLVMCompatibility ${MULL_LLVM_COMPATIBILITY_LIBRARIES}) \ No newline at end of file diff --git a/LLVMCompatibility/7.x.x/CMakeLists.txt b/LLVMCompatibility/7.x.x/CMakeLists.txt deleted file mode 100644 index aaf5c968d..000000000 --- a/LLVMCompatibility/7.x.x/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -set (SOURCES - LLVMCompatibility.cpp - LLVMCompatibility.h -) - -add_library(LLVMCompatibility OBJECT ${SOURCES}) -set_target_properties(LLVMCompatibility PROPERTIES - COMPILE_FLAGS ${MULL_CXX_FLAGS} -) -target_include_directories(LLVMCompatibility SYSTEM PUBLIC - ${LLVM_INCLUDE_DIRS} -) -add_dependencies(LLVMCompatibility ${MULL_LLVM_COMPATIBILITY_LIBRARIES}) \ No newline at end of file diff --git a/LLVMCompatibility/7.x.x/LLVMCompatibility.cpp b/LLVMCompatibility/7.x.x/LLVMCompatibility.cpp deleted file mode 100644 index d8b2e6210..000000000 --- a/LLVMCompatibility/7.x.x/LLVMCompatibility.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#include "LLVMCompatibility.h" - -#include -#include -#include -#include -#include -#include -#include - -using namespace llvm; - -namespace llvm_compat { - -StringRef getSectionContent(const object::SectionRef §ion) { - StringRef content; - section.getContents(content); - return content; -} -StringRef getSectionName(const object::SectionRef §ion) { - StringRef name; - section.getName(name); - return name; -} - -DICompileUnit *getUnit(const DebugLoc &debugLocation) { - DIScope *scope = debugLocation->getScope(); - while (!llvm::isa(scope) && scope != nullptr) { - scope = scope->getScope().resolve(); - } - return scope ? llvm::cast(scope)->getUnit() : nullptr; -} - -static bool isItaniumEncoding(const std::string &MangledName) { - size_t Pos = MangledName.find_first_not_of('_'); - // A valid Itanium encoding requires 1-4 leading underscores, followed by 'Z'. - return Pos > 0 && Pos <= 4 && MangledName[Pos] == 'Z'; -} - -std::string demangle(const std::string &MangledName) { - char *Demangled; - if (isItaniumEncoding(MangledName)) - Demangled = llvm::itaniumDemangle(MangledName.c_str(), nullptr, nullptr, nullptr); - else - Demangled = llvm::microsoftDemangle(MangledName.c_str(), nullptr, nullptr, nullptr); - - if (!Demangled) - return MangledName; - - std::string Ret = Demangled; - std::free(Demangled); - return Ret; -} - -llvm::Value *getOrInsertFunction(llvm::Module *module, StringRef name, FunctionType *type) { - return module->getOrInsertFunction(name, type); -} - -void writeBitcodeToFile(const llvm::Module &module, llvm::raw_fd_ostream &stream) { - llvm::WriteBitcodeToFile(module, stream); -} - -bool addPassesToEmitObjectFile(TargetMachine *targetMachine, legacy::PassManagerBase &passManager, - raw_pwrite_stream &out) { - return targetMachine->addPassesToEmitFile( - passManager, out, nullptr, llvm::TargetMachine::CGFT_ObjectFile); -} - -} // namespace llvm_compat diff --git a/LLVMCompatibility/7.x.x/LLVMCompatibility.h b/LLVMCompatibility/7.x.x/LLVMCompatibility.h deleted file mode 100644 index 12bbfba48..000000000 --- a/LLVMCompatibility/7.x.x/LLVMCompatibility.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#include - -namespace llvm { - -class DICompileUnit; -class DebugLoc; -class TargetMachine; -class FunctionType; -class Value; -class Module; -class raw_pwrite_stream; -class raw_fd_ostream; - -namespace object { -class SectionRef; -} - -namespace legacy { -class PassManagerBase; -} -} // namespace llvm - -namespace llvm_compat { -llvm::StringRef getSectionContent(const llvm::object::SectionRef §ion); -llvm::StringRef getSectionName(const llvm::object::SectionRef §ion); -llvm::DICompileUnit *getUnit(const llvm::DebugLoc &debugLocation); -std::string demangle(const std::string &MangledName); -llvm::Value *getOrInsertFunction(llvm::Module *module, llvm::StringRef name, - llvm::FunctionType *type); -void writeBitcodeToFile(const llvm::Module &module, llvm::raw_fd_ostream &stream); -bool addPassesToEmitObjectFile(llvm::TargetMachine *targetMachine, - llvm::legacy::PassManagerBase &passManager, - llvm::raw_pwrite_stream &out); -} // namespace llvm_compat diff --git a/LLVMCompatibility/8.x.x/CMakeLists.txt b/LLVMCompatibility/8.x.x/CMakeLists.txt index aaf5c968d..4520aad95 100644 --- a/LLVMCompatibility/8.x.x/CMakeLists.txt +++ b/LLVMCompatibility/8.x.x/CMakeLists.txt @@ -10,4 +10,3 @@ set_target_properties(LLVMCompatibility PROPERTIES target_include_directories(LLVMCompatibility SYSTEM PUBLIC ${LLVM_INCLUDE_DIRS} ) -add_dependencies(LLVMCompatibility ${MULL_LLVM_COMPATIBILITY_LIBRARIES}) \ No newline at end of file diff --git a/LLVMCompatibility/9.x.x/CMakeLists.txt b/LLVMCompatibility/9.x.x/CMakeLists.txt index aaf5c968d..4520aad95 100644 --- a/LLVMCompatibility/9.x.x/CMakeLists.txt +++ b/LLVMCompatibility/9.x.x/CMakeLists.txt @@ -10,4 +10,3 @@ set_target_properties(LLVMCompatibility PROPERTIES target_include_directories(LLVMCompatibility SYSTEM PUBLIC ${LLVM_INCLUDE_DIRS} ) -add_dependencies(LLVMCompatibility ${MULL_LLVM_COMPATIBILITY_LIBRARIES}) \ No newline at end of file diff --git a/cmake/packaging/cpack.DEB-ubuntu.cmake b/cmake/packaging/cpack.DEB-ubuntu.cmake index 41096d2b4..28747a829 100644 --- a/cmake/packaging/cpack.DEB-ubuntu.cmake +++ b/cmake/packaging/cpack.DEB-ubuntu.cmake @@ -3,7 +3,6 @@ set (CPACK_GENERATOR DEB) set (CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT}) set (CPACK_DEBIAN_PACKAGE_DESCRIPTION ${PROJECT_DESCRIPTION}) - if (NOT NO_PRECOMPILED_LLVM) set (deps "zlib1g, libncurses5, libstdc++6, libxml2, libsqlite3-0") else() @@ -11,4 +10,3 @@ else() endif() set (CPACK_DEBIAN_PACKAGE_DEPENDS ${deps}) - diff --git a/infrastructure/helpers/variables.yaml b/infrastructure/helpers/variables.yaml index a23e36c30..4426c8391 100644 --- a/infrastructure/helpers/variables.yaml +++ b/infrastructure/helpers/variables.yaml @@ -31,11 +31,6 @@ llvm_mapping: precompiled: true path: /usr/local/opt/llvm@8 brew_llvm_package: llvm@8 - 7.0.0: - url: https://releases.llvm.org/7.0.0/clang+llvm-7.0.0-x86_64-apple-darwin.tar.xz - precompiled: true - path: /usr/local/opt/llvm@7 - brew_llvm_package: llvm@7 debian: 6.0.0: @@ -46,7 +41,15 @@ llvm_mapping: 13.0.0: url: https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-20.04.tar.xz path: clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-20.04 - precompiled: true + precompiled: false + packages: + - llvm-13-dev + - libclang-13-dev + - libc++-13-dev + - libc++abi-13-dev + - clang-13 + cmake_cc: clang-13 + cmake_cxx: clang++-13 12.0.0: url: https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.0/clang+llvm-12.0.0-x86_64-linux-gnu-ubuntu-20.04.tar.xz path: clang+llvm-12.0.0-x86_64-linux-gnu-ubuntu-20.04 @@ -107,17 +110,6 @@ llvm_mapping: - clang-8 cmake_cc: clang-8 cmake_cxx: clang++-8 - 7.0.0: - url: https://releases.llvm.org/7.0.0/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz - path: clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04 - precompiled: true - packages: - - llvm-7-dev - - libclang-7-dev - - libc++-7-dev - - clang-7 - cmake_cc: clang-7 - cmake_cxx: clang++-7 fedora: 6.0.0: diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index dfe907c6a..2032b1c40 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -120,29 +120,11 @@ add_library(mull set_source_files_properties(${mull_header_dirs} PROPERTIES HEADER_FILE_ONLY ON) -if ("LLVM" IN_LIST LLVM_AVAILABLE_LIBS) - set(MULL_LLVM_LIBRARIES - LLVM - ) -else () - set(MULL_LLVM_LIBRARIES - LLVMSupport - LLVMOption - LLVMCoverage - LLVMProfileData - LLVMAsmParser - LLVMSupport - LLVMOption - LLVM${LLVM_NATIVE_ARCH}CodeGen - LLVM${LLVM_NATIVE_ARCH}AsmParser - ) -endif () - find_package(Threads REQUIRED) find_package(SQLite3 REQUIRED) target_link_libraries(mull - ${MULL_LLVM_LIBRARIES} + LLVM SQLite::SQLite3 clangTooling Threads::Threads diff --git a/tools/mull-cxx/CMakeLists.txt b/tools/mull-cxx/CMakeLists.txt index 2cae7ba58..ef27fa962 100644 --- a/tools/mull-cxx/CMakeLists.txt +++ b/tools/mull-cxx/CMakeLists.txt @@ -3,19 +3,9 @@ set (SOURCES ${CMAKE_CURRENT_LIST_DIR}/../CLIOptions/CLIOptions.cpp ) -if ("LLVM" IN_LIST LLVM_AVAILABLE_LIBS) - set (MULL_CXX_LLVM_LIBRARIES - LLVM - ) -else() - set (MULL_CXX_LLVM_LIBRARIES - LLVMObject - ) -endif() - add_mull_executable( NAME mull-cxx-${LLVM_VERSION_MAJOR} SOURCES ${SOURCES} - LINK_WITH ebc mull ${MULL_CXX_LLVM_LIBRARIES} json11 + LINK_WITH ebc mull json11 LLVM ) target_include_directories(mull-cxx-${LLVM_VERSION_MAJOR} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/../CLIOptions) diff --git a/tools/mull-runner/CMakeLists.txt b/tools/mull-runner/CMakeLists.txt index 071d94fc3..b460b7640 100644 --- a/tools/mull-runner/CMakeLists.txt +++ b/tools/mull-runner/CMakeLists.txt @@ -8,6 +8,6 @@ set (SOURCES add_mull_executable( NAME mull-runner-${LLVM_VERSION_MAJOR} SOURCES ${SOURCES} - LINK_WITH mull json11 + LINK_WITH mull json11 LLVM ) target_include_directories(mull-runner-${LLVM_VERSION_MAJOR} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/../CLIOptions)