Skip to content

Commit

Permalink
LLVM 13 support (#826)
Browse files Browse the repository at this point in the history
* CI: Use Mac OS 11 and XCode 13

* LLVM 13.0.0
  • Loading branch information
ekilmer authored Oct 3, 2021
1 parent a8fc64a commit 9395d14
Show file tree
Hide file tree
Showing 17 changed files with 876 additions and 14 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/vcpkg_ci_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ jobs:
'llvm-9',
'llvm-10',
'llvm-11',
'llvm-12'
'llvm-12',
'llvm-13'
]
# Only some LLVM versions for ARM CI
include:
Expand Down Expand Up @@ -198,7 +199,7 @@ jobs:
- name: 'Test rellic build'
shell: 'bash'
if: ${{ matrix.llvm != 'llvm-12' }}
if: ${{ matrix.llvm != 'llvm-12' && matrix.llvm != 'llvm-13' }}
run: |
cd rellic
rm -rf build
Expand All @@ -214,6 +215,7 @@ jobs:
- name: 'Test remill build'
shell: 'bash'
if: ${{ matrix.llvm != 'llvm-13' }}
run: |
cd remill
rm -rf build
Expand Down Expand Up @@ -274,7 +276,7 @@ jobs:
- name: 'Anvill-McSema build - custom remill'
shell: 'bash'
if: ${{ matrix.llvm != 'llvm-12' }}
if: ${{ matrix.llvm != 'llvm-12' && matrix.llvm != 'llvm-13' }}
run: |
cd anvill-mcsema
rm -rf build
Expand All @@ -292,7 +294,7 @@ jobs:
- name: 'Test mcsema build'
shell: 'bash'
if: ${{ matrix.llvm != 'llvm-12' }}
if: ${{ matrix.llvm != 'llvm-12' && matrix.llvm != 'llvm-13' }}
run: |
cd mcsema
rm -rf build
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/vcpkg_ci_mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ jobs:
fail-fast: false
matrix:
os:
- { runner: 'macos-10.15', xcode: '12.4' }
# - { runner: 'macos-11.0', xcode: '12.5' }
# - { runner: 'macos-10.15', xcode: '12.4' }
- { runner: 'macos-11', xcode: '13.0' }
llvm: [
'llvm-10',
'llvm-11',
'llvm-12'
'llvm-12',
'llvm-13'
]

runs-on: ${{ matrix.os.runner }}
Expand Down Expand Up @@ -166,7 +167,7 @@ jobs:
- name: 'Test rellic build'
shell: 'bash'
if: ${{ matrix.llvm != 'llvm-12' }}
if: ${{ matrix.llvm != 'llvm-12' && matrix.llvm != 'llvm-13' }}
run: |
cd rellic
mkdir -p build && cd build
Expand All @@ -181,6 +182,7 @@ jobs:
- name: 'Test remill build'
shell: 'bash'
if: ${{ matrix.llvm != 'llvm-13' }}
run: |
cd remill
mkdir -p build && cd build
Expand Down Expand Up @@ -232,7 +234,7 @@ jobs:
- name: 'Anvill-McSema build - custom remill'
shell: 'bash'
if: ${{ matrix.llvm != 'llvm-12' }}
if: ${{ matrix.llvm != 'llvm-12' && matrix.llvm != 'llvm-13' }}
run: |
cd anvill-mcsema
mkdir -p build && cd build
Expand All @@ -249,7 +251,7 @@ jobs:
- name: 'Test mcsema build'
shell: 'bash'
if: ${{ matrix.llvm != 'llvm-12' }}
if: ${{ matrix.llvm != 'llvm-12' && matrix.llvm != 'llvm-13' }}
run: |
cd mcsema
mkdir -p build && cd build
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/vcpkg_ci_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ jobs:
# 'llvm-9',
# 'llvm-10',
'llvm-11',
'llvm-12'
'llvm-12',
'llvm-13'
]

runs-on: ['self-hosted', 'Windows', 'X64']
Expand Down Expand Up @@ -148,7 +149,7 @@ jobs:
# remill

