bump(libllvm): 15.0.7 to 16.0.0

This commit is contained in:
termux-pacman-bot
2023-03-27 20:43:36 +00:00
parent c2344f679d
commit cf098052ff
15 changed files with 310 additions and 475 deletions

View File

@@ -0,0 +1,159 @@
From a3fd6ca79da40572e27b010d90b339a8a67832a1 Mon Sep 17 00:00:00 2001
From: Yi Kong <yikong@google.com>
Date: Wed, 1 May 2019 11:16:58 -0700
Subject: Add stubs and headers for nl_types APIs.
We don't have message catalog APIs on Android until O. For releases
prior to that, we build in stub APIs (as weak symbols so we use libc's
on new API levels). We add these here instead of in libandroid_support
because the driver (correctly) links libomp well after
libandroid_support, which means libandroid_support won't be searched
for resolving symbols in openmp.
Since NDK r16 removed nl_types.h, also bundle a stub header.
aosp/571945
Test: Build LLVM with NDK r16
Bug: https://github.com/android-ndk/ndk/issues/9
Change-Id: I0a07a969388b958be49bd50325bd7c5254140127
---
openmp/runtime/src/CMakeLists.txt | 6 +++
openmp/runtime/src/android/nl_types.h | 45 ++++++++++++++++++
openmp/runtime/src/android/nltypes_stubs.cpp | 48 ++++++++++++++++++++
3 files changed, 99 insertions(+)
create mode 100644 openmp/runtime/src/android/nl_types.h
create mode 100644 openmp/runtime/src/android/nltypes_stubs.cpp
diff --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt
index a5654d6d5ec..6dab6651a0d 100644
--- a/openmp/runtime/src/CMakeLists.txt
+++ b/openmp/runtime/src/CMakeLists.txt
@@ -49,6 +49,9 @@ include_directories(
if(${LIBOMP_USE_HWLOC})
include_directories(${LIBOMP_HWLOC_INSTALL_DIR}/include)
endif()
+if(ANDROID)
+ include_directories(${LIBOMP_SRC_DIR}/android)
+endif()
# Getting correct source files to build library
set(LIBOMP_CXXFILES)
@@ -92,6 +95,9 @@ else()
libomp_append(LIBOMP_CXXFILES kmp_gsupport.cpp)
libomp_append(LIBOMP_ASMFILES z_Linux_asm.S) # Unix assembly file
endif()
+ if(ANDROID)
+ libomp_append(LIBOMP_CXXFILES android/nltypes_stubs.cpp)
+ endif()
libomp_append(LIBOMP_CXXFILES thirdparty/ittnotify/ittnotify_static.cpp LIBOMP_USE_ITT_NOTIFY)
libomp_append(LIBOMP_CXXFILES kmp_debugger.cpp LIBOMP_USE_DEBUGGER)
libomp_append(LIBOMP_CXXFILES kmp_stats.cpp LIBOMP_STATS)
diff --git a/openmp/runtime/src/android/nl_types.h b/openmp/runtime/src/android/nl_types.h
new file mode 100644
index 00000000000..cc27e9374e7
--- /dev/null
+++ b/openmp/runtime/src/android/nl_types.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef ANDROID_NLTYPES_H
+#define ANDROID_NLTYPES_H
+
+#include_next <nl_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+nl_catd catopen(const char*, int);
+char* catgets(nl_catd, int, int, const char*);
+int catclose(nl_catd);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* ANDROID_NLTYPES_H */
diff --git a/openmp/runtime/src/android/nltypes_stubs.cpp b/openmp/runtime/src/android/nltypes_stubs.cpp
new file mode 100644
index 00000000000..2882910172f
--- /dev/null
+++ b/openmp/runtime/src/android/nltypes_stubs.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <nl_types.h>
+
+#include <errno.h>
+
+__attribute__((weak,visibility("hidden")))
+nl_catd catopen(const char*, int) {
+ return reinterpret_cast<nl_catd>(-1);
+}
+
+__attribute__((weak,visibility("hidden")))
+char* catgets(nl_catd, int, int, const char* message) {
+ return const_cast<char*>(message);
+}
+
+__attribute__((weak,visibility("hidden")))
+int catclose(nl_catd) {
+ // Since we didn't hand out a valid nl_catd, you can't be returning one to us.
+ errno = EBADF;
+ return -1;
+}
--
2.25.0.341.g760bfbb309-goog

View File

@@ -0,0 +1,41 @@
From d8bd179a173876a7a9ee11828b63efffe145356c Mon Sep 17 00:00:00 2001
From: Emre Kultursay <emrekultursay@google.com>
Date: Thu, 23 Feb 2023 12:55:25 +0100
Subject: [PATCH] Clear read_fd_set if EINTR received
Leaving bits uncleared set causes callbacks to be triggered even
though there are no events to process. Starting with D131160
we have a callback that makes blocking read calls over pipe which
was causing the lldb-server main loop to become unresponsive / blocked
on Android.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D144240
---
lldb/source/Host/posix/MainLoopPosix.cpp | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/lldb/source/Host/posix/MainLoopPosix.cpp b/lldb/source/Host/posix/MainLoopPosix.cpp
index b185c3d3b707..5b50b450433e 100644
--- a/lldb/source/Host/posix/MainLoopPosix.cpp
+++ b/lldb/source/Host/posix/MainLoopPosix.cpp
@@ -156,9 +156,12 @@ Status MainLoopPosix::RunImpl::Poll() {
size_t sigset_len;
} extra_data = {&kernel_sigset, sizeof(kernel_sigset)};
if (syscall(__NR_pselect6, nfds, &read_fd_set, nullptr, nullptr, nullptr,
- &extra_data) == -1 &&
- errno != EINTR)
- return Status(errno, eErrorTypePOSIX);
+ &extra_data) == -1) {
+ if (errno != EINTR)
+ return Status(errno, eErrorTypePOSIX);
+ else
+ FD_ZERO(&read_fd_set);
+ }
return Status();
}
--
2.34.1

