Compare commits

...
8 Commits
Author SHA1 Message Date
Henrik Grimler 5767da6fdc fixup! libllvm: try to fix mlir-tblgen path for flang 2021-11-05 20:55:55 +01:00
Henrik Grimler 2c12d8ce29 libllvm: fix build error in flang:
/home/builder/.termux-build/libllvm/src/flang/lib/Evaluate/constant.cpp:254:30: error: non-constant-expression cannot be narrowed from type 'long long' to 'std::size_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
    std::size_t elementBytes{length_ * sizeof(decltype(values_[0]))};
2021-11-05 20:55:55 +01:00
Henrik Grimler 898ccca61d [SQUASHME] libllvm: try building without hostbuilt f18 2021-11-05 20:55:55 +01:00
Henrik Grimler 7bbca24345 [SQUASHME] Revive mlir-tblgen path patch 2021-11-05 20:55:55 +01:00
Henrik Grimler fcf0c020d9 fixup! libllvm: try to fix mlir-tblgen path for flang 2021-11-05 20:55:55 +01:00
Henrik Grimler eba6939994 fixup! libllvm: try to fix mlir-tblgen path for flang 2021-11-05 20:55:55 +01:00
Henrik Grimler 87d1f4d3f7 libllvm: try to fix mlir-tblgen path for flang 2021-11-05 20:55:55 +01:00
ihsakashi 78c9328e28 libllvm: add flang subpackage 2021-11-05 20:55:55 +01:00
6 changed files with 155 additions and 5 deletions
+16 -5
View File
@@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="Modular compiler and toolchain technologies library"
TERMUX_PKG_LICENSE="NCSA"
TERMUX_PKG_MAINTAINER="@buttaface"
TERMUX_PKG_VERSION=13.0.0
TERMUX_PKG_REVISION=2
TERMUX_PKG_REVISION=3
TERMUX_PKG_SHA256=6075ad30f1ac0e15f07c1bf062c1e1268c241d674f11bd32cdf0e040c71f2bf3
TERMUX_PKG_SRCURL=https://github.com/llvm/llvm-project/releases/download/llvmorg-$TERMUX_PKG_VERSION/llvm-project-$TERMUX_PKG_VERSION.src.tar.xz
TERMUX_PKG_HOSTBUILD=true
@@ -23,7 +23,7 @@ TERMUX_PKG_GROUPS="base-devel"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-DPYTHON_EXECUTABLE=$(which python3)
-DLLVM_ENABLE_PIC=ON
-DLLVM_ENABLE_PROJECTS=clang;clang-tools-extra;compiler-rt;lld;lldb;openmp;polly
-DLLVM_ENABLE_PROJECTS=clang;clang-tools-extra;compiler-rt;flang;lld;lldb;openmp;polly
-DLLVM_ENABLE_LIBEDIT=OFF
-DLLVM_INCLUDE_TESTS=OFF
-DCLANG_DEFAULT_CXX_STDLIB=libc++
@@ -45,9 +45,10 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=AVR;RISCV
-DPERL_EXECUTABLE=$(which perl)
-DLLVM_ENABLE_FFI=ON
-DFLANG_INCLUDE_TESTS=OFF
"
if [ $TERMUX_ARCH_BITS = 32 ]; then
if [ "$TERMUX_ARCH_BITS" == "32" ]; then
# Do not set _FILE_OFFSET_BITS=64
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DLLVM_FORCE_SMALLFILE_FOR_ANDROID=on"
fi
@@ -62,8 +63,9 @@ termux_step_host_build() {
termux_setup_cmake
termux_setup_ninja
cmake -G Ninja -DLLVM_ENABLE_PROJECTS='clang;lldb' $TERMUX_PKG_SRCDIR/llvm
ninja -j $TERMUX_MAKE_PROCESSES clang-tblgen lldb-tblgen llvm-tblgen
cmake -G Ninja -DLLVM_ENABLE_PROJECTS='clang;flang;lldb;mlir' $TERMUX_PKG_SRCDIR/llvm
ninja -j $TERMUX_MAKE_PROCESSES clang-tblgen lldb-tblgen llvm-tblgen \
mlir-tblgen mlir-linalg-ods-gen
}
termux_step_pre_configure() {
@@ -89,10 +91,19 @@ termux_step_pre_configure() {
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DLLVM_HOST_TRIPLE=$LLVM_DEFAULT_TARGET_TRIPLE"
export TERMUX_SRCDIR_SAVE=$TERMUX_PKG_SRCDIR
TERMUX_PKG_SRCDIR=$TERMUX_PKG_SRCDIR/llvm
# flang doesn't seem to be fully cross-compilation friendly.
# Fix so that it uses mlir-tblgen for host instead of for
# termux arch
echo "Applying flang-mlir-tblgen-path.diff"
sed "s%@TERMUX_HOSTBUILD_DIR@%$TERMUX_PKG_HOSTBUILD_DIR%g" \
$TERMUX_PKG_BUILDER_DIR/flang-mlir-tblgen-path.diff \
| patch --silent -p1
}
termux_step_post_configure() {
TERMUX_PKG_SRCDIR=$TERMUX_SRCDIR_SAVE
# add hostbuild dir to path so mlir-tblgen is found
export PATH=$TERMUX_PKG_HOSTBUILD_DIR/bin:$PATH
}
termux_step_post_make_install() {
@@ -0,0 +1,88 @@
--- ../TableGen.cmake.orig 2021-11-02 09:11:56.919733114 +0000
+++ ./llvm/cmake/modules/TableGen.cmake 2021-11-02 12:02:57.999817085 +0000
@@ -102,8 +102,7 @@
# The file in LLVM_TARGET_DEFINITIONS may be not in the current
# directory and local_tds may not contain it, so we must
# explicitly list it here:
- DEPENDS ${${project}_TABLEGEN_TARGET} ${${project}_TABLEGEN_EXE}
- ${local_tds} ${global_tds}
+ DEPENDS ${local_tds} ${global_tds}
${LLVM_TARGET_DEFINITIONS_ABSOLUTE}
${LLVM_TARGET_DEPENDS}
COMMENT "Building ${ofn}..."
@@ -151,33 +150,6 @@
set(${project}_TABLEGEN_EXE ${${project}_TABLEGEN} PARENT_SCOPE)
set(${project}_TABLEGEN_TARGET ${${project}_TABLEGEN} PARENT_SCOPE)
- if(LLVM_USE_HOST_TOOLS)
- if( ${${project}_TABLEGEN} STREQUAL "${target}" )
- # The NATIVE tablegen executable *must* depend on the current target one
- # otherwise the native one won't get rebuilt when the tablgen sources
- # change, and we end up with incorrect builds.
- build_native_tool(${target} ${project}_TABLEGEN_EXE DEPENDS ${target})
- set(${project}_TABLEGEN_EXE ${${project}_TABLEGEN_EXE} PARENT_SCOPE)
-
- add_custom_target(${project}-tablegen-host DEPENDS ${${project}_TABLEGEN_EXE})
- set(${project}_TABLEGEN_TARGET ${project}-tablegen-host PARENT_SCOPE)
-
- # Create an artificial dependency between tablegen projects, because they
- # compile the same dependencies, thus using the same build folders.
- # FIXME: A proper fix requires sequentially chaining tablegens.
- if (NOT ${project} STREQUAL LLVM AND TARGET ${project}-tablegen-host AND
- TARGET LLVM-tablegen-host)
- add_dependencies(${project}-tablegen-host LLVM-tablegen-host)
- endif()
-
- # If we're using the host tablegen, and utils were not requested, we have no
- # need to build this tablegen.
- if ( NOT LLVM_BUILD_UTILS )
- set_target_properties(${target} PROPERTIES EXCLUDE_FROM_ALL ON)
- endif()
- endif()
- endif()
-
if ((${project} STREQUAL LLVM OR ${project} STREQUAL MLIR) AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND LLVM_BUILD_UTILS)
set(export_to_llvmexports)
if(${target} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
--- ../mlir-CMakeLists.txt 2021-11-05 14:08:38.652987268 +0000
+++ ./mlir/tools/mlir-linalg-ods-gen/CMakeLists.txt 2021-11-05 18:40:08.384180048 +0000
@@ -24,21 +24,6 @@
set(MLIR_LINALG_ODS_GEN_EXE ${MLIR_LINALG_ODS_GEN} PARENT_SCOPE)
set(MLIR_LINALG_ODS_GEN_TARGET mlir-linalg-ods-gen PARENT_SCOPE)
-if(LLVM_USE_HOST_TOOLS)
- if (${MLIR_LINALG_ODS_GEN} STREQUAL "mlir-linalg-ods-gen")
- build_native_tool(mlir-linalg-ods-gen MLIR_LINALG_ODS_GEN_EXE DEPENDS mlir-linalg-ods-gen)
- set(MLIR_LINALG_ODS_GEN_EXE ${MLIR_LINALG_ODS_GEN_EXE} PARENT_SCOPE)
-
- add_custom_target(mlir-linalg-ods-gen-host DEPENDS ${MLIR_LINALG_ODS_GEN_EXE})
- set(MLIR_LINALG_ODS_GEN_TARGET mlir-linalg-ods-gen-host DEPENDS PARENT_SCOPE)
-
- if(NOT LLVM_BUILD_UTILS)
- set_target_properties(mlir-linalg-ods-gen PROPERTIES EXCLUDE_FROM_ALL ON)
- endif()
- endif()
-endif()
-
-
# New mlir-linalg-ods-yaml-gen.
add_llvm_tool(mlir-linalg-ods-yaml-gen
mlir-linalg-ods-yaml-gen.cpp
@@ -55,17 +40,3 @@
set(MLIR_LINALG_ODS_YAML_GEN_EXE ${MLIR_LINALG_ODS_YAML_GEN} PARENT_SCOPE)
set(MLIR_LINALG_ODS_YAML_GEN_TARGET mlir-linalg-ods-yaml-gen PARENT_SCOPE)
-
-if(LLVM_USE_HOST_TOOLS)
- if (${MLIR_LINALG_ODS_YAML_GEN} STREQUAL "mlir-linalg-ods-yaml-gen")
- build_native_tool(mlir-linalg-ods-yaml-gen MLIR_LINALG_ODS_YAML_GEN_EXE DEPENDS mlir-linalg-ods-yaml-gen)
- set(MLIR_LINALG_ODS_YAML_GEN_EXE ${MLIR_LINALG_ODS_YAML_GEN_EXE} PARENT_SCOPE)
-
- add_custom_target(mlir-linalg-ods-yaml-gen-host DEPENDS ${MLIR_LINALG_ODS_YAML_GEN_EXE})
- set(MLIR_LINALG_ODS_YAML_GEN_TARGET mlir-linalg-ods-yaml-gen-host DEPENDS PARENT_SCOPE)
-
- if(NOT LLVM_BUILD_UTILS)
- set_target_properties(mlir-linalg-ods-yaml-gen PROPERTIES EXCLUDE_FROM_ALL ON)
- endif()
- endif()
-endif()
@@ -0,0 +1,11 @@
--- ../constant.cpp.orig 2021-11-02 19:17:00.334258751 +0000
+++ ./flang/lib/Evaluate/constant.cpp 2021-11-02 19:17:50.954235438 +0000
@@ -251,7 +251,7 @@
return count;
} else {
std::size_t copied{0};
- std::size_t elementBytes{length_ * sizeof(decltype(values_[0]))};
+ std::size_t elementBytes{static_cast<size_t>(length_ * sizeof(decltype(values_[0])))};
ConstantSubscripts sourceSubscripts{source.lbounds()};
while (copied < count) {
auto *dest{&values_.at(SubscriptsToOffset(resultSubscripts) * length_)};
@@ -0,0 +1,11 @@
--- ../flang-CMakeLists.txt.orig 2021-11-01 20:21:00.415044742 +0000
+++ ./flang/CMakeLists.txt 2021-11-01 20:21:42.108743889 +0000
@@ -199,7 +199,7 @@
set(MLIR_MAIN_SRC_DIR ${LLVM_MAIN_SRC_DIR}/../mlir/include ) # --src-root
set(MLIR_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/../mlir/include ) # --includedir
set(MLIR_TABLEGEN_OUTPUT_DIR ${CMAKE_BINARY_DIR}/tools/mlir/include)
- set(MLIR_TABLEGEN_EXE $<TARGET_FILE:mlir-tblgen>)
+ set(MLIR_TABLEGEN_EXE @TERMUX_HOSTBUILD_DIR@/bin/mlir-tblgen)
include_directories(SYSTEM ${MLIR_INCLUDE_DIR})
include_directories(SYSTEM ${MLIR_TABLEGEN_OUTPUT_DIR})
endif()
@@ -0,0 +1,11 @@
--- ../misc-intrinsic.cpp.orig 2021-11-05 14:02:21.780717197 +0000
+++ ./flang/runtime/misc-intrinsic.cpp 2021-11-05 14:03:00.590655398 +0000
@@ -47,7 +47,7 @@
"TRANSFER: could not allocate memory for result; STAT=%d", stat);
}
char *to{result.OffsetElement<char>()};
- std::size_t resultBytes{size * elementBytes};
+ std::size_t resultBytes{static_cast<size_t>(size * elementBytes)};
const std::size_t sourceElementBytes{source.ElementBytes()};
std::size_t sourceElements{source.Elements()};
SubscriptValue sourceAt[maxRank];
+18
View File
@@ -0,0 +1,18 @@
TERMUX_SUBPKG_INCLUDE="
bin/f18
bin/f18-parse-demo
bin/tco
bin/flang
include/flang*
lib/cmake/flang
lib/libFortranCommon.a
lib/libFortranCommon.a
lib/libFortranEvaluate.a
lib/libFortranEvaluate.a
lib/lib/libFortranEvaluate.a
lib/libFortranParser.a
lib/libFortranSemantics.a
lib/libFIROptimizer.a
lib/libFortranRuntime.a
"
TERMUX_SUBPKG_DESCRIPTION="Fortran language frontend for LLVM"