- name: 'Test rellic build'
if: ${{ matrix.llvm != 'llvm-12' }}
if: ${{ matrix.llvm != 'llvm-12' && matrix.llvm != 'llvm-13' }}
run: |
cd rellic
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue .\build
Expand All @@ -166,6 +167,7 @@ jobs:
# python ../scripts/roundtrip.py ( Get-ChildItem tools | Where-Object {$_.name -match "rellic-decomp-.*.exe"} ) ..\tests\tools\decomp "${env:VCPKG_ROOT}\installed\${env:TRIPLET}\tools\${{ matrix.llvm }}\clang.exe"
- name: 'Test remill build'
if: ${{ matrix.llvm != 'llvm-13' }}
run: |
cd remill
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue .\build
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,4 @@ See [here](https://github.com/microsoft/vcpkg/blob/master/docs/examples/packagin

This repo is under the Apache-2.0 LICENSE, unless where specified. See below.

The LLVM version port directories (ports/llvm-{9,10,11}) were initially copied from the upstream [vcpkg](https://github.com/microsoft/vcpkg) repo as a starting point. Eventually, we plan to submit the relevant patches for upstream when we have thoroughly tested these changes. More info can be found in the respective `LICENSE` and `NOTICE` files in those directories.
The LLVM version port directories (ports/llvm-{9,10,11,12,13}) were initially copied from the upstream [vcpkg](https://github.com/microsoft/vcpkg) repo as a starting point. Eventually, we plan to submit the relevant patches for upstream when we have thoroughly tested these changes. More info can be found in the respective `LICENSE` and `NOTICE` files in those directories.
128 changes: 128 additions & 0 deletions ports/llvm-13/0001-fix-install-paths.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
diff --git a/clang/cmake/modules/CMakeLists.txt b/clang/cmake/modules/CMakeLists.txt
index 561665d58cad..3c73878a4483 100644
--- a/clang/cmake/modules/CMakeLists.txt
+++ b/clang/cmake/modules/CMakeLists.txt
@@ -3,11 +3,11 @@ include(LLVMDistributionSupport)
# Generate a list of CMake library targets so that other CMake projects can
# link against them. LLVM calls its version of this file LLVMExports.cmake, but
# the usual CMake convention seems to be ${Project}Targets.cmake.
-set(CLANG_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/clang)
+set(CLANG_INSTALL_PACKAGE_DIR share/clang)
set(clang_cmake_builddir "${CMAKE_BINARY_DIR}/${CLANG_INSTALL_PACKAGE_DIR}")

# Keep this in sync with llvm/cmake/CMakeLists.txt!
-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
+set(LLVM_INSTALL_PACKAGE_DIR share/llvm)
set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")

get_property(CLANG_EXPORTS GLOBAL PROPERTY CLANG_EXPORTS)
diff --git a/flang/cmake/modules/CMakeLists.txt b/flang/cmake/modules/CMakeLists.txt
index e46498a6bc35..2e922f8ca89d 100644
--- a/flang/cmake/modules/CMakeLists.txt
+++ b/flang/cmake/modules/CMakeLists.txt
@@ -1,11 +1,11 @@
# Generate a list of CMake library targets so that other CMake projects can
# link against them. LLVM calls its version of this file LLVMExports.cmake, but
# the usual CMake convention seems to be ${Project}Targets.cmake.
-set(FLANG_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/flang)
+set(FLANG_INSTALL_PACKAGE_DIR share/flang)
set(flang_cmake_builddir "${CMAKE_BINARY_DIR}/${FLANG_INSTALL_PACKAGE_DIR}")

# Keep this in sync with llvm/cmake/CMakeLists.txt!
-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
+set(LLVM_INSTALL_PACKAGE_DIR share/llvm)
set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")

get_property(FLANG_EXPORTS GLOBAL PROPERTY FLANG_EXPORTS)
diff --git a/lld/cmake/modules/CMakeLists.txt b/lld/cmake/modules/CMakeLists.txt
index 62d03fa901dd..09b0f54ee8c3 100644
--- a/lld/cmake/modules/CMakeLists.txt
+++ b/lld/cmake/modules/CMakeLists.txt
@@ -1,11 +1,11 @@
# Generate a list of CMake library targets so that other CMake projects can
# link against them. LLVM calls its version of this file LLVMExports.cmake, but
# the usual CMake convention seems to be ${Project}Targets.cmake.
-set(LLD_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/lld)
+set(LLD_INSTALL_PACKAGE_DIR share/lld)
set(lld_cmake_builddir "${CMAKE_BINARY_DIR}/${LLD_INSTALL_PACKAGE_DIR}")

# Keep this in sync with llvm/cmake/CMakeLists.txt!
-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
+set(LLVM_INSTALL_PACKAGE_DIR share/llvm)
set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")

get_property(LLD_EXPORTS GLOBAL PROPERTY LLD_EXPORTS)
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 29e40f45fef8..e9094e9b8eb2 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -1033,7 +1033,7 @@ function(process_llvm_pass_plugins)

## Part 1: Extension header to be included whenever we need extension
# processing.
- set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
+ set(LLVM_INSTALL_PACKAGE_DIR share/llvm)
set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
file(WRITE
"${llvm_cmake_builddir}/LLVMConfigExtensions.cmake"
diff --git a/llvm/cmake/modules/CMakeLists.txt b/llvm/cmake/modules/CMakeLists.txt
index 51b6a4fdc284..a818de2e116c 100644
--- a/llvm/cmake/modules/CMakeLists.txt
+++ b/llvm/cmake/modules/CMakeLists.txt
@@ -1,6 +1,6 @@
include(LLVMDistributionSupport)

-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
+set(LLVM_INSTALL_PACKAGE_DIR share/llvm)
set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")

# First for users who use an installed LLVM, create the LLVMExports.cmake file.
diff --git a/mlir/cmake/modules/CMakeLists.txt b/mlir/cmake/modules/CMakeLists.txt
index 65efc4a14987..7c3213ab0c2b 100644
--- a/mlir/cmake/modules/CMakeLists.txt
+++ b/mlir/cmake/modules/CMakeLists.txt
@@ -3,11 +3,11 @@ include(LLVMDistributionSupport)
# Generate a list of CMake library targets so that other CMake projects can
# link against them. LLVM calls its version of this file LLVMExports.cmake, but
# the usual CMake convention seems to be ${Project}Targets.cmake.
-set(MLIR_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/mlir)
+set(MLIR_INSTALL_PACKAGE_DIR share/mlir)
set(mlir_cmake_builddir "${CMAKE_BINARY_DIR}/${MLIR_INSTALL_PACKAGE_DIR}")

# Keep this in sync with llvm/cmake/CMakeLists.txt!
-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
+set(LLVM_INSTALL_PACKAGE_DIR share/llvm)
set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")

get_property(MLIR_EXPORTS GLOBAL PROPERTY MLIR_EXPORTS)
diff --git a/polly/cmake/CMakeLists.txt b/polly/cmake/CMakeLists.txt
index 7cc129ba2e90..9776391cd535 100644
--- a/polly/cmake/CMakeLists.txt
+++ b/polly/cmake/CMakeLists.txt
@@ -1,7 +1,7 @@
# Keep this in sync with llvm/cmake/CMakeLists.txt!

-set(LLVM_INSTALL_PACKAGE_DIR "lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
-set(POLLY_INSTALL_PACKAGE_DIR "lib${LLVM_LIBDIR_SUFFIX}/cmake/polly")
+set(LLVM_INSTALL_PACKAGE_DIR share/llvm)
+set(POLLY_INSTALL_PACKAGE_DIR share/polly)
if (CMAKE_CONFIGURATION_TYPES)
set(POLLY_EXPORTS_FILE_NAME "PollyExports-$<LOWER_CASE:$<CONFIG>>.cmake")
else()
diff --git a/pstl/CMakeLists.txt b/pstl/CMakeLists.txt
index 8bea8843589b..3658c0a4414a 100644
--- a/pstl/CMakeLists.txt
+++ b/pstl/CMakeLists.txt
@@ -81,10 +81,10 @@ install(TARGETS ParallelSTL
install(EXPORT ParallelSTLTargets
FILE ParallelSTLTargets.cmake
NAMESPACE pstl::
- DESTINATION lib/cmake/ParallelSTL)
+ DESTINATION share/ParallelSTL)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ParallelSTLConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/ParallelSTLConfigVersion.cmake"
- DESTINATION lib/cmake/ParallelSTL)
+ DESTINATION share/ParallelSTL)
install(DIRECTORY include/
DESTINATION include
PATTERN "*.in" EXCLUDE)
22 changes: 22 additions & 0 deletions ports/llvm-13/0002-fix-openmp-debug.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt
index bdb867e352f7..16a13fa959ea 100644
--- a/openmp/runtime/src/CMakeLists.txt
+++ b/openmp/runtime/src/CMakeLists.txt
@@ -159,7 +159,7 @@ else()
endif()

set_target_properties(omp PROPERTIES
- PREFIX "" SUFFIX "" OUTPUT_NAME "${LIBOMP_LIB_FILE}"
+ PREFIX "" SUFFIX "" OUTPUT_NAME "${LIBOMP_LIB_FILE}" DEBUG_POSTFIX ""
LINK_FLAGS "${LIBOMP_CONFIGURED_LDFLAGS}"
LINKER_LANGUAGE ${LIBOMP_LINKER_LANGUAGE}
)
@@ -236,7 +236,7 @@ if(WIN32)
# Create new import library that is just the previously created one + kmp_import.cpp
add_library(ompimp STATIC ${LIBOMP_GENERATED_IMP_LIB} kmp_import.cpp)
set_target_properties(ompimp PROPERTIES
- PREFIX "" SUFFIX "" OUTPUT_NAME "${LIBOMP_IMP_LIB_FILE}"
+ PREFIX "" SUFFIX "" OUTPUT_NAME "${LIBOMP_IMP_LIB_FILE}" DEBUG_POSTFIX ""
LINKER_LANGUAGE C
)
add_dependencies(ompimp omp) # ensure generated import library is created first
14 changes: 14 additions & 0 deletions ports/llvm-13/0003-fix-dr-1734.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/llvm/include/llvm/Support/type_traits.h b/llvm/include/llvm/Support/type_traits.h
index 7b7d5d991f3f..332864c1907e 100644
--- a/llvm/include/llvm/Support/type_traits.h
+++ b/llvm/include/llvm/Support/type_traits.h
@@ -176,7 +176,8 @@ class is_trivially_copyable {
(has_deleted_copy_assign || has_trivial_copy_assign) &&
(has_deleted_copy_constructor || has_trivial_copy_constructor);

-#ifdef HAVE_STD_IS_TRIVIALLY_COPYABLE
+ // due to DR 1734, a type can be std::is_trivially_copyable but not llvm::is_trivially_copyable
+#if 0
static_assert(value == std::is_trivially_copyable<T>::value,
"inconsistent behavior between llvm:: and std:: implementation of is_trivially_copyable");
#endif
13 changes: 13 additions & 0 deletions ports/llvm-13/0004-fix-tools-path.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp
index 1a2f04552d13..9370c5e28206 100644
--- a/llvm/tools/llvm-config/llvm-config.cpp
+++ b/llvm/tools/llvm-config/llvm-config.cpp
@@ -305,7 +305,7 @@ int main(int argc, char **argv) {
// bin dir).
sys::fs::make_absolute(CurrentPath);
CurrentExecPrefix =
- sys::path::parent_path(sys::path::parent_path(CurrentPath)).str();
+ sys::path::parent_path(sys::path::parent_path(sys::path::parent_path(CurrentPath))).str();

// Check to see if we are inside a development tree by comparing to possible
// locations (prefix style or CMake style).
39 changes: 39 additions & 0 deletions ports/llvm-13/0005-fix-compiler-rt-install-path.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
diff --git a/clang/lib/Headers/CMakeLists.txt b/clang/lib/Headers/CMakeLists.txt
index 8131f6005dc2..9afef2e5a4e7 100644
--- a/clang/lib/Headers/CMakeLists.txt
+++ b/clang/lib/Headers/CMakeLists.txt
@@ -222,7 +222,7 @@ set_target_properties(clang-resource-headers PROPERTIES
FOLDER "Misc"
RUNTIME_OUTPUT_DIRECTORY "${output_dir}")

-set(header_install_dir lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
+set(header_install_dir tools/llvm/lib/clang/${CLANG_VERSION}/include)

install(
FILES ${files} ${generated_files}
diff --git a/clang/runtime/CMakeLists.txt b/clang/runtime/CMakeLists.txt
index 61b1c60bf590..c20a5a326f15 100644
--- a/clang/runtime/CMakeLists.txt
+++ b/clang/runtime/CMakeLists.txt
@@ -82,7 +82,7 @@ if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND EXISTS ${COMPILER_RT_SRC_ROOT}/)
-DLLVM_LIT_ARGS=${LLVM_LIT_ARGS}
-DCOMPILER_RT_OUTPUT_DIR=${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}
-DCOMPILER_RT_EXEC_OUTPUT_DIR=${LLVM_RUNTIME_OUTPUT_INTDIR}
- -DCOMPILER_RT_INSTALL_PATH:PATH=lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}
+ -DCOMPILER_RT_INSTALL_PATH:PATH=tools/llvm/lib/clang/${CLANG_VERSION}
-DCOMPILER_RT_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX}
diff --git a/compiler-rt/cmake/base-config-ix.cmake b/compiler-rt/cmake/base-config-ix.cmake
index c11342e68813..61bb52135c43 100644
--- a/compiler-rt/cmake/base-config-ix.cmake
+++ b/compiler-rt/cmake/base-config-ix.cmake
@@ -42,7 +42,7 @@ if (LLVM_TREE_AVAILABLE)
# Setup the paths where compiler-rt runtimes and headers should be stored.
set(COMPILER_RT_OUTPUT_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION})
set(COMPILER_RT_EXEC_OUTPUT_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
- set(COMPILER_RT_INSTALL_PATH lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION})
+ set(COMPILER_RT_INSTALL_PATH tools/llvm/lib/clang/${CLANG_VERSION})
option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests."
${LLVM_INCLUDE_TESTS})
option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered"
Loading

0 comments on commit 9395d14

Please sign in to comment.