View File

@@ -3,16 +3,16 @@ TERMUX_PKG_DESCRIPTION="Modular compiler and toolchain technologies library"
TERMUX_PKG_LICENSE="Apache-2.0, NCSA"
TERMUX_PKG_LICENSE_FILE="llvm/LICENSE.TXT"
TERMUX_PKG_MAINTAINER="@buttaface"
LLVM_MAJOR_VERSION=15
TERMUX_PKG_VERSION=${LLVM_MAJOR_VERSION}.0.7
TERMUX_PKG_REVISION=3
TERMUX_PKG_SHA256=8b5fcb24b4128cf04df1b0b9410ce8b1a729cb3c544e6da885d234280dedeac6
LLVM_MAJOR_VERSION=16
TERMUX_PKG_VERSION=${LLVM_MAJOR_VERSION}.0.0
TERMUX_PKG_SHA256=9a56d906a2c81f16f06efc493a646d497c53c2f4f28f0cb1f3c8da7f74350254
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.darwin*
lib/libgomp.a
lib/libiomp5.a
share/man/man1/lit.1
"
TERMUX_PKG_DEPENDS="libc++, libffi, libxml2, ncurses, zlib, zstd"
TERMUX_PKG_BUILD_DEPENDS="binutils-libs"
@@ -41,12 +41,8 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-DLLDB_PYTHON_RELATIVE_PATH=lib/python${TERMUX_PYTHON_VERSION}/site-packages
-DLLDB_PYTHON_EXE_RELATIVE_PATH=bin/python${TERMUX_PYTHON_VERSION}
-DLLDB_PYTHON_EXT_SUFFIX=.cpython-${TERMUX_PYTHON_VERSION}.so
-DCLANG_TABLEGEN=$TERMUX_PKG_HOSTBUILD_DIR/bin/clang-tblgen
-DCLANG_PSEUDO_GEN=$TERMUX_PKG_HOSTBUILD_DIR/bin/clang-pseudo-gen
-DCLANG_TIDY_CONFUSABLE_CHARS_GEN=$TERMUX_PKG_HOSTBUILD_DIR/bin/clang-tidy-confusable-chars-gen
-DLLDB_TABLEGEN=$TERMUX_PKG_HOSTBUILD_DIR/bin/lldb-tblgen
-DLLVM_TABLEGEN=$TERMUX_PKG_HOSTBUILD_DIR/bin/llvm-tblgen
-DMLIR_TABLEGEN=$TERMUX_PKG_HOSTBUILD_DIR/bin/mlir-tblgen
-DLLVM_NATIVE_TOOL_DIR=$TERMUX_PKG_HOSTBUILD_DIR/bin
-DCROSS_TOOLCHAIN_FLAGS_LLVM_NATIVE=-DLLVM_NATIVE_TOOL_DIR=$TERMUX_PKG_HOSTBUILD_DIR/bin
-DLIBOMP_ENABLE_SHARED=FALSE
-DOPENMP_ENABLE_LIBOMPTARGET=OFF
-DLLVM_ENABLE_SPHINX=ON
@@ -59,7 +55,6 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-DLLVM_INSTALL_UTILS=ON
-DLLVM_BINUTILS_INCDIR=$TERMUX_PREFIX/include
-DMLIR_INSTALL_AGGREGATE_OBJECTS=OFF
-DMLIR_LINALG_ODS_YAML_GEN=$TERMUX_PKG_HOSTBUILD_DIR/bin/mlir-linalg-ods-yaml-gen
"
if [ x$TERMUX_ARCH_BITS = x32 ]; then
@@ -84,10 +79,6 @@ termux_step_host_build() {
}
termux_step_pre_configure() {
mkdir openmp/runtime/src/android
cp $TERMUX_PKG_BUILDER_DIR/nl_types.h openmp/runtime/src/android
cp $TERMUX_PKG_BUILDER_DIR/nltypes_stubs.cpp openmp/runtime/src/android
# Add unknown vendor, otherwise it screws with the default LLVM triple
# detection.
export LLVM_DEFAULT_TARGET_TRIPLE=${CCTERMUX_HOST_PLATFORM/-/-unknown-}
@@ -121,7 +112,6 @@ termux_step_post_make_install() {
cp docs/man/* $TERMUX_PREFIX/share/man/man1
cp tools/clang/docs/man/{clang,diagtool}.1 $TERMUX_PREFIX/share/man/man1
ln -s $TERMUX_PKG_VERSION $TERMUX_PREFIX/lib/clang/$LLVM_MAJOR_VERSION
cd $TERMUX_PREFIX/bin
for tool in clang clang++ cc c++ cpp gcc g++ ${TERMUX_HOST_PLATFORM}-{clang,clang++,gcc,g++,cpp}; do

View File

@@ -1,30 +1,33 @@
TERMUX_SUBPKG_INCLUDE="
bin/amdgpu-arch
bin/analyze-build
bin/c++
bin/cc
bin/*clang*
bin/*cpp
bin/clang*
bin/cpp
bin/diagtool
bin/find-all-symbols
bin/*g++
bin/*gcc
bin/g++
bin/gcc
bin/git-clang-format
bin/hmaptool
bin/intercept-build
bin/*-linux-android*
bin/modularize
bin/nvptx-arch
bin/pp-trace
bin/run-clang-tidy
bin/scan-*
include/clang*
include/omp*.h
lib/clang/${LLVM_MAJOR_VERSION}
lib/clang/*/include/*.h
lib/clang/*/include/*.modulemap
lib/clang/*/include/module.modulemap
lib/clang/*/include/cuda_wrappers/
lib/clang/*/include/openmp_wrappers/
lib/clang/*/include/orc/
lib/clang/*/include/ppc_wrappers/
lib/cmake/clang
lib/cmake/openmp
lib/libarcher.so
lib/libclang*so
lib/libear/
lib/libomp.a
@@ -33,7 +36,7 @@ libexec/
share/clang
share/man/man1/clang.1.gz
share/man/man1/diagtool.1.gz
share/man/man1/scan-*
share/man/man1/scan-build.1.gz
share/scan-*
"
TERMUX_SUBPKG_DESCRIPTION="C language frontend for LLVM"

View File

@@ -1,251 +0,0 @@
From ef5ede52efbff6ffa9f8c40dc3c6276146e6ff45 Mon Sep 17 00:00:00 2001
From: Usman Nadeem <mnadeem@quicinc.com>
Date: Mon, 22 Aug 2022 10:24:49 -0700
Subject: [PATCH] [Flang][Driver] Add support for PIC
This patch does the following:
- Consumes the PIC flags (fPIC/fPIE/fropi/frwpi etc) in flang-new.
tools::ParsePICArgs() in ToolChains/CommonArgs.cpp is used for this.
- Adds FC1Option to "-mrelocation-model", "-pic-level", and "-pic-is-pie"
command line options.
- Adds the above options to flang/Frontend/CodeGenOptions' data structure.
- Sets the relocation model in the target machine, and
- Sets module flags for the respective PIC/PIE type in LLVM IR.
I have tried my best to replicate how clang does things.
Differential Revision: https://reviews.llvm.org/D131533
Change-Id: I68fe64910be28147dc5617826641cea71b92d94d
---
clang/include/clang/Driver/Options.td | 32 ++++---
clang/lib/Driver/ToolChains/Clang.cpp | 17 ----
clang/lib/Driver/ToolChains/CommonArgs.cpp | 18 ++++
clang/lib/Driver/ToolChains/CommonArgs.h | 2 +
clang/lib/Driver/ToolChains/Flang.cpp | 24 ++++++
clang/lib/Driver/ToolChains/Flang.h | 9 ++
clang/lib/Driver/ToolChains/Linux.cpp | 7 +-
.../include/flang/Frontend/CodeGenOptions.def | 11 +++
flang/include/flang/Frontend/CodeGenOptions.h | 9 ++
flang/lib/Frontend/CodeGenOptions.cpp | 1 +
flang/lib/Frontend/CompilerInvocation.cpp | 33 +++++++
flang/lib/Frontend/FrontendActions.cpp | 15 +++-
flang/test/Driver/driver-help.f90 | 4 +
flang/test/Driver/pic-flags.f90 | 85 ++++++++++++++++---
14 files changed, 217 insertions(+), 50 deletions(-)
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index c8178c13e82e9..1939312ffd685 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5240,6 +5240,16 @@ def migrator_no_finalize_removal : Flag<["-"], "no-finalize-removal">,
// CodeGen Options
//===----------------------------------------------------------------------===//
+let Flags = [CC1Option, CC1AsOption, FC1Option, NoDriverOption] in {
+
+def mrelocation_model : Separate<["-"], "mrelocation-model">,
+ HelpText<"The relocation model to use">, Values<"static,pic,ropi,rwpi,ropi-rwpi,dynamic-no-pic">,
+ NormalizedValuesScope<"llvm::Reloc">,
+ NormalizedValues<["Static", "PIC_", "ROPI", "RWPI", "ROPI_RWPI", "DynamicNoPIC"]>,
+ MarshallingInfoEnum<CodeGenOpts<"RelocationModel">, "PIC_">;
+
+} // let Flags = [CC1Option, CC1AsOption, FC1Option, NoDriverOption]
+
let Flags = [CC1Option, CC1AsOption, NoDriverOption] in {
def debug_info_kind_EQ : Joined<["-"], "debug-info-kind=">;
@@ -5284,11 +5294,6 @@ def msave_temp_labels : Flag<["-"], "msave-temp-labels">,
"Note this may change .s semantics and shouldn't generally be used "
"on compiler-generated code.">,
MarshallingInfoFlag<CodeGenOpts<"SaveTempLabels">>;
-def mrelocation_model : Separate<["-"], "mrelocation-model">,
- HelpText<"The relocation model to use">, Values<"static,pic,ropi,rwpi,ropi-rwpi,dynamic-no-pic">,
- NormalizedValuesScope<"llvm::Reloc">,
- NormalizedValues<["Static", "PIC_", "ROPI", "RWPI", "ROPI_RWPI", "DynamicNoPIC"]>,
- MarshallingInfoEnum<CodeGenOpts<"RelocationModel">, "PIC_">;
def fno_math_builtin : Flag<["-"], "fno-math-builtin">,
HelpText<"Disable implicit builtin knowledge of math functions">,
MarshallingInfoFlag<LangOpts<"NoMathBuiltin">>;
@@ -5973,6 +5978,17 @@ def split_dwarf_output : Separate<["-"], "split-dwarf-output">,
Flags<[CC1Option, CC1AsOption, NoDriverOption]>,
MarshallingInfoString<CodeGenOpts<"SplitDwarfOutput">>;
+let Flags = [CC1Option, FC1Option, NoDriverOption] in {
+
+def pic_level : Separate<["-"], "pic-level">,
+ HelpText<"Value for __PIC__">,
+ MarshallingInfoInt<LangOpts<"PICLevel">>;
+def pic_is_pie : Flag<["-"], "pic-is-pie">,
+ HelpText<"File is for a position independent executable">,
+ MarshallingInfoFlag<LangOpts<"PIE">>;
+
+} // let Flags = [CC1Option, FC1Option, NoDriverOption]
+
let Flags = [CC1Option, NoDriverOption] in {
def fblocks_runtime_optional : Flag<["-"], "fblocks-runtime-optional">,
@@ -6013,12 +6029,6 @@ def fencode_extended_block_signature : Flag<["-"], "fencode-extended-block-signa
def function_alignment : Separate<["-"], "function-alignment">,
HelpText<"default alignment for functions">,
MarshallingInfoInt<LangOpts<"FunctionAlignment">>;
-def pic_level : Separate<["-"], "pic-level">,
- HelpText<"Value for __PIC__">,
- MarshallingInfoInt<LangOpts<"PICLevel">>;
-def pic_is_pie : Flag<["-"], "pic-is-pie">,
- HelpText<"File is for a position independent executable">,
- MarshallingInfoFlag<LangOpts<"PIE">>;
def fhalf_no_semantic_interposition : Flag<["-"], "fhalf-no-semantic-interposition">,
HelpText<"Like -fno-semantic-interposition but don't use local aliases">,
MarshallingInfoFlag<LangOpts<"HalfNoSemanticInterposition">>;
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 8c38e934d8aa6..ee23621a3233a 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -1152,23 +1152,6 @@ static void RenderDebugInfoCompressionArgs(const ArgList &Args,
}
}
-static const char *RelocationModelName(llvm::Reloc::Model Model) {
- switch (Model) {
- case llvm::Reloc::Static:
- return "static";
- case llvm::Reloc::PIC_:
- return "pic";
- case llvm::Reloc::DynamicNoPIC:
- return "dynamic-no-pic";
- case llvm::Reloc::ROPI:
- return "ropi";
- case llvm::Reloc::RWPI:
- return "rwpi";
- case llvm::Reloc::ROPI_RWPI:
- return "ropi-rwpi";
- }
- llvm_unreachable("Unknown Reloc::Model kind");
-}
static void handleAMDGPUCodeObjectVersionOptions(const Driver &D,
const ArgList &Args,
ArgStringList &CmdArgs,
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index c0aec33b082a5..d5b437ceed63c 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1201,6 +1201,24 @@ Arg *tools::getLastProfileSampleUseArg(const ArgList &Args) {
options::OPT_fauto_profile_EQ);
}
+const char *tools::RelocationModelName(llvm::Reloc::Model Model) {
+ switch (Model) {
+ case llvm::Reloc::Static:
+ return "static";
+ case llvm::Reloc::PIC_:
+ return "pic";
+ case llvm::Reloc::DynamicNoPIC:
+ return "dynamic-no-pic";
+ case llvm::Reloc::ROPI:
+ return "ropi";
+ case llvm::Reloc::RWPI:
+ return "rwpi";
+ case llvm::Reloc::ROPI_RWPI:
+ return "ropi-rwpi";
+ }
+ llvm_unreachable("Unknown Reloc::Model kind");
+}
+
/// Parses the various -fpic/-fPIC/-fpie/-fPIE arguments. Then,
/// smooshes them together with platform defaults, to decide whether
/// this compile should be using PIC mode or not. Returns a tuple of
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.h b/clang/lib/Driver/ToolChains/CommonArgs.h
index 8e62af70ff7f7..326141c3f926e 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.h
+++ b/clang/lib/Driver/ToolChains/CommonArgs.h
@@ -93,6 +93,8 @@ void addLTOOptions(const ToolChain &ToolChain, const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs, const InputInfo &Output,
const InputInfo &Input, bool IsThinLTO);
+const char *RelocationModelName(llvm::Reloc::Model Model);
+
std::tuple<llvm::Reloc::Model, unsigned, bool>
ParsePICArgs(const ToolChain &ToolChain, const llvm::opt::ArgList &Args);
diff --git a/clang/lib/Driver/ToolChains/Flang.cpp b/clang/lib/Driver/ToolChains/Flang.cpp
index 3368f67857180..b279529a33184 100644
--- a/clang/lib/Driver/ToolChains/Flang.cpp
+++ b/clang/lib/Driver/ToolChains/Flang.cpp
@@ -58,6 +58,27 @@ void Flang::AddOtherOptions(const ArgList &Args, ArgStringList &CmdArgs) const {
options::OPT_std_EQ, options::OPT_W_Joined});
}
+void Flang::AddPicOptions(const ArgList &Args, ArgStringList &CmdArgs) const {
+ // ParsePICArgs parses -fPIC/-fPIE and their variants and returns a tuple of
+ // (RelocationModel, PICLevel, IsPIE).
+ llvm::Reloc::Model RelocationModel;
+ unsigned PICLevel;
+ bool IsPIE;
+ std::tie(RelocationModel, PICLevel, IsPIE) =
+ ParsePICArgs(getToolChain(), Args);
+
+ if (auto *RMName = RelocationModelName(RelocationModel)) {
+ CmdArgs.push_back("-mrelocation-model");
+ CmdArgs.push_back(RMName);
+ }
+ if (PICLevel > 0) {
+ CmdArgs.push_back("-pic-level");
+ CmdArgs.push_back(PICLevel == 1 ? "1" : "2");
+ if (IsPIE)
+ CmdArgs.push_back("-pic-is-pie");
+ }
+}
+
void Flang::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
const ArgList &Args, const char *LinkingOutput) const {
@@ -117,6 +138,9 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA,
if (D.getDiags().getDiagnosticOptions().ShowColors)
CmdArgs.push_back("-fcolor-diagnostics");
+ // -fPIC and related options.
+ AddPicOptions(Args, CmdArgs);
+
// Add other compile options
AddOtherOptions(Args, CmdArgs);
diff --git a/clang/lib/Driver/ToolChains/Flang.h b/clang/lib/Driver/ToolChains/Flang.h
index efbdbe854e24f..c5ac147da768c 100644
--- a/clang/lib/Driver/ToolChains/Flang.h
+++ b/clang/lib/Driver/ToolChains/Flang.h
@@ -39,6 +39,15 @@ class LLVM_LIBRARY_VISIBILITY Flang : public Tool {
/// \param [out] CmdArgs The list of output command arguments
void AddPreprocessingOptions(const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const;
+
+ /// Extract PIC options from the driver arguments and add them to
+ /// the command arguments.
+ ///
+ /// \param [in] Args The list of input driver arguments
+ /// \param [out] CmdArgs The list of output command arguments
+ void AddPicOptions(const llvm::opt::ArgList &Args,
+ llvm::opt::ArgStringList &CmdArgs) const;
+
/// Extract other compilation options from the driver arguments and add them
/// to the command arguments.
///
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
index eedbb12d0dd53..f23797215c236 100644
--- a/clang/lib/Driver/ToolChains/Linux.cpp
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
@@ -692,11 +692,8 @@ void Linux::AddIAMCUIncludeArgs(const ArgList &DriverArgs,
}
bool Linux::isPIEDefault(const llvm::opt::ArgList &Args) const {
- // TODO: Remove the special treatment for Flang once its frontend driver can
- // generate position independent code.
- return !getDriver().IsFlangMode() &&
- (CLANG_DEFAULT_PIE_ON_LINUX || getTriple().isAndroid() ||
- getTriple().isMusl() || getSanitizerArgs(Args).requiresPIE());
+ return CLANG_DEFAULT_PIE_ON_LINUX || getTriple().isAndroid() ||
+ getTriple().isMusl() || getSanitizerArgs(Args).requiresPIE();
}
bool Linux::IsAArch64OutlineAtomicsDefault(const ArgList &Args) const {

View File

@@ -15,7 +15,7 @@ TERMUX_SUBPKG_CONFLICTS="ndk-multilib (<< 23b-6)"
termux_step_create_subpkg_debscripts() {
local RT_OPT_DIR=$TERMUX_PREFIX/opt/ndk-multilib/cross-compiler-rt
local RT_PATH=$TERMUX_PREFIX/lib/clang/$TERMUX_PKG_VERSION/lib/linux
local RT_PATH=$TERMUX_PREFIX/lib/clang/$LLVM_MAJOR_VERSION/lib/linux
cat <<- EOF > ./triggers
interest-noawait $RT_OPT_DIR

View File

@@ -1,6 +1,6 @@
TERMUX_SUBPKG_DESCRIPTION="High-level loop and data-locality optimizer for clang"
TERMUX_SUBPKG_INCLUDE="
include/polly/
lib/cmake/polly/
lib/LLVMPolly.so
lib/cmake/polly/
"

View File

@@ -5,6 +5,6 @@ lib/liblldb.so
lib/python${TERMUX_PYTHON_VERSION}/site-packages
"
TERMUX_SUBPKG_DESCRIPTION="LLVM-based debugger"
TERMUX_SUBPKG_DEPENDS="libc++, libedit, libxml2, python, ncurses-ui-libs"
TERMUX_SUBPKG_DEPENDS="clang, libc++, libedit, libxml2, python, ncurses-ui-libs"
TERMUX_SUBPKG_BREAKS="lldb-dev, lldb-static"
TERMUX_SUBPKG_REPLACES="lldb-dev, lldb-static"

View File

@@ -11,7 +11,6 @@ LLVM. Typically called from 'configure' scripts. Examples:
Options:
--version Print LLVM version.
--prefix Print the installation prefix.
--src-root Print the source root LLVM was built from.
--obj-root Print the object root used to build LLVM.
--bindir Directory containing LLVM executables.
--includedir Directory containing LLVM headers.
@@ -44,75 +43,82 @@ prefix=@TERMUX_PREFIX@
has_rtti=NO
CPPFLAGS="-I${prefix}/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
CFLAGS="${CPPFLAGS} ${CFLAGS}"
CXXFLAGS="${CFLAGS} -std=c++14 -fno-exceptions"
CXXFLAGS="${CFLAGS} -std=c++17 -fno-exceptions"
if [ "$has_rtti" != "YES" ]; then CXXFLAGS="$CXXFLAGS -fno-rtti"; fi
LDFLAGS="-L${prefix}/lib"
LIBFILE="${prefix}/lib/libLLVM-$version.so"
components="aarch64 aarch64asmparser aarch64codegen aarch64desc \
aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets amdgpu \
amdgpuasmparser amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgputargetmca amdgpuutils \
analysis arc arccodegen arcdesc arcdissembler arcinfo arm armasmparser armcodegen armdesc \
armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc \
avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter bpf bpfasmparser \
bpfcodegen bpfdesc bpfdisassembler bpfinfo csky cskyasmparser cskycodegen cskydesc cskyinfo \
cfguard codegen core coroutines coverage debuginfocodeview debuginfodwarf \
debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker dwp engine \
executionengine extensions filecheck frontendopenacc frontendopenmp \
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 m68k m68kasmparser m68kcodegen \
m68kdesc m68kdisassembler m68kinfo mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen \
mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen \
msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen \
nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit orcshared orctargetprocess passes powerpc \
powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo \
profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo \
LIBFILE="${prefix}/lib/libLLVM-${version/.*/}.so"
components="aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler \
aarch64info aarch64utils aggressiveinstcombine all all-targets amdgpu amdgpuasmparser \
amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgputargetmca amdgpuutils \
analysis arc arccodegen arcdesc arcdisassembler arcinfo arm armasmparser armcodegen \
armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser \
avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader \
bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo cfguard codegen \
core coroutines coverage csky cskyasmparser cskycodegen cskydesc cskydisassembler \
cskyinfo debuginfocodeview debuginfodwarf debuginfogsym debuginfologicalview \
debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker dwarflinkerparallel \
dwp engine executionengine extensions filecheck frontendhlsl frontendopenacc \
frontendopenmp fuzzercli fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen \
hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interfacestub \
interpreter ipo irprinter irreader jitlink lanai lanaiasmparser lanaicodegen lanaidesc \
lanaidisassembler lanaiinfo libdriver lineeditor linker loongarch loongarchasmparser \
loongarchcodegen loongarchdesc loongarchdisassembler loongarchinfo lto m68k m68kasmparser \
m68kcodegen m68kdesc m68kdisassembler m68kinfo mc mca mcdisassembler mcjit mcparser \
mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 \
msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native \
nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts objcopy object \
objectyaml option orcjit orcshared orctargetprocess passes powerpc powerpcasmparser \
powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks \
riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvtargetmca \
runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc \
sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen \
systemzdesc systemzdisassembler systemzinfo tablegen target textapi transformutils ve veasmparser \
vecodegen vedesc vedisassembler veinfo vectorize webassembly \
webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler \
webassemblyinfo webassemblyutils windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info \
x86targetmca xcore xcorecodegen xcoredesc xcoredisassembler xcoreinfo xray"
static_libs="-lLLVMObjectYAML -lLLVMDlltoolDriver -lLLVMLineEditor -lLLVMFuzzMutate \
-lLLVMCoroutines -lLLVMLTO -lLLVMPasses -lLLVMObjCARCOpts -lLLVMTextAPI -lLLVMCoverage \
-lLLVMXRay -lLLVMInterpreter -lLLVMRemarks -lLLVMMIRParser -lLLVMDWP -lLLVMSymbolize -lLLVMDebugInfoPDB \
-lLLVMDebugInfoDWARF -lLLVMARCCodeGen -lLLVMARCDesc -lLLVMARCDisassembler -lLLVMARCInfo -lLLVMCSKYAsmParser \
-lLLVMCSKYCodeGen -lLLVMCSKYDesc -lLLVMCSKYInfo -lLLVMM68kAsmParser -lLLVMM68kCodeGen -lLLVMM68kDesc \
-lLLVMM68kDisassembler -lLLVMM68kInfo -lLLVMVEAsmParser -lLLVMVECodeGen -lLLVMVEDesc -lLLVMVEDisassembler \
-lLLVMVEInfo -lLLVMAVRAsmParser -lLLVMInterfaceStub -lLLVMFileCheck -lLLVMAVRCodeGen -lLLVMAVRDesc \
-lLLVMAVRDisassembler -lLLVMAVRInfo -lLLVMRISCVDisassembler -lLLVMRISCVCodeGen -lLLVMRISCVAsmParser \
-lLLVMRISCVDesc -lLLVMRISCVInfo -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen \
-lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMX86Disassembler -lLLVMX86CodeGen -lLLVMX86AsmParser \
-lLLVMX86Desc -lLLVMX86Info -lLLVMX86TargetMCA -lLLVMWebAssemblyDisassembler \
-lLLVMWebAssemblyCodeGen -lLLVMWebAssemblyDesc -lLLVMWebAssemblyAsmParser \
-lLLVMWebAssemblyUtils -lLLVMWebAssemblyInfo -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen \
-lLLVMSystemZAsmParser -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSparcDisassembler \
-lLLVMSparcCodeGen -lLLVMSparcAsmParser -lLLVMSparcDesc -lLLVMSparcInfo \
-lLLVMPowerPCDisassembler -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser -lLLVMPowerPCDesc \
-lLLVMPowerPCInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMMSP430Disassembler \
-lLLVMMSP430CodeGen -lLLVMMSP430AsmParser -lLLVMMSP430Desc -lLLVMMSP430Info \
-lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc \
-lLLVMMipsInfo -lLLVMLanaiDisassembler -lLLVMLanaiCodeGen -lLLVMLanaiAsmParser \
-lLLVMLanaiDesc -lLLVMLanaiInfo -lLLVMHexagonDisassembler -lLLVMHexagonCodeGen \
-lLLVMHexagonAsmParser -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMBPFDisassembler \
-lLLVMBPFCodeGen -lLLVMBPFAsmParser -lLLVMBPFDesc -lLLVMBPFInfo -lLLVMARMDisassembler \
-lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMUtils \
-lLLVMAMDGPUDisassembler -lLLVMAMDGPUCodeGen -lLLVMipo -lLLVMInstrumentation \
-lLLVMVectorize -lLLVMLinker -lLLVMIRReader -lLLVMAsmParser -lLLVMAMDGPUAsmParser \
-lLLVMAMDGPUDesc -lLLVMAMDGPUInfo -lLLVMAMDGPUTargetMCA -lLLVMAMDGPUUtils -lLLVMLibDriver -lLLVMOption \
-lLLVMWindowsManifest -lLLVMAArch64Disassembler -lLLVMMCDisassembler \
-lLLVMAArch64AsmParser -lLLVMMCJIT -lLLVMTableGen -lLLVMOrcJIT -lLLVMOrcTargetProcess -lLLVMOrcShared -lLLVMExecutionEngine \
-lLLVMRuntimeDyld -lLLVMBitstreamReader -lLLVMCFGuard -lLLVMFrontendOpenACC -lLLVMExtensions -lLLVMDWARFLinker \
-lLLVMDebugInfoGSYM -lLLVMFrontendOpenMP -lLLVMMCA -lLLVMAArch64CodeGen -lLLVMGlobalISel \
-lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMJITLink -lLLVMCodeGen \
-lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMAggressiveInstCombine \
-lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject \
-lLLVMMCParser -lLLVMBitReader -lLLVMCore -lLLVMAArch64Desc -lLLVMAArch64Info \
-lLLVMMC -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMBinaryFormat -lLLVMAArch64Utils \
-lLLVMSupport -lLLVMDemangle"
shared_libs="-lLLVM-$version"
systemzdesc systemzdisassembler systemzinfo tablegen target targetparser textapi \
transformutils ve veasmparser vecodegen vectorize vedesc vedisassembler veinfo \
webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler \
webassemblyinfo webassemblyutils windowsdriver windowsmanifest x86 x86asmparser \
x86codegen x86desc x86disassembler x86info x86targetmca xcore xcorecodegen xcoredesc \
xcoredisassembler xcoreinfo xray"
static_libs="-lLLVMWindowsManifest -lLLVMXRay -lLLVMLibDriver -lLLVMDlltoolDriver \
-lLLVMCoverage -lLLVMLineEditor -lLLVMM68kDisassembler -lLLVMM68kAsmParser -lLLVMM68kCodeGen \
-lLLVMM68kDesc -lLLVMM68kInfo -lLLVMCSKYDisassembler -lLLVMCSKYAsmParser -lLLVMCSKYCodeGen \
-lLLVMCSKYDesc -lLLVMCSKYInfo -lLLVMARCDisassembler -lLLVMARCCodeGen -lLLVMARCDesc \
-lLLVMARCInfo -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo \
-lLLVMX86TargetMCA -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86Desc \
-lLLVMX86Info -lLLVMWebAssemblyDisassembler -lLLVMWebAssemblyAsmParser -lLLVMWebAssemblyCodeGen \
-lLLVMWebAssemblyDesc -lLLVMWebAssemblyUtils -lLLVMWebAssemblyInfo -lLLVMVEDisassembler \
-lLLVMVEAsmParser -lLLVMVECodeGen -lLLVMVEDesc -lLLVMVEInfo -lLLVMSystemZDisassembler \
-lLLVMSystemZAsmParser -lLLVMSystemZCodeGen -lLLVMSystemZDesc -lLLVMSystemZInfo \
-lLLVMSparcDisassembler -lLLVMSparcAsmParser -lLLVMSparcCodeGen -lLLVMSparcDesc \
-lLLVMSparcInfo -lLLVMRISCVTargetMCA -lLLVMRISCVDisassembler -lLLVMRISCVAsmParser \
-lLLVMRISCVCodeGen -lLLVMRISCVDesc -lLLVMRISCVInfo -lLLVMPowerPCDisassembler -lLLVMPowerPCAsmParser \
-lLLVMPowerPCCodeGen -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc \
-lLLVMNVPTXInfo -lLLVMMSP430Disassembler -lLLVMMSP430AsmParser -lLLVMMSP430CodeGen \
-lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMipsDisassembler -lLLVMMipsAsmParser -lLLVMMipsCodeGen \
-lLLVMMipsDesc -lLLVMMipsInfo -lLLVMLoongArchDisassembler -lLLVMLoongArchAsmParser \
-lLLVMLoongArchCodeGen -lLLVMLoongArchDesc -lLLVMLoongArchInfo -lLLVMLanaiDisassembler \
-lLLVMLanaiCodeGen -lLLVMLanaiAsmParser -lLLVMLanaiDesc -lLLVMLanaiInfo -lLLVMHexagonDisassembler \
-lLLVMHexagonCodeGen -lLLVMHexagonAsmParser -lLLVMHexagonDesc -lLLVMHexagonInfo \
-lLLVMBPFDisassembler -lLLVMBPFAsmParser -lLLVMBPFCodeGen -lLLVMBPFDesc -lLLVMBPFInfo \
-lLLVMAVRDisassembler -lLLVMAVRAsmParser -lLLVMAVRCodeGen -lLLVMAVRDesc -lLLVMAVRInfo \
-lLLVMARMDisassembler -lLLVMARMAsmParser -lLLVMARMCodeGen -lLLVMARMDesc -lLLVMARMUtils \
-lLLVMARMInfo -lLLVMAMDGPUTargetMCA -lLLVMAMDGPUDisassembler -lLLVMAMDGPUAsmParser \
-lLLVMAMDGPUCodeGen -lLLVMAMDGPUDesc -lLLVMAMDGPUUtils -lLLVMAMDGPUInfo -lLLVMAArch64Disassembler \
-lLLVMAArch64AsmParser -lLLVMAArch64CodeGen -lLLVMAArch64Desc -lLLVMAArch64Utils \
-lLLVMAArch64Info -lLLVMOrcJIT -lLLVMWindowsDriver -lLLVMMCJIT -lLLVMJITLink -lLLVMInterpreter \
-lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMOrcTargetProcess -lLLVMOrcShared -lLLVMDWP \
-lLLVMDebugInfoLogicalView -lLLVMDebugInfoGSYM -lLLVMOption -lLLVMObjectYAML -lLLVMObjCopy \
-lLLVMMCA -lLLVMMCDisassembler -lLLVMLTO -lLLVMCFGuard -lLLVMFrontendOpenACC -lLLVMFrontendHLSL \
-lLLVMExtensions -lPolly -lPollyISL -lLLVMPasses -lLLVMCoroutines -lLLVMipo -lLLVMInstrumentation \
-lLLVMVectorize -lLLVMLinker -lLLVMFrontendOpenMP -lLLVMDWARFLinkerParallel -lLLVMDWARFLinker \
-lLLVMGlobalISel -lLLVMMIRParser -lLLVMAsmPrinter -lLLVMSelectionDAG -lLLVMCodeGen \
-lLLVMObjCARCOpts -lLLVMIRPrinter -lLLVMInterfaceStub -lLLVMFileCheck -lLLVMFuzzMutate \
-lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMAggressiveInstCombine -lLLVMTransformUtils \
-lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMSymbolize -lLLVMDebugInfoPDB \
-lLLVMDebugInfoMSF -lLLVMDebugInfoDWARF -lLLVMObject -lLLVMTextAPI -lLLVMMCParser \
-lLLVMIRReader -lLLVMAsmParser -lLLVMMC -lLLVMDebugInfoCodeView -lLLVMBitReader \
-lLLVMFuzzerCLI -lLLVMCore -lLLVMRemarks -lLLVMBitstreamReader -lLLVMBinaryFormat \
-lLLVMTargetParser -lLLVMTableGen -lLLVMSupport -lLLVMDemangle"
shared_libs="-lLLVM-${version/.*/}"
libs=$shared_libs
handle_args () {
case "${1##--}" in
@@ -120,7 +126,6 @@ handle_args () {
link-static) libs=$static_libs ;;
version) echo "$version";;
prefix) echo "$prefix";;
src-root) echo "@TERMUX_PKG_SRCDIR@";;
obj-root) echo "$prefix";;
bindir) echo "$prefix/bin";;
includedir) echo "$prefix/include";;
@@ -129,12 +134,12 @@ handle_args () {
cflags) echo "$CFLAGS";;
cxxflags) echo "$CXXFLAGS";;
ldflags) echo "$LDFLAGS";;
system-libs) echo "-lc -ldl -lcurses -lz -lm";;
system-libs) echo "-lc -ldl -lz -lm -lzstd -ltinfo -lxml2";;
libs) echo "$libs";;
libnames) echo "libLLVM-$version.so";;
libnames) echo "libLLVM-${version/.*/}.so";;
libfiles) echo "$LIBFILE";;
components) echo "$components";;
targets-built) echo "AArch64 AMDGPU ARM AVR BPF Hexagon Lanai Mips MSP430 NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore";;
targets-built) echo "AArch64 AMDGPU ARM AVR BPF Hexagon Lanai LoongArch Mips MSP430 NVPTX PowerPC RISCV Sparc SystemZ VE WebAssembly X86 XCore ARC CSKY M68k";;
host-target) echo "@LLVM_DEFAULT_TARGET_TRIPLE@";;
build-mode) echo "Release";;
assertion-mode) echo "OFF";;

