Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to LLVM 13 #7627

Merged
merged 1 commit into from
Oct 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/libllvm/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@ TERMUX_PKG_HOMEPAGE=https://clang.llvm.org/
TERMUX_PKG_DESCRIPTION="Modular compiler and toolchain technologies library"
TERMUX_PKG_LICENSE="NCSA"
TERMUX_PKG_MAINTAINER="@buttaface"
TERMUX_PKG_VERSION=12.0.1
TERMUX_PKG_REVISION=1
TERMUX_PKG_SHA256=129cb25cd13677aad951ce5c2deb0fe4afc1e9d98950f53b51bdcfb5a73afa0e
TERMUX_PKG_VERSION=13.0.0
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
TERMUX_PKG_RM_AFTER_INSTALL="
bin/ld64.lld.darwinnew
bin/ld64.lld.darwin*
lib/libgomp.a
lib/libiomp5.a
"
TERMUX_PKG_DEPENDS="binutils, libc++, ncurses, ndk-sysroot, libffi, zlib, libxml2"
Copy link
Member Author

@finagolfin finagolfin Oct 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two packages are really dependencies of the compiler. I can keep them here if moving them will break things though, @Grimler91, what do you think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xeffyr, any opinion on moving these package dependencies to clang?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, binutils and ndk-sysroot are dependencies of clang.

Copy link
Member Author

@finagolfin finagolfin Oct 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm more worried about dependency breakages similar to this, 39dec01, since I'm not sure how dpkg will handle moving these. Any concern about that, @xeffyr?

TERMUX_PKG_DEPENDS="libc++, ncurses, libffi, zlib, libxml2"
# 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)"
Expand All @@ -27,16 +26,17 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-DLLVM_ENABLE_LIBEDIT=OFF
-DLLVM_INCLUDE_TESTS=OFF
-DCLANG_DEFAULT_CXX_STDLIB=libc++
-DCLANG_DEFAULT_LINKER=lld
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the default linker on all arches to lld, as done with NDK 23.

-DCLANG_INCLUDE_TESTS=OFF
-DCLANG_TOOL_C_INDEX_TEST_BUILD=OFF
-DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found the fix, I think arm will still fail for a different reason.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, nice fix, better than having to hack the cmake file!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

having to hack the cmake file!

Seems like you have forgotten the fact that hacking related discussions are forbidden here, whether it be hacking Termux or cmake 😉

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thunder-coding the original meaning of hacking should still be fine ;)

