Browse Source

llvm&clang: Update from 4.0.1 to 5.0.0

android-5
Fredrik Fornwall 7 years ago
parent
commit
fde18d473c
  1. 9
      packages/libllvm/build.sh
  2. 37
      packages/libllvm/tools-clang-lib-Driver-ToolChains-Gnu.cpp.patch
  3. 34
      packages/libllvm/tools-clang-lib-Driver-Tools.cpp.patch
  4. 16
      packages/libllvm/tools-llvm-shlib-CMakeLists.txt.patch

9
packages/libllvm/build.sh

@ -1,10 +1,9 @@
TERMUX_PKG_HOMEPAGE=http://clang.llvm.org/
TERMUX_PKG_DESCRIPTION="Modular compiler and toolchain technologies library"
_PKG_MAJOR_VERSION=4.0
TERMUX_PKG_VERSION=${_PKG_MAJOR_VERSION}.1
TERMUX_PKG_REVISION=3
_PKG_MAJOR_VERSION=5.0
TERMUX_PKG_VERSION=${_PKG_MAJOR_VERSION}.0
TERMUX_PKG_SRCURL=http://llvm.org/releases/${TERMUX_PKG_VERSION}/llvm-${TERMUX_PKG_VERSION}.src.tar.xz
TERMUX_PKG_SHA256=da783db1f82d516791179fe103c71706046561f7972b18f0049242dee6712b51
TERMUX_PKG_SHA256=e35dcbae6084adcf4abb32514127c5eabd7d63b733852ccdb31e06f1373136da
TERMUX_PKG_HOSTBUILD=true
TERMUX_PKG_RM_AFTER_INSTALL="
bin/bugpoint
@ -54,7 +53,7 @@ termux_step_post_extract_package () {
termux_download \
http://llvm.org/releases/${TERMUX_PKG_VERSION}/$CLANG_SRC_TAR \
$TERMUX_PKG_CACHEDIR/$CLANG_SRC_TAR \
61738a735852c23c3bdbe52d035488cdb2083013f384d67c1ba36fabebd8769b
019f23c2192df793ac746595e94a403908749f8e0c484b403476d2611dd20970
tar -xf $TERMUX_PKG_CACHEDIR/$CLANG_SRC_TAR -C tools
mv tools/cfe-${TERMUX_PKG_VERSION}.src tools/clang

37
packages/libllvm/tools-clang-lib-Driver-ToolChains-Gnu.cpp.patch

@ -0,0 +1,37 @@
diff -u -r ../llvm-5.0.0.src/tools/clang/lib/Driver/ToolChains/Gnu.cpp ./tools/clang/lib/Driver/ToolChains/Gnu.cpp
--- ../llvm-5.0.0.src/tools/clang/lib/Driver/ToolChains/Gnu.cpp 2017-08-11 03:47:32.000000000 +0200
+++ ./tools/clang/lib/Driver/ToolChains/Gnu.cpp 2017-09-10 20:14:54.636653647 +0200
@@ -152,14 +152,11 @@
}
}
- const std::string &customGCCName = D.getCCCGenericGCCName();
- const char *GCCName;
- if (!customGCCName.empty())
- GCCName = customGCCName.c_str();
- else if (D.CCCIsCXX()) {
- GCCName = "g++";
- } else
- GCCName = "gcc";
+ // Termux modification: Disable calling into gcc from clang.
+ // Clang calls into gcc if it tries to compile a language it doesn't understand.
+ // On Termux gcc is a symlink to clang, so this leads into fork loop until
+ // the whole system runs out of memory.
+ const char *GCCName = "false";
const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath(GCCName));
C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
@@ -415,9 +412,12 @@
const llvm::Triple::ArchType Arch = ToolChain.getArch();
const bool isAndroid = ToolChain.getTriple().isAndroid();
const bool IsIAMCU = ToolChain.getTriple().isOSIAMCU();
+ // Termux modification: Enable pie by default for Android
+ // and support the nopie flag.
const bool IsPIE =
!Args.hasArg(options::OPT_shared) && !Args.hasArg(options::OPT_static) &&
- (Args.hasArg(options::OPT_pie) || ToolChain.isPIEDefault());
+ (Args.hasArg(options::OPT_pie) || ToolChain.isPIEDefault() || isAndroid) &&
+ !Args.hasArg(options::OPT_nopie);
const bool HasCRTBeginEndFiles =
ToolChain.getTriple().hasEnvironment() ||
(ToolChain.getTriple().getVendor() != llvm::Triple::MipsTechnologies);