View File

@@ -1,10 +0,0 @@
--- a/llvm/tools/llvm-shlib/CMakeLists.txt 2019-03-20 21:24:00.144316380 +0000
+++ b/llvm/tools/llvm-shlib/CMakeLists.txt 2019-03-20 21:25:26.117941452 +0000
@@ -48,6 +48,7 @@
OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD")
OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "Fuchsia")
OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "DragonFly")
+ OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "Android")
OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")) # FIXME: It should be "GNU ld for elf"
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/simple_version_script.map.in

View File

@@ -1,13 +1,14 @@
TERMUX_SUBPKG_INCLUDE="
bin/FileCheck
bin/UnicodeNameMappingGenerator
bin/count
bin/lli-child-target
bin/llvm-PerfectShuffle
bin/llvm-jitlink-executor
bin/not
bin/obj2yaml
bin/yaml2obj
bin/yaml-bench
bin/yaml2obj
share/man/man1/FileCheck.1.gz
"
TERMUX_SUBPKG_DESCRIPTION="LLVM Development Tools"

View File

@@ -0,0 +1,13 @@
diff --git a/mlir/lib/ExecutionEngine/CRunnerUtils.cpp b/mlir/lib/ExecutionEngine/CRunnerUtils.cpp
index e5e0d6f94f14..6be48c3c590b 100644
--- a/mlir/lib/ExecutionEngine/CRunnerUtils.cpp
+++ b/mlir/lib/ExecutionEngine/CRunnerUtils.cpp
@@ -127,7 +127,7 @@ extern "C" void *mlirAlloc(uint64_t size) { return malloc(size); }
extern "C" void *mlirAlignedAlloc(uint64_t alignment, uint64_t size) {
#ifdef _WIN32
return _aligned_malloc(size, alignment);
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) || defined(__ANDROID__)
// aligned_alloc was added in MacOS 10.15. Fall back to posix_memalign to also
// support older versions.
void *result = nullptr;

View File

@@ -1,46 +0,0 @@
/*
* Copyright (C) 2013 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef ANDROID_NLTYPES_H
#define ANDROID_NLTYPES_H
#include_next <nl_types.h>
#ifdef __cplusplus
extern "C" {
#endif
nl_catd catopen(const char*, int);
char* catgets(nl_catd, int, int, const char*);
int catclose(nl_catd);
#ifdef __cplusplus
} // extern "C"
#endif
#endif /* ANDROID_NLTYPES_H */

View File

@@ -1,48 +0,0 @@
/*
* Copyright (C) 2016 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <nl_types.h>
#include <errno.h>
__attribute__((weak,visibility("hidden")))
nl_catd catopen(const char*, int) {
return reinterpret_cast<nl_catd>(-1);
}
__attribute__((weak,visibility("hidden")))
char* catgets(nl_catd, int, int, const char* message) {
return const_cast<char*>(message);
}
__attribute__((weak,visibility("hidden")))
int catclose(nl_catd) {
// Since we didn't hand out a valid nl_catd, you can't be returning one to us.
errno = EBADF;
return -1;
}

View File

@@ -1,22 +0,0 @@
--- a/openmp/runtime/src/CMakeLists.txt 2018-03-02 09:50:00.000000000 +0000
+++ b/openmp/runtime/src/CMakeLists.txt 2018-03-08 03:39:14.548490023 +0000
@@ -50,6 +50,9 @@
if(${LIBOMP_USE_HWLOC})
include_directories(${LIBOMP_HWLOC_INSTALL_DIR}/include)
endif()
+if(ANDROID)
+ include_directories(${LIBOMP_SRC_DIR}/android)
+endif()
# Getting correct source files to build library
set(LIBOMP_CFILES)
@@ -95,6 +98,9 @@
libomp_append(LIBOMP_CXXFILES kmp_gsupport.cpp)
libomp_append(LIBOMP_ASMFILES z_Linux_asm.S) # Unix assembly file
endif()
+ if(ANDROID)
+ libomp_append(LIBOMP_CXXFILES android/nltypes_stubs.cpp)
+ endif()
libomp_append(LIBOMP_CXXFILES thirdparty/ittnotify/ittnotify_static.cpp LIBOMP_USE_ITT_NOTIFY)
libomp_append(LIBOMP_CXXFILES kmp_debugger.cpp LIBOMP_USE_DEBUGGER)
libomp_append(LIBOMP_CXXFILES kmp_stats.cpp LIBOMP_STATS)