-DDEFAULT_SYSROOT=$(dirname $TERMUX_PREFIX)
-DLLVM_LINK_LLVM_DYLIB=ON
-DLLDB_TABLEGEN=$TERMUX_PKG_HOSTBUILD_DIR/bin/lldb-tblgen
-DLLVM_TABLEGEN=$TERMUX_PKG_HOSTBUILD_DIR/bin/llvm-tblgen
-DCLANG_TABLEGEN=$TERMUX_PKG_HOSTBUILD_DIR/bin/clang-tblgen
-DLIBOMP_ENABLE_SHARED=FALSE
-DOPENMP_ENABLE_LIBOMPTARGET=OFF
-DLLVM_BINUTILS_INCDIR=$TERMUX_PREFIX/include
-DLLVM_ENABLE_SPHINX=ON
-DSPHINX_OUTPUT_MAN=ON
-DSPHINX_WARNINGS_AS_ERRORS=OFF
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
--- a/clang/lib/Driver/ToolChains/Linux.cpp 2019-12-21 22:30:03.676720096 +0000
+++ b/clang/lib/Driver/ToolChains/Linux.cpp 2019-12-21 22:34:42.941719383 +0000
@@ -374,7 +374,7 @@
// those searched.
// FIXME: It's not clear whether we should use the driver's installed
// directory ('Dir' below) or the ResourceDir.
- if (StringRef(D.Dir).startswith(SysRoot)) {
+ if (StringRef(D.Dir).startswith(SysRoot) && !IsAndroid) {
addPathIfExists(D, D.Dir + "/../lib/" + MultiarchTriple, Paths);
addPathIfExists(D, D.Dir + "/../" + OSLibDir, Paths);
}
@@ -403,7 +403,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
if (Triple.getVendor() == llvm::Triple::OpenEmbedded &&
Triple.isArch64Bit())
Expand Down
10 changes: 8 additions & 2 deletions packages/libllvm/clang.subpackage.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
TERMUX_SUBPKG_INCLUDE="
bin/analyze-build
bin/c++
bin/cc
bin/*clang*
Expand All @@ -9,26 +10,31 @@ bin/*g++
bin/*gcc
bin/git-clang-format
bin/hmaptool
bin/intercept-build
bin/modularize
bin/pp-trace
bin/scan-*
include/clang*
include/omp*.h
lib/clang/*/include/*.h
lib/clang/*/include/*.modulemap
lib/clang/*/include/cuda_wrappers/
lib/clang/*/include/openmp_wrappers/
lib/clang/*/include/ppc_wrappers/
lib/clang/*/include/cuda_wrappers/
lib/cmake/clang
lib/cmake/openmp
lib/libclang*so
lib/libear/
lib/libomp.a
lib/libscanbuild/
libexec/
share/clang
share/scan-*
share/man/man1/clang.1.gz
share/man/man1/scan-*
share/scan-*
"
TERMUX_SUBPKG_DESCRIPTION="C language frontend for LLVM"
TERMUX_SUBPKG_DEPENDS="lld, ndk-sysroot, libcompiler-rt"
TERMUX_SUBPKG_BREAKS="libllvm (<< 11.0.0-1), clangd"
TERMUX_SUBPKG_REPLACES="libllvm (<< 11.0.0-1), clangd"
TERMUX_SUBPKG_GROUPS="base-devel"
18 changes: 18 additions & 0 deletions packages/libllvm/compiler-rt-lib-builtins-CMakeLists.txt.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Something changed between clang 9 in NDK 21d and clang 12 in NDK 23, where we have to pass
this flag now.

diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
index 59d83631a5f4..561384460d85 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -729,8 +729,8 @@ else ()

# Needed for clear_cache on debug mode, due to r7's usage in inline asm.
# Release mode already sets it via -O2/3, Debug mode doesn't.
- if (${arch} STREQUAL "armhf")
- list(APPEND BUILTIN_CFLAGS_${arch} -fomit-frame-pointer -DCOMPILER_RT_ARMHF_TARGET)
+ if (${arch} STREQUAL "arm")
+ list(APPEND BUILTIN_CFLAGS_${arch} -fomit-frame-pointer)# -DCOMPILER_RT_ARMHF_TARGET)
endif()

# For RISCV32, we must force enable int128 for compiling long
6 changes: 3 additions & 3 deletions packages/libllvm/libcompiler-rt.subpackage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ lib/clang/*/include/profile/InstrProfData.inc
lib/clang/*/include/sanitizer/
lib/clang/*/include/xray/
lib/clang/*/lib/android/
lib/clang/*/share/asan_blacklist.txt
lib/clang/*/share/cfi_blacklist.txt
lib/clang/*/share/hwasan_blacklist.txt
lib/clang/*/share/asan_ignorelist.txt
lib/clang/*/share/cfi_ignorelist.txt
lib/clang/*/share/hwasan_ignorelist.txt
"
10 changes: 5 additions & 5 deletions packages/libllvm/lld.subpackage.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
TERMUX_SUBPKG_INCLUDE="
include/lld/
lib/cmake/lld/
lib/liblld*.a
bin/ld.lld
bin/ld64.lld
bin/lld
bin/lld-link
bin/ld.lld
bin/wasm-ld
bin/ld64.lld
include/lld/
lib/cmake/lld/
lib/liblld*.a
"
TERMUX_SUBPKG_DESCRIPTION="LLVM-based linker"
8 changes: 4 additions & 4 deletions packages/libllvm/lldb-include-lldb-Host-Editline.h.patch
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ index 356e8f734732..c717f7b0cebb 100644
+++ b/lldb/include/lldb/Host/Editline.h
@@ -43,7 +43,7 @@

#if defined(_WIN32)
#include "lldb/Host/windows/editlinewin.h"
-#elif !defined(__ANDROID__)
+#else
#include "lldb/lldb-private.h"

-#if !defined(_WIN32) && !defined(__ANDROID__)
+#if !defined(_WIN32)
#include <histedit.h>
#endif

15 changes: 15 additions & 0 deletions packages/libllvm/lldb-source-API-SBReproducerPrivate.h.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
lldb wants to serialize a FILE, so pass it the header with the size now that it's an opaque
struct.

diff --git a/lldb/source/API/SBReproducerPrivate.h b/lldb/source/API/SBReproducerPrivate.h
index 02ac31c2ad89..0ec65e63fffe 100644
--- a/lldb/source/API/SBReproducerPrivate.h
+++ b/lldb/source/API/SBReproducerPrivate.h
@@ -19,6 +19,7 @@
#include "lldb/Utility/ReproducerProvider.h"

#include "llvm/ADT/DenseMap.h"
+#include <bits/struct_file.h>

#define LLDB_GET_INSTRUMENTATION_DATA() \
lldb_private::repro::InstrumentationData::Instance()
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ info.
#include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
#include "Plugins/Process/Utility/LinuxProcMaps.h"
-#include "Procfs.h"
#include "lldb/Core/EmulateInstruction.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostProcess.h"
@@ -46,6 +45,7 @@
#include "llvm/Support/Errno.h"
#include "llvm/Support/FileSystem.h"
Expand Down
14 changes: 6 additions & 8 deletions packages/libllvm/llvm-config.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ Options:
--assertion-mode Print assertion mode of LLVM tree (ON or OFF).
--build-system Print the build system used to build LLVM (always cmake).
--has-rtti Print whether or not LLVM was built with rtti (YES or NO).
--has-global-isel Print whether or not LLVM was built with global-isel support (YES or NO).
--shared-mode Print how the provided components can be collectively linked (\`shared\` or \`static\`).
--link-shared Link the components as shared libraries.
--link-static Link the component libraries statically.
Expand All @@ -56,9 +55,9 @@ analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils as
asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat \
bitreader bitstreamreader bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler \
bpfinfo cfguard codegen core coroutines coverage debuginfocodeview debuginfodwarf \
debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker engine \
debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker dwp engine \
executionengine extensions filecheck frontendopenacc frontendopenmp \
fuzzmutate globalisel hellonew hexagon hexagonasmparser hexagoncodegen hexagondesc \
fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc \
hexagondisassembler hexagoninfo instcombine instrumentation interfacestub \
interpreter ipo irreader jitlink lanai lanaiasmparser lanaicodegen lanaidesc \
lanaidisassembler lanaiinfo libdriver lineeditor linker lto mc mca mcdisassembler \
Expand All @@ -72,18 +71,18 @@ runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc
sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen \
systemzdesc systemzdisassembler systemzinfo tablegen target textapi transformutils vectorize webassembly \
webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler \
webassemblyinfo windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info \
webassemblyinfo webassemblyutils windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info \
xcore xcorecodegen xcoredesc xcoredisassembler xcoreinfo xray"
static_libs="-lLLVMObjectYAML -lLLVMDlltoolDriver -lLLVMLineEditor -lLLVMFuzzMutate \
-lLLVMCoroutines -lLLVMLTO -lLLVMPasses -lLLVMObjCARCOpts -lLLVMHelloNew -lLLVMTextAPI -lLLVMCoverage \
-lLLVMXRay -lLLVMInterpreter -lLLVMRemarks -lLLVMMIRParser -lLLVMSymbolize -lLLVMDebugInfoPDB \
-lLLVMCoroutines -lLLVMLTO -lLLVMPasses -lLLVMObjCARCOpts -lLLVMTextAPI -lLLVMCoverage \
-lLLVMXRay -lLLVMInterpreter -lLLVMRemarks -lLLVMMIRParser -lLLVMDWP -lLLVMSymbolize -lLLVMDebugInfoPDB \
-lLLVMDebugInfoDWARF -lLLVMAVRAsmParser -lLLVMInterfaceStub -lLLVMFileCheck -lLLVMAVRCodeGen -lLLVMAVRDesc -lLLVMAVRDisassembler \
-lLLVMAVRInfo -lLLVMRISCVDisassembler -lLLVMRISCVCodeGen -lLLVMRISCVAsmParser \
-lLLVMRISCVDesc -lLLVMRISCVInfo -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen \
-lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMX86Disassembler -lLLVMX86CodeGen -lLLVMX86AsmParser \
-lLLVMX86Desc -lLLVMX86Info -lLLVMWebAssemblyDisassembler \
-lLLVMWebAssemblyCodeGen -lLLVMWebAssemblyDesc -lLLVMWebAssemblyAsmParser \
-lLLVMWebAssemblyInfo -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen \
-lLLVMWebAssemblyUtils -lLLVMWebAssemblyInfo -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen \
-lLLVMSystemZAsmParser -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSparcDisassembler \
-lLLVMSparcCodeGen -lLLVMSparcAsmParser -lLLVMSparcDesc -lLLVMSparcInfo \
-lLLVMPowerPCDisassembler -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser -lLLVMPowerPCDesc \
Expand Down Expand Up @@ -136,7 +135,6 @@ handle_args () {
assertion-mode) echo "OFF";;
build-system) echo "cmake";;
has-rtti) echo "$has_rtti";;
has-global-isel) echo "OFF";;
shared-mode) echo "shared";;
cmakedir) echo "$prefix/lib/cmake/llvm";;
*) show_help >&2;;
Expand Down
10 changes: 4 additions & 6 deletions packages/libllvm/llvm.subpackage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,19 @@ bin/dsymutil
bin/llc
bin/lli
bin/llvm*
bin/obj2yaml
bin/opt
bin/sancov
bin/sanstats
bin/split-file
bin/verify-uselistorder
bin/yaml2obj
share/opt-viewer
share/man/man1/bugpoint.1.gz
share/man/man1/dsymutil.1.gz
share/man/man1/llc.1.gz
share/man/man1/lli.1.gz
share/man/man1/llvm*
share/man/man1/opt.1.gz
share/man/man1/bugpoint.1.gz
share/man/man1/dsymutil.1.gz
share/man/man1/xxx-tblgen.1.gz
share/man/man1/*tblgen.1.gz
share/opt-viewer
"
TERMUX_SUBPKG_DESCRIPTION="LLVM modular compiler and toolchain executables"
TERMUX_SUBPKG_BREAKS="libllvm (<< 11.0.0-1)"
Expand Down