summaryrefslogtreecommitdiff
path: root/repo/devel/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'repo/devel/llvm')
-rw-r--r--repo/devel/llvm/clang-001-fix-unwind-chain-inclusion.patch44
-rw-r--r--repo/devel/llvm/clang-002-add-musl-triples.patch110
-rw-r--r--repo/devel/llvm/clang-tools-extra.xibuild24
-rw-r--r--repo/devel/llvm/clang.xibuild17
-rw-r--r--repo/devel/llvm/libclang.xibuild8
-rw-r--r--repo/devel/llvm/libcxx-musl.patch26
-rw-r--r--repo/devel/llvm/libcxx-ssp-nonshared.patch11
-rw-r--r--repo/devel/llvm/libcxx.xibuild12
-rw-r--r--repo/devel/llvm/libcxxabi-dl.patch25
-rw-r--r--repo/devel/llvm/libcxxabi.xibuild10
-rw-r--r--repo/devel/llvm/libunwind.xibuild14
-rw-r--r--repo/devel/llvm/lld.xibuild15
-rw-r--r--repo/devel/llvm/lldb-musl.patch31
-rw-r--r--repo/devel/llvm/llvm-001-musl.patch57
-rw-r--r--repo/devel/llvm/llvm-004-override-opt.patch18
15 files changed, 422 insertions, 0 deletions
diff --git a/repo/devel/llvm/clang-001-fix-unwind-chain-inclusion.patch b/repo/devel/llvm/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 0000000..e4eaa77
--- /dev/null
+++ b/repo/devel/llvm/clang-001-fix-unwind-chain-inclusion.patch
@@ -0,0 +1,44 @@
+From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:14:57 +0200
+Subject: [PATCH 2/7] fix unwind chain inclusion
+
+---
+ lib/Headers/unwind.h | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
+index 303d792..44e10cc 100644
+--- a/clang/lib/Headers/unwind.h
++++ b/clang/lib/Headers/unwind.h
+@@ -9,9 +9,6 @@
+
+ /* See "Data Definitions for libgcc_s" in the Linux Standard Base.*/
+
+-#ifndef __CLANG_UNWIND_H
+-#define __CLANG_UNWIND_H
+-
+ #if defined(__APPLE__) && __has_include_next(<unwind.h>)
+ /* Darwin (from 11.x on) provide an unwind.h. If that's available,
+ * use it. libunwind wraps some of its definitions in #ifdef _GNU_SOURCE,
+@@ -39,6 +36,9 @@
+ # endif
+ #else
+
++#ifndef __CLANG_UNWIND_H
++#define __CLANG_UNWIND_H
++
+ #include <stdint.h>
+
+ #ifdef __cplusplus
+@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
+ }
+ #endif
+
++#endif /* __CLANG_UNWIND_H */
++
+ #endif
+
+-#endif /* __CLANG_UNWIND_H */
+--
+2.5.1
diff --git a/repo/devel/llvm/clang-002-add-musl-triples.patch b/repo/devel/llvm/clang-002-add-musl-triples.patch
new file mode 100644
index 0000000..25688d4
--- /dev/null
+++ b/repo/devel/llvm/clang-002-add-musl-triples.patch
@@ -0,0 +1,110 @@
+--- a/clang/lib/Driver/ToolChains/Gnu.cpp
++++ b/clang/lib/Driver/ToolChains/Gnu.cpp
+@@ -2086,7 +2086,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+ static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
+ "armv7hl-redhat-linux-gnueabi",
+ "armv6hl-suse-linux-gnueabi",
+- "armv7hl-suse-linux-gnueabi"};
++ "armv7hl-suse-linux-gnueabi",
++ "armv7l-linux-gnueabihf"};
+ static const char *const ARMebLibDirs[] = {"/lib"};
+ static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
+ "armeb-linux-androideabi"};
+@@ -2153,8 +2154,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+ "powerpc64-suse-linux", "powerpc-montavista-linuxspe"};
+ static const char *const PPCLELibDirs[] = {"/lib32", "/lib"};
+ static const char *const PPCLETriples[] = {"powerpcle-linux-gnu",
+- "powerpcle-unknown-linux-gnu",
+- "powerpcle-linux-musl"};
++ "powerpcle-unknown-linux-gnu"};
+
+ static const char *const PPC64LibDirs[] = {"/lib64", "/lib"};
+ static const char *const PPC64Triples[] = {
+@@ -2235,6 +2235,87 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
+ return;
+ }
+
++ if (TargetTriple.isMusl()) {
++ static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
++ static const char *const ARMHFMuslTriples[] = {
++ "arm-linux-musleabihf", "armv7l-linux-musleabihf"
++ };
++ static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
++ static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
++ static const char *const X86MuslTriples[] = {"i686-linux-musl"};
++ static const char *const MIPSMuslTriples[] = {
++ "mips-linux-musl", "mipsel-linux-musl",
++ "mipsel-linux-muslhf", "mips-linux-muslhf"
++ };
++ static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
++ static const char *const PPCLEMuslTriples[] = {"powerpcle-linux-musl"};
++ static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
++ static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
++
++ switch (TargetTriple.getArch()) {
++ case llvm::Triple::aarch64:
++ LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++ TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++ BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
++ BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
++ break;
++ case llvm::Triple::arm:
++ LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
++ if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
++ TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
++ } else {
++ TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
++ }
++ break;
++ case llvm::Triple::x86_64:
++ LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++ TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++ BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++ BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++ break;
++ case llvm::Triple::x86:
++ LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
++ TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
++ BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
++ BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
++ break;
++ case llvm::Triple::mips:
++ LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
++ TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
++ break;
++ case llvm::Triple::ppc:
++ LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++ TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++ BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++ BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++ break;
++ case llvm::Triple::ppcle:
++ LibDirs.append(begin(PPCLELibDirs), end(PPCLELibDirs));
++ TripleAliases.append(begin(PPCLEMuslTriples), end(PPCLEMuslTriples));
++ BiarchLibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
++ BiarchTripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
++ break;
++ case llvm::Triple::ppc64:
++ LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
++ TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
++ BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
++ BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
++ break;
++ case llvm::Triple::ppc64le:
++ LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
++ TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
++ BiarchLibDirs.append(begin(PPCLELibDirs), end(PPCLELibDirs));
++ BiarchTripleAliases.append(begin(PPCLEMuslTriples), end(PPCLEMuslTriples));
++ break;
++ default:
++ break;
++ }
++ TripleAliases.push_back(TargetTriple.str());
++ if (TargetTriple.str() != BiarchTriple.str())
++ BiarchTripleAliases.push_back(BiarchTriple.str());
++ return;
++ }
++
+ // Android targets should not use GNU/Linux tools or libraries.
+ if (TargetTriple.isAndroid()) {
+ static const char *const AArch64AndroidTriples[] = {
diff --git a/repo/devel/llvm/clang-tools-extra.xibuild b/repo/devel/llvm/clang-tools-extra.xibuild
new file mode 100644
index 0000000..0058ac9
--- /dev/null
+++ b/repo/devel/llvm/clang-tools-extra.xibuild
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+DESC="$DESC - Extra Clang Tools"
+
+package () {
+ add_from_main usr/include/clang-tidy
+ add_from_main usr/bin/clang-apply-replacements
+ add_from_main usr/bin/clang-query
+ add_from_main usr/bin/clang-rename
+ add_from_main usr/bin/clang-tidy
+ add_from_main usr/bin/diagtool
+ add_from_main usr/bin/find-all-symbols
+ add_from_main usr/bin/hmaptool
+ add_from_main usr/bin/modularize
+ add_from_main usr/bin/pp-trace
+ add_from_main usr/bin/sancov
+ add_from_main "usr/lib/libclangApplyReplacements*"
+ add_from_main "usr/lib/libclangQuery*"
+ add_from_main "usr/lib/libclangTidy*"
+ add_from_main "usr/share/clang/*tidy*"
+ add_from_main usr/share/doc/clang-tools
+ add_from_main usr/share/man/man1/extraclangtools.1
+ add_from_main usr/share/man/man1/diagtool.1
+}
diff --git a/repo/devel/llvm/clang.xibuild b/repo/devel/llvm/clang.xibuild
new file mode 100644
index 0000000..f00b98c
--- /dev/null
+++ b/repo/devel/llvm/clang.xibuild
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+DESC="$DESC - C language frontend"
+
+package () {
+ add_from_main usr/include/clang
+ add_from_main usr/include/clang-c
+ add_from_main "usr/bin/*clang*"
+ add_from_main usr/bin/c-index-test
+ add_from_main usr/lib/clang
+ add_from_main usr/lib/cmake/clang
+ add_from_main "usr/lib/libclang*.a"
+ add_from_main "usr/lib/libclang*.so"
+ add_from_main usr/share/clang
+ add_from_main usr/share/doc/clang
+ add_from_main usr/share/man/man1/clang.1
+}
diff --git a/repo/devel/llvm/libclang.xibuild b/repo/devel/llvm/libclang.xibuild
new file mode 100644
index 0000000..1acdb84
--- /dev/null
+++ b/repo/devel/llvm/libclang.xibuild
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+DESC="$DESC - C frontend runtime library"
+
+package () {
+ add_from_main "usr/lib/libclang.so.*"
+ add_from_main "usr/lib/libclang-cpp.so.*"
+}
diff --git a/repo/devel/llvm/libcxx-musl.patch b/repo/devel/llvm/libcxx-musl.patch
new file mode 100644
index 0000000..bbd31ff
--- /dev/null
+++ b/repo/devel/llvm/libcxx-musl.patch
@@ -0,0 +1,26 @@
+--- a/libcxx/include/locale
++++ b/libcxx/include/locale
+@@ -742,7 +742,11 @@ __num_get_signed_integral(const char* __a, const char* __a_end,
+ typename remove_reference<decltype(errno)>::type __save_errno = errno;
+ errno = 0;
+ char *__p2;
++#if defined(__linux__) && !defined(__GLIBC__)
++ long long __ll = strtoll(__a, &__p2, __base);
++#else
+ long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
++#endif
+ typename remove_reference<decltype(errno)>::type __current_errno = errno;
+ if (__current_errno == 0)
+ errno = __save_errno;
+@@ -782,7 +786,11 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end,
+ typename remove_reference<decltype(errno)>::type __save_errno = errno;
+ errno = 0;
+ char *__p2;
++#if defined(__linux__) && !defined(__GLIBC__)
++ unsigned long long __ll = strtoull(__a, &__p2, __base);
++#else
+ unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
++#endif
+ typename remove_reference<decltype(errno)>::type __current_errno = errno;
+ if (__current_errno == 0)
+ errno = __save_errno;
diff --git a/repo/devel/llvm/libcxx-ssp-nonshared.patch b/repo/devel/llvm/libcxx-ssp-nonshared.patch
new file mode 100644
index 0000000..70292be
--- /dev/null
+++ b/repo/devel/llvm/libcxx-ssp-nonshared.patch
@@ -0,0 +1,11 @@
+--- a/libcxx/CMakeLists.txt
++++ b/libcxx/CMakeLists.txt
+@@ -769,6 +769,8 @@ function(cxx_link_system_libraries target)
+ target_link_libraries(${target} PRIVATE atomic)
+ endif()
+
++#ssp target_link_libraries(${target} PRIVATE ssp_nonshared)
++
+ if (MINGW)
+ target_link_libraries(${target} PRIVATE "${MINGW_LIBRARIES}")
+ endif()
diff --git a/repo/devel/llvm/libcxx.xibuild b/repo/devel/llvm/libcxx.xibuild
new file mode 100644
index 0000000..9e84e7f
--- /dev/null
+++ b/repo/devel/llvm/libcxx.xibuild
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+DESC="C++ standard library from LLVM"
+
+package () {
+ add_from_main usr/lib/libc++.so.*
+ add_from_main usr/lib/libc++.a
+ add_from_main usr/lib/libc++experimental.a
+ add_from_main usr/include/c++
+ add_from_main usr/share/doc/libcxx
+
+}
diff --git a/repo/devel/llvm/libcxxabi-dl.patch b/repo/devel/llvm/libcxxabi-dl.patch
new file mode 100644
index 0000000..3a15f9d
--- /dev/null
+++ b/repo/devel/llvm/libcxxabi-dl.patch
@@ -0,0 +1,25 @@
+Also link to -ldl to prevent undefined references.
+
+--- a/libcxxabi/src/CMakeLists.txt
++++ b/libcxxabi/src/CMakeLists.txt
+@@ -73,6 +73,7 @@
+ endif()
+
+ add_library_flags_if(LIBCXXABI_HAS_C_LIB c)
++ add_library_flags_if(LIBCXXABI_HAS_C_LIB dl)
+ endif()
+
+ if (LIBCXXABI_USE_LLVM_UNWINDER)
+--- a/libcxx/CMakeLists.txt
++++ b/libcxx/CMakeLists.txt
+@@ -745,6 +745,10 @@
+ target_link_libraries(${target} PRIVATE m)
+ endif()
+
++ if (LIBCXX_HAS_C_LIB)
++ target_link_libraries(${target} PRIVATE dl)
++ endif()
++
+ if (LIBCXX_HAS_RT_LIB)
+ target_link_libraries(${target} PRIVATE rt)
+ endif()
diff --git a/repo/devel/llvm/libcxxabi.xibuild b/repo/devel/llvm/libcxxabi.xibuild
new file mode 100644
index 0000000..71f36ba
--- /dev/null
+++ b/repo/devel/llvm/libcxxabi.xibuild
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+DESC="Low level support for libc++"
+
+package () {
+ add_from_main "usr/lib/libc++abi.so.*" \
+ usr/lib/libc++abi.so \
+ usr/lib/libc++abi.a \
+ "usr/include/*cxxabi*"
+}
diff --git a/repo/devel/llvm/libunwind.xibuild b/repo/devel/llvm/libunwind.xibuild
new file mode 100644
index 0000000..b4e8b42
--- /dev/null
+++ b/repo/devel/llvm/libunwind.xibuild
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+DESC="C++ standard library from LLVM"
+
+package () {
+ add_from_main "usr/lib/libunwind.so.*" \
+ usr/lib/libunwind.so \
+ usr/lib/libunwind.a
+
+ add_from_main "usr/include/*unwind*"
+ add_from_main usr/include/mach-o
+ add_from_main usr/share/doc/libunwind
+
+}
diff --git a/repo/devel/llvm/lld.xibuild b/repo/devel/llvm/lld.xibuild
new file mode 100644
index 0000000..ff5dc5a
--- /dev/null
+++ b/repo/devel/llvm/lld.xibuild
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+DESC="LLVM linker"
+
+package () {
+ add_from_main usr/bin/lld*
+ add_from_main usr/bin/wasm-ld
+ add_from_main usr/bin/ld.lld*
+ add_from_main usr/bin/ld64.lld*
+ add_from_main usr/share/doc/lld
+
+ add_from_main usr/include/lld
+ add_from_main usr/lib/cmake/lld
+ add_from_main "usr/lib/liblld*a"
+}
diff --git a/repo/devel/llvm/lldb-musl.patch b/repo/devel/llvm/lldb-musl.patch
new file mode 100644
index 0000000..601c0d1
--- /dev/null
+++ b/repo/devel/llvm/lldb-musl.patch
@@ -0,0 +1,31 @@
+--- a/lldb/source/Plugins/Process/Linux/Procfs.h
++++ b/lldb/source/Plugins/Process/Linux/Procfs.h
+@@ -10,21 +10,12 @@
+ // sys/procfs.h on Android/Linux for all supported architectures.
+
+ #include <sys/ptrace.h>
++#include <asm/ptrace.h>
+
+-#ifdef __ANDROID__
+-#if defined(__arm64__) || defined(__aarch64__)
+-typedef unsigned long elf_greg_t;
+-typedef elf_greg_t
+- elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
+-typedef struct user_fpsimd_state elf_fpregset_t;
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#elif defined(__mips__)
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#endif
+-#else // __ANDROID__
++#if !defined(__GLIBC__) && defined(__powerpc__)
++#define pt_regs musl_pt_regs
++#include <sys/procfs.h>
++#undef pt_regs
++#else
+ #include <sys/procfs.h>
+-#endif // __ANDROID__
++#endif
diff --git a/repo/devel/llvm/llvm-001-musl.patch b/repo/devel/llvm/llvm-001-musl.patch
new file mode 100644
index 0000000..f2a3f8d
--- /dev/null
+++ b/repo/devel/llvm/llvm-001-musl.patch
@@ -0,0 +1,57 @@
+From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe@gmail.com>
+Date: Tue, 8 Sep 2015 22:03:02 +0200
+Subject: [PATCH 3/3] musl
+
+---
+ include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
+ lib/Support/DynamicLibrary.cpp | 2 +-
+ lib/Support/Unix/Signals.inc | 6 +++---
+ utils/unittest/googletest/src/gtest.cc | 1 +
+ 5 files changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h
+index 34a8a1e3..1214ece5 100644
+--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.h
++++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.h
+@@ -18,6 +18,15 @@
+ #include "llvm/IR/PassManager.h"
+ #include "llvm/Pass.h"
+
++#undef fopen64
++#undef fseeko64
++#undef fstat64
++#undef fstatvfs64
++#undef ftello64
++#undef lstat64
++#undef stat64
++#undef tmpfile64
++
+ namespace llvm {
+ template <typename T> class ArrayRef;
+ class Triple;
+diff --git a/lib/Support/Unix/DynamicLibrary.inc b/lib/Support/Unix/DynamicLibrary.inc
+index a2a37996..2f86c470 100644
+--- a/llvm/lib/Support/Unix/DynamicLibrary.inc
++++ b/llvm/lib/Support/Unix/DynamicLibrary.inc
+@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
+
+ // This macro returns the address of a well-known, explicit symbol
+ #define EXPLICIT_SYMBOL(SYM) \
+- if (!strcmp(SymbolName, #SYM)) return &SYM
++ if (!strcmp(SymbolName, #SYM)) return (void *)&SYM
+
+ // Under glibc we have a weird situation. The stderr/out/in symbols are both
+ // macros and global variables because of standards requirements. So, we
+diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc
+index d882ab2e..f1fb12d0 100644
+--- a/llvm/utils/unittest/googletest/src/gtest.cc
++++ b/llvm/utils/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h> // NOLINT
++# include <sys/socket.h> // NOLINT
+ # include <netdb.h> // NOLINT
+ # include <sys/socket.h> // NOLINT
+ # include <sys/types.h> // NOLINT
diff --git a/repo/devel/llvm/llvm-004-override-opt.patch b/repo/devel/llvm/llvm-004-override-opt.patch
new file mode 100644
index 0000000..51d0e4b
--- /dev/null
+++ b/repo/devel/llvm/llvm-004-override-opt.patch
@@ -0,0 +1,18 @@
+This allows us to override the optimization level as not all platforms can
+deal with -O3.
+
+--- a/llvm/CMakeLists.txt
++++ b/llvm/CMakeLists.txt
+@@ -918,6 +918,12 @@ if( MINGW AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
+ llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2")
+ endif()
+
++set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use")
++
++if (NOT VOID_CXX_OPT_FLAGS STREQUAL "")
++ llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}")
++endif()
++
+ # Put this before tblgen. Else we have a circular dependence.
+ add_subdirectory(lib/Demangle)
+ add_subdirectory(lib/Support)