34
packages/libllvm/tools-clang-lib-Driver-Tools.cpp.patch

@ -1,34 +0,0 @@
diff -u -r ../llvm-3.9.0.src/tools/clang/lib/Driver/Tools.cpp ./tools/clang/lib/Driver/Tools.cpp
--- ../llvm-3.9.0.src/tools/clang/lib/Driver/Tools.cpp 2016-08-13 16:43:56.000000000 -0400
+++ ./tools/clang/lib/Driver/Tools.cpp 2016-09-04 06:15:59.703422745 -0400
@@ -7415,10 +7415,12 @@
const char *GCCName;
if (!customGCCName.empty())
GCCName = customGCCName.c_str();
- else if (D.CCCIsCXX()) {
- GCCName = "g++";
- } else
- GCCName = "gcc";
+ else
+ // Termux modification: Disable calling into gcc from clang.
+ // Clang calls into gcc if it tries to compile a language it doesn't understand.
+ // On Termux gcc is a symlink to clang, so this leads into fork loop until
+ // the whole system runs out of memory.
+ GCCName = "false";
const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath(GCCName));
C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
@@ -9357,9 +9357,12 @@
const llvm::Triple::ArchType Arch = ToolChain.getArch();
const bool isAndroid = ToolChain.getTriple().isAndroid();
const bool IsIAMCU = ToolChain.getTriple().isOSIAMCU();
+ // Termux modification: Enable pie by default for Android and support the
+ // nopie flag.
const bool IsPIE =
!Args.hasArg(options::OPT_shared) && !Args.hasArg(options::OPT_static) &&
- (Args.hasArg(options::OPT_pie) || ToolChain.isPIEDefault());
+ (Args.hasArg(options::OPT_pie) || ToolChain.isPIEDefault() || isAndroid) &&
+ !Args.hasArg(options::OPT_nopie);
const bool HasCRTBeginEndFiles =
ToolChain.getTriple().hasEnvironment() ||
(ToolChain.getTriple().getVendor() != llvm::Triple::MipsTechnologies);

16
packages/libllvm/tools-llvm-shlib-CMakeLists.txt.patch

@ -1,12 +1,12 @@
diff -u -r ../llvm-4.0.0.src/tools/llvm-shlib/CMakeLists.txt ./tools/llvm-shlib/CMakeLists.txt
--- ../llvm-4.0.0.src/tools/llvm-shlib/CMakeLists.txt 2016-11-01 21:19:33.000000000 +0100
+++ ./tools/llvm-shlib/CMakeLists.txt 2017-03-14 17:08:19.394563777 +0100
diff -u -r ../llvm-5.0.0.src/tools/llvm-shlib/CMakeLists.txt ./tools/llvm-shlib/CMakeLists.txt
--- ../llvm-5.0.0.src/tools/llvm-shlib/CMakeLists.txt 2017-07-11 03:17:44.000000000 +0200
+++ ./tools/llvm-shlib/CMakeLists.txt 2017-09-07 23:29:50.949353365 +0200
@@ -37,7 +37,7 @@
add_llvm_library(LLVM SHARED DISABLE_LLVM_LINK_LLVM_DYLIB SONAME ${SOURCES})
list(REMOVE_DUPLICATES LIB_NAMES)
-if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" OR MINGW) # FIXME: It should be "GNU ld for elf"
+if("${CMAKE_SYSTEM_NAME}" MATCHES "^(Linux|Android)$" OR MINGW) # FIXME: It should be "GNU ld for elf"
# GNU ld doesn't resolve symbols in the version script.
set(LIB_NAMES -Wl,--whole-archive ${LIB_NAMES} -Wl,--no-whole-archive)
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
-if(("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") OR (MINGW) OR (HAIKU) OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "DragonFly")) # FIXME: It should be "GNU ld for elf"
+if(("${CMAKE_SYSTEM_NAME}" MATCHES "^(Linux|Android)$") OR (MINGW) OR (HAIKU) OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "DragonFly")) # FIXME: It should be "GNU ld for elf"
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/simple_version_script.map.in
${LLVM_LIBRARY_DIR}/tools/llvm-shlib/simple_version_script.map)

Loading…
Cancel
Save