Browse Source

llvm fixes using jit and calling getProcessTriple (#2299)

* llvm fixes using jit and calling getProcessTriple

* works properly with rustc

* this allows python llvmlite to built
android-5
its-pointless 7 years ago
committed by Fredrik Fornwall
parent
commit
3cf404e051
  1. 31
      packages/libllvm/0001-Transforms-Add-missing-header-for-InstructionCombini.patch
  2. 7
      packages/libllvm/build.sh
  3. 76
      packages/libllvm/llvm-config.in

31
packages/libllvm/0001-Transforms-Add-missing-header-for-InstructionCombini.patch

@ -0,0 +1,31 @@
From 7c9054610e354340f9474dcd13a927f929912d1d Mon Sep 17 00:00:00 2001
From: Eugene Zelenko <eugene.zelenko@gmail.com>
Date: Tue, 6 Mar 2018 23:06:13 +0000
Subject: [PATCH] [Transforms] Add missing header for InstructionCombining.cpp,
in order to export LLVMInitializeInstCombine as extern "C". Fixes PR35947.
Patch by Brenton Bostick.
Differential revision: https://reviews.llvm.org/D44140
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326843 91177308-0d34-0410-b5e6-96231b3b80d8
---
lib/Transforms/InstCombine/InstructionCombining.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/Transforms/InstCombine/InstructionCombining.cpp b/lib/Transforms/InstCombine/InstructionCombining.cpp
index a3b2fe9..7ec7343 100644
--- a/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -34,6 +34,7 @@
//===----------------------------------------------------------------------===//
#include "InstCombineInternal.h"
+#include "llvm-c/Initialization.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
--
1.8.3.1

7
packages/libllvm/build.sh

@ -2,6 +2,7 @@ TERMUX_PKG_HOMEPAGE=https://clang.llvm.org/
TERMUX_PKG_DESCRIPTION="Modular compiler and toolchain technologies library"
_PKG_MAJOR_VERSION=6.0
TERMUX_PKG_VERSION=${_PKG_MAJOR_VERSION}.0
TERMUX_PKG_REVISION=1
TERMUX_PKG_SHA256=1ff53c915b4e761ef400b803f07261ade637b0c269d99569f18040f3dcee4408
TERMUX_PKG_SRCURL=https://releases.llvm.org/${TERMUX_PKG_VERSION}/llvm-${TERMUX_PKG_VERSION}.src.tar.xz
TERMUX_PKG_HOSTBUILD=true
@ -14,7 +15,7 @@ bin/macho-dump
lib/libgomp.a
lib/libiomp5.a
"
TERMUX_PKG_DEPENDS="binutils, ncurses, ndk-sysroot, ndk-stl"
TERMUX_PKG_DEPENDS="binutils, ncurses, ndk-sysroot, ndk-stl, libffi"
# Replace gcc since gcc is deprecated by google on android and is not maintained upstream.
# Conflict with clang versions earlier than 3.9.1-3 since they bundled llvm.
TERMUX_PKG_CONFLICTS="gcc, clang (<< 3.9.1-3)"
@ -40,6 +41,7 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-DSPHINX_OUTPUT_MAN=ON
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly
-DPERL_EXECUTABLE=$(which perl)
-DLLVM_ENABLE_FFI=ON
"
TERMUX_PKG_FORCE_CMAKE=yes
TERMUX_PKG_KEEP_STATIC_LIBRARIES=true
@ -103,6 +105,7 @@ termux_step_pre_configure () {
# see CMakeLists.txt and tools/clang/CMakeLists.txt
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DLLVM_DEFAULT_TARGET_TRIPLE=$LLVM_DEFAULT_TARGET_TRIPLE"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DLLVM_TARGET_ARCH=$LLVM_TARGET_ARCH -DLLVM_TARGETS_TO_BUILD=all"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DLLVM_HOST_TRIPLE=$LLVM_DEFAULT_TARGET_TRIPLE"
}
termux_step_post_make_install () {
if [ $TERMUX_ARCH = "arm" ]; then
@ -121,7 +124,7 @@ termux_step_post_make_install () {
termux_step_post_massage () {
sed $TERMUX_PKG_BUILDER_DIR/llvm-config.in \
-e "s|@_PKG_MAJOR_VERSION@|$_PKG_MAJOR_VERSION|g" \
-e "s|@TERMUX_PKG_VERSION@|$TERMUX_PKG_VERSION|g" \
-e "s|@TERMUX_PREFIX@|$TERMUX_PREFIX|g" \
-e "s|@TERMUX_PKG_SRCDIR@|$TERMUX_PKG_SRCDIR|g" \
-e "s|@LLVM_TARGET_ARCH@|$LLVM_TARGET_ARCH|g" \

76
packages/libllvm/llvm-config.in

@ -41,35 +41,64 @@ Typical components:
}
arch=@TERMUX_ARCH@
version=@_PKG_MAJOR_VERSION@
version=@TERMUX_PKG_VERSION@
prefix=@TERMUX_PREFIX@
has_rtti=NO
CPPFLAGS="-I${prefix}/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
CFLAGS="${CPPFLAGS} -Os -fPIC -Wall -W -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers"
CFLAGS="${CFLAGS} -pedantic -Wno-long-long -Wdelete-non-virtual-dtor -Werror=date-time -ffunction-sections"
CFLAGS="${CFLAGS} -fdata-sections -DNDEBUG"
CFLAGS="${CPPFLAGS} ${CFLAGS} -fPIC -Werror=date-time -Wall -W -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -pedantic \
-Wno-long-long -Wcovered-switch-default -Wdelete-non-virtual-dtor -Wstring-conversion \
-ffunction-sections -fdata-sections -Os -DNDEBUG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS \
-D__STDC_LIMIT_MACROS"
CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden -Wcast-qual -Wnon-virtual-dtor -std=c++11 -fno-exceptions"
if [ "$has_rtti" != "YES" ]; then CXXFLAGS="$CXXFLAGS -fno-rtti"; fi
LDFLAGS="-L${prefix}/lib"
LIBFILE="${prefix}/lib/libLLVM-$version.so"
show_components () {
if [ "$arch" == "x86_64" -o "$arch" == "i686" ]; then arch="x86"; fi
components="all all-targets analysis $arch ${arch}asmparser ${arch}asmprinter ${arch}codegen ${arch}desc"
components="$components ${arch}disassembler ${arch}info asmparser asmprinter bitreader bitwriter codegen"
components="$components core coroutines coverage debuginfocodeview debuginfodwarf debuginfomsf debuginfopdb"
components="$components demangle engine executionengine globalisel instcombine instrumentation interpreter"
components="$components ipo irreader libdriver lineeditor linker lto mc mcdisassembler mcjit mcparser"
components="$components mirparser native nativecodegen objcarcopts object objectyaml option orcjit passes"
components="$components profiledata runtimedyld scalaropts selectiondag support symbolize tablegen target"
components="$components transformutils vectorize"
if [ "$arch" != "arm" ]; then components="$components ${arch}utils"; fi
echo "$components"
}
components="aarch64 aarch64asmparser aarch64asmprinter aarch64codegen aarch64desc \
aarch64disassembler aarch64info aarch64utils all all-targets amdgpu amdgpuasmparser amdgpuasmprinter \
amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm armasmparser armasmprinter \
armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter binaryformat bitreader bitwriter \
bpf bpfasmparser bpfasmprinter bpfcodegen bpfdesc bpfdisassembler bpfinfo codegen core coroutines coverage \
debuginfocodeview debuginfodwarf debuginfomsf debuginfopdb demangle dlltooldriver engine executionengine \
fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo \
instcombine instrumentation interpreter ipo irreader lanai lanaiasmparser lanaiasmprinter lanaicodegen \
lanaidesc lanaidisassembler lanaiinfo libdriver lineeditor linker lto mc mcdisassembler mcjit mcparser \
mips mipsasmparser mipsasmprinter mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 \
msp430asmprinter msp430codegen msp430desc msp430info native nativecodegen nvptx nvptxasmprinter \
nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit passes powerpc powerpcasmparser \
powerpcasmprinter powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata runtimedyld scalaropts \
selectiondag sparc sparcasmparser sparcasmprinter sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize \
systemz systemzasmparser systemzasmprinter systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target \
transformutils vectorize webassembly webassemblyasmprinter webassemblycodegen webassemblydesc webassemblydisassembler \
webassemblyinfo windowsmanifest x86 x86asmparser x86asmprinter x86codegen x86desc x86disassembler x86info x86utils xcore \
xcoreasmprinter xcorecodegen xcoredesc xcoredisassembler xcoreinfo"
static_libs="-lLLVMLTO -lLLVMPasses -lLLVMObjCARCOpts -lLLVMMIRParser -lLLVMSymbolize -lLLVMDebugInfoPDB -lLLVMDebugInfoDWARF \
-lLLVMCoverage -lLLVMTableGen -lLLVMDlltoolDriver -lLLVMOrcJIT -lLLVMWebAssemblyDisassembler -lLLVMWebAssemblyCodeGen \
-lLLVMWebAssemblyDesc -lLLVMWebAssemblyInfo -lLLVMWebAssemblyAsmPrinter -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen \
-lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMXCoreAsmPrinter -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser \
-lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSystemZAsmPrinter -lLLVMSparcDisassembler -lLLVMSparcCodeGen -lLLVMSparcAsmParser \
-lLLVMSparcDesc -lLLVMSparcInfo -lLLVMSparcAsmPrinter -lLLVMPowerPCDisassembler -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser \
-lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMNVPTXAsmPrinter \
-lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMSP430AsmPrinter -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser \
-lLLVMMipsDesc -lLLVMMipsInfo -lLLVMMipsAsmPrinter -lLLVMLanaiDisassembler -lLLVMLanaiCodeGen -lLLVMLanaiAsmParser -lLLVMLanaiDesc \
-lLLVMLanaiAsmPrinter -lLLVMLanaiInfo -lLLVMHexagonDisassembler -lLLVMHexagonCodeGen -lLLVMHexagonAsmParser -lLLVMHexagonDesc -lLLVMHexagonInfo \
-lLLVMBPFDisassembler -lLLVMBPFCodeGen -lLLVMBPFAsmParser -lLLVMBPFDesc -lLLVMBPFInfo -lLLVMBPFAsmPrinter -lLLVMARMDisassembler \
-lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMARMUtils -lLLVMAMDGPUDisassembler \
-lLLVMAMDGPUCodeGen -lLLVMAMDGPUAsmParser -lLLVMAMDGPUDesc -lLLVMAMDGPUInfo -lLLVMAMDGPUAsmPrinter -lLLVMAMDGPUUtils \
-lLLVMAArch64Disassembler -lLLVMAArch64CodeGen -lLLVMAArch64AsmParser -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter \
-lLLVMAArch64Utils -lLLVMObjectYAML -lLLVMLibDriver -lLLVMOption -lLLVMWindowsManifest -lLLVMFuzzMutate -lLLVMX86Disassembler \
-lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF \
-lLLVMX86Desc -lLLVMMCDisassembler -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCJIT -lLLVMLineEditor -lLLVMInterpreter \
-lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMCodeGen -lLLVMTarget -lLLVMCoroutines -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize \
-lLLVMScalarOpts -lLLVMLinker -lLLVMIRReader -lLLVMAsmParser -lLLVMInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis \
-lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMMC -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle"
shared_libs="-lLLVM-$version"
libs=$shared_libs
handle_args () {
case "${1##--}" in
version) echo "$version";;
link-shared) libs=$shared_libs ;;
link-static) libs=$static_libs ;;
version) echo "$version\n";;
prefix) echo "$prefix";;
src-root) echo "@TERMUX_PKG_SRCDIR@";;
obj-root) echo "$prefix";;
@ -81,11 +110,11 @@ handle_args () {
cxxflags) echo "$CXXFLAGS";;
ldflags) echo "$LDFLAGS";;
system-libs) echo "-lc -ldl -lcurses -lz -lm";;
libs) echo "-l$LIBFILE";;
libs) echo "$libs";;
libnames) echo "libLLVM-$version.so";;
libfiles) echo "$LIBFILE";;
components) show_components;;
targets-built) echo "@LLVM_TARGET_ARCH@";;
components) echo "$components";;
targets-built) echo "AArch64 AMDGPU ARM BPF Hexagon Lanai Mips MSP430 NVPTX PowerPC Sparc SystemZ X86 XCore WebAssembly";;
host-target) echo "@LLVM_DEFAULT_TARGET_TRIPLE@";;
build-mode) echo "Release";;
assertion-mode) echo "OFF";;
@ -94,9 +123,6 @@ handle_args () {
has-global-isel) echo "OFF";;
shared-mode) echo "shared";;
cmakedir) echo "$prefix/lib/cmake/llvm";;
# don't know what these do
link-shared) ;;
link-static) ;;
*) show_help >&2;;
esac
}

Loading…
Cancel
Save