summaryrefslogtreecommitdiff
path: root/sys-devel/llvm/files/9999
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2016-08-22 15:43:14 +0200
committerMichał Górny <mgorny@gentoo.org>2016-08-22 17:11:50 +0200
commit11d093e4ec16f42e733d605dccf3100d4bb435ba (patch)
tree430bb5398c01766b2874e1226a187749ffa98f69 /sys-devel/llvm/files/9999
parent4ab9c2e321dbe726cbf8083adc157d1bc63e36de (diff)
downloadgentoo-11d093e4ec16f42e733d605dccf3100d4bb435ba.tar.gz
gentoo-11d093e4ec16f42e733d605dccf3100d4bb435ba.tar.xz
sys-devel/llvm: Group all patches by newest version applicable
Diffstat (limited to 'sys-devel/llvm/files/9999')
-rw-r--r--sys-devel/llvm/files/9999/0001-cmake-Install-OCaml-modules-into-correct-package-loc.patch71
-rw-r--r--sys-devel/llvm/files/9999/0002-cmake-Make-OCaml-docs-dependent-on-LLVM_BUILD_DOCS.patch28
-rw-r--r--sys-devel/llvm/files/9999/0003-cmake-Support-overriding-Sphinx-HTML-doc-install-dir.patch37
-rw-r--r--sys-devel/llvm/files/9999/0004-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch33
-rw-r--r--sys-devel/llvm/files/9999/0005-cmake-Do-not-install-libgtest.patch30
-rw-r--r--sys-devel/llvm/files/9999/0006-cmake-Remove-the-CMAKE_BUILD_TYPE-assertion.patch28
-rw-r--r--sys-devel/llvm/files/9999/0007-llvm-config-Clean-up-exported-values-update-for-shar.patch88
-rw-r--r--sys-devel/llvm/files/9999/0008-cmake-Restore-SOVERSIONs-on-shared-libraries.patch28
-rw-r--r--sys-devel/llvm/files/9999/musl-fixes.patch33
9 files changed, 376 insertions, 0 deletions
diff --git a/sys-devel/llvm/files/9999/0001-cmake-Install-OCaml-modules-into-correct-package-loc.patch b/sys-devel/llvm/files/9999/0001-cmake-Install-OCaml-modules-into-correct-package-loc.patch
new file mode 100644
index 00000000000..367a8a7794f
--- /dev/null
+++ b/sys-devel/llvm/files/9999/0001-cmake-Install-OCaml-modules-into-correct-package-loc.patch
@@ -0,0 +1,71 @@
+From 2907883b3c504a08b98cf735ceaa8e438d20f37e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Sun, 21 Aug 2016 22:46:48 +0200
+Subject: [PATCH 01/10] cmake: Install OCaml modules into correct package
+ location
+
+Ensure that correct libdir is used for OCaml modules, and install them
+into dedicated llvm subdirectory rather than the top directory which is
+supposedly reserved for the standard library.
+
+Author: Mark Wright <gienah@gentoo.org>
+Bug: https://bugs.gentoo.org/559134
+Bug: https://bugs.gentoo.org/559624
+---
+ bindings/ocaml/backends/CMakeLists.txt | 2 +-
+ bindings/ocaml/llvm/CMakeLists.txt | 2 +-
+ cmake/modules/AddOCaml.cmake | 6 +++---
+ 3 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/bindings/ocaml/backends/CMakeLists.txt b/bindings/ocaml/backends/CMakeLists.txt
+index a980638..9e5dc50 100644
+--- a/bindings/ocaml/backends/CMakeLists.txt
++++ b/bindings/ocaml/backends/CMakeLists.txt
+@@ -23,5 +23,5 @@ foreach(TARGET ${LLVM_TARGETS_TO_BUILD})
+ "${LLVM_LIBRARY_DIR}/ocaml/META.llvm_${TARGET}")
+
+ install(FILES "${LLVM_LIBRARY_DIR}/ocaml/META.llvm_${TARGET}"
+- DESTINATION lib/ocaml)
++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/ocaml/llvm)
+ endforeach()
+diff --git a/bindings/ocaml/llvm/CMakeLists.txt b/bindings/ocaml/llvm/CMakeLists.txt
+index 4956fa4..c612f73 100644
+--- a/bindings/ocaml/llvm/CMakeLists.txt
++++ b/bindings/ocaml/llvm/CMakeLists.txt
+@@ -8,4 +8,4 @@ configure_file(
+ "${LLVM_LIBRARY_DIR}/ocaml/META.llvm")
+
+ install(FILES "${LLVM_LIBRARY_DIR}/ocaml/META.llvm"
+- DESTINATION lib/ocaml)
++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/ocaml/llvm)
+diff --git a/cmake/modules/AddOCaml.cmake b/cmake/modules/AddOCaml.cmake
+index e3dd1d8..a16238e 100644
+--- a/cmake/modules/AddOCaml.cmake
++++ b/cmake/modules/AddOCaml.cmake
+@@ -137,7 +137,7 @@ function(add_ocaml_library name)
+ if( APPLE )
+ set(ocaml_rpath "@executable_path/../../lib")
+ elseif( UNIX )
+- set(ocaml_rpath "\\$ORIGIN/../../lib")
++ set(ocaml_rpath "\\$ORIGIN/../../${CMAKE_INSTALL_LIBDIR}")
+ endif()
+ list(APPEND ocaml_flags "-ldopt" "-Wl,-rpath,${ocaml_rpath}")
+
+@@ -189,12 +189,12 @@ function(add_ocaml_library name)
+ endforeach()
+
+ install(FILES ${install_files}
+- DESTINATION lib/ocaml)
++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/ocaml/llvm)
+ install(FILES ${install_shlibs}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
+ GROUP_READ GROUP_EXECUTE
+ WORLD_READ WORLD_EXECUTE
+- DESTINATION lib/ocaml)
++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/ocaml/llvm)
+
+ foreach( install_file ${install_files} ${install_shlibs} )
+ get_filename_component(filename "${install_file}" NAME)
+--
+2.9.3
+
diff --git a/sys-devel/llvm/files/9999/0002-cmake-Make-OCaml-docs-dependent-on-LLVM_BUILD_DOCS.patch b/sys-devel/llvm/files/9999/0002-cmake-Make-OCaml-docs-dependent-on-LLVM_BUILD_DOCS.patch
new file mode 100644
index 00000000000..b90527a0e44
--- /dev/null
+++ b/sys-devel/llvm/files/9999/0002-cmake-Make-OCaml-docs-dependent-on-LLVM_BUILD_DOCS.patch
@@ -0,0 +1,28 @@
+From 726806d9b4932287d67f9b6b112099648ea008b4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Sun, 21 Aug 2016 23:01:47 +0200
+Subject: [PATCH 02/10] cmake: Make OCaml docs dependent on LLVM_BUILD_DOCS
+
+Author: Bernard Cafarelli <voyageur@gentoo.org>
+Bug: https://bugs.gentoo.org/562008
+Patch: https://reviews.llvm.org/D23763
+---
+ docs/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
+index eaa1750..f2cd7e9 100644
+--- a/docs/CMakeLists.txt
++++ b/docs/CMakeLists.txt
+@@ -115,7 +115,7 @@ if (LLVM_ENABLE_SPHINX)
+ endif()
+
+ list(FIND LLVM_BINDINGS_LIST ocaml uses_ocaml)
+-if( NOT uses_ocaml LESS 0 )
++if( NOT uses_ocaml LESS 0 AND LLVM_BUILD_DOCS )
+ set(doc_targets
+ ocaml_llvm
+ ocaml_llvm_all_backends
+--
+2.9.3
+
diff --git a/sys-devel/llvm/files/9999/0003-cmake-Support-overriding-Sphinx-HTML-doc-install-dir.patch b/sys-devel/llvm/files/9999/0003-cmake-Support-overriding-Sphinx-HTML-doc-install-dir.patch
new file mode 100644
index 00000000000..76adf52fb94
--- /dev/null
+++ b/sys-devel/llvm/files/9999/0003-cmake-Support-overriding-Sphinx-HTML-doc-install-dir.patch
@@ -0,0 +1,37 @@
+From 1251ac2021b768d3a56b4dc03212ea2fd12a34dd Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Mon, 8 Jun 2015 06:43:00 +0200
+Subject: [PATCH 03/10] cmake: Support overriding Sphinx HTML doc install
+ directory
+
+Provide ${PROJECT}_INSTALL_HTML variables (e.g. LLVM_INSTALL_HTML) to
+override Sphinx HTML doc install directory.
+
+Bug: https://llvm.org/bugs/show_bug.cgi?id=23780
+Patch: https://reviews.llvm.org/D23757
+---
+ cmake/modules/AddSphinxTarget.cmake | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/cmake/modules/AddSphinxTarget.cmake b/cmake/modules/AddSphinxTarget.cmake
+index 045dc23..fac143f 100644
+--- a/cmake/modules/AddSphinxTarget.cmake
++++ b/cmake/modules/AddSphinxTarget.cmake
+@@ -53,8 +53,12 @@ function (add_sphinx_target builder project)
+ DESTINATION share/man/man1)
+
+ elseif (builder STREQUAL html)
+- install(DIRECTORY "${SPHINX_BUILD_DIR}"
+- DESTINATION "share/doc/${project}")
++ string(TOUPPER "${project}" project_upper)
++ set(${project_upper}_INSTALL_HTML "share/doc/${project}/html"
++ CACHE STRING "HTML documentation install directory for ${project}")
++
++ install(DIRECTORY "${SPHINX_BUILD_DIR}/."
++ DESTINATION "${${project_upper}_INSTALL_HTML}")
+ else()
+ message(WARNING Installation of ${builder} not supported)
+ endif()
+--
+2.9.3
+
diff --git a/sys-devel/llvm/files/9999/0004-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch b/sys-devel/llvm/files/9999/0004-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch
new file mode 100644
index 00000000000..94a81574d6e
--- /dev/null
+++ b/sys-devel/llvm/files/9999/0004-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch
@@ -0,0 +1,33 @@
+From 2f798e87c10a93235a00e95c38e736f9ff7e991b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Mon, 8 Jun 2015 14:29:03 +0200
+Subject: [PATCH 04/10] cmake: Add an ordering dep between HTML & man Sphinx
+ targets
+
+Add a dependency between HTML & manpage Sphinx targets to prevent two
+instances of Sphinx from running in parallel, and therefore solves race
+conditions reusing the same doctree directory.
+
+Bug: https://llvm.org/bugs/show_bug.cgi?id=23781
+Patch: https://reviews.llvm.org/D23755
+---
+ docs/CMakeLists.txt | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
+index f2cd7e9..179a65b 100644
+--- a/docs/CMakeLists.txt
++++ b/docs/CMakeLists.txt
+@@ -109,6 +109,9 @@ if (LLVM_ENABLE_SPHINX)
+
+ if (${SPHINX_OUTPUT_MAN})
+ add_sphinx_target(man llvm)
++ if (${SPHINX_OUTPUT_HTML})
++ add_dependencies(docs-llvm-html docs-llvm-man)
++ endif()
+ endif()
+
+ endif()
+--
+2.9.3
+
diff --git a/sys-devel/llvm/files/9999/0005-cmake-Do-not-install-libgtest.patch b/sys-devel/llvm/files/9999/0005-cmake-Do-not-install-libgtest.patch
new file mode 100644
index 00000000000..a24977c0314
--- /dev/null
+++ b/sys-devel/llvm/files/9999/0005-cmake-Do-not-install-libgtest.patch
@@ -0,0 +1,30 @@
+From 1303993b5b9a4195ebe4930a8cd345c875e7f25c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Tue, 9 Jun 2015 11:58:52 +0200
+Subject: [PATCH 05/10] cmake: Do not install libgtest
+
+libgtest is an internal test dependency, and should not be installed to
+the live system as a part of LLVM.
+
+Bug: http://llvm.org/bugs/show_bug.cgi?id=18341
+---
+ utils/unittest/CMakeLists.txt | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/utils/unittest/CMakeLists.txt b/utils/unittest/CMakeLists.txt
+index c9a2cdd..bb4f667 100644
+--- a/utils/unittest/CMakeLists.txt
++++ b/utils/unittest/CMakeLists.txt
+@@ -37,6 +37,9 @@ if (PTHREAD_LIBRARY_PATH)
+ list(APPEND LIBS pthread)
+ endif()
+
++# Delay building until the tests pull it in, and avoid installing it
++set(EXCLUDE_FROM_ALL ON)
++
+ add_llvm_library(gtest
+ googletest/src/gtest-all.cc
+
+--
+2.9.3
+
diff --git a/sys-devel/llvm/files/9999/0006-cmake-Remove-the-CMAKE_BUILD_TYPE-assertion.patch b/sys-devel/llvm/files/9999/0006-cmake-Remove-the-CMAKE_BUILD_TYPE-assertion.patch
new file mode 100644
index 00000000000..8a2c091edfb
--- /dev/null
+++ b/sys-devel/llvm/files/9999/0006-cmake-Remove-the-CMAKE_BUILD_TYPE-assertion.patch
@@ -0,0 +1,28 @@
+From a2ecd4815d285281cb816e06b25dc0dc2a933073 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Sun, 21 Aug 2016 23:13:45 +0200
+Subject: [PATCH 06/10] cmake: Remove the CMAKE_BUILD_TYPE assertion
+
+---
+ CMakeLists.txt | 5 -----
+ 1 file changed, 5 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 894bc8c..453fcb8 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -232,11 +232,6 @@ endif()
+
+ string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
+
+-if (CMAKE_BUILD_TYPE AND
+- NOT uppercase_CMAKE_BUILD_TYPE MATCHES "^(DEBUG|RELEASE|RELWITHDEBINFO|MINSIZEREL)$")
+- message(FATAL_ERROR "Invalid value for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
+-endif()
+-
+ set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" )
+
+ set(LLVM_TOOLS_INSTALL_DIR "bin" CACHE STRING "Path for binary subdirectory (defaults to 'bin')")
+--
+2.9.3
+
diff --git a/sys-devel/llvm/files/9999/0007-llvm-config-Clean-up-exported-values-update-for-shar.patch b/sys-devel/llvm/files/9999/0007-llvm-config-Clean-up-exported-values-update-for-shar.patch
new file mode 100644
index 00000000000..968db45a0d7
--- /dev/null
+++ b/sys-devel/llvm/files/9999/0007-llvm-config-Clean-up-exported-values-update-for-shar.patch
@@ -0,0 +1,88 @@
+From 2dba8c81db58d7dd62c67379eaa175498a4370f2 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Sat, 20 Aug 2016 23:47:41 +0200
+Subject: [PATCH 07/10] llvm-config: Clean up exported values, update for
+ shared linking
+
+Gentoo-specific fixup for llvm-config, including:
+- wiping build-specific CFLAGS, CXXFLAGS,
+- updating library suffixes for shared libs,
+- wiping --system-libs for shared linking,
+- making --obj-root and --src-root return invalid path (/dev/null),
+- making --build-mode return "Release" rather than "Gentoo".
+
+Thanks to Steven Newbury for the initial patch.
+
+Bug: https://bugs.gentoo.org/565358
+Bug: https://bugs.gentoo.org/501684
+---
+ tools/llvm-config/CMakeLists.txt | 11 ++++++++---
+ tools/llvm-config/llvm-config.cpp | 15 ++++++++++++---
+ 2 files changed, 20 insertions(+), 6 deletions(-)
+
+diff --git a/tools/llvm-config/CMakeLists.txt b/tools/llvm-config/CMakeLists.txt
+index 744fa4e..593788a 100644
+--- a/tools/llvm-config/CMakeLists.txt
++++ b/tools/llvm-config/CMakeLists.txt
+@@ -32,8 +32,12 @@ get_property(COMPILE_FLAGS TARGET llvm-config PROPERTY COMPILE_FLAGS)
+ set(LLVM_SRC_ROOT ${LLVM_MAIN_SRC_DIR})
+ set(LLVM_OBJ_ROOT ${LLVM_BINARY_DIR})
+ set(LLVM_CPPFLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_CPP_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
+-set(LLVM_CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
+-set(LLVM_CXXFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${COMPILE_FLAGS} ${LLVM_DEFINITIONS}")
++# Just use CMAKE_CPP_FLAGS for CFLAGS and CXXFLAGS, otherwise compiler
++# specific flags will be set when we don't know what compiler will be used
++# with external project utilising llvm-config. C++ Standard is required.
++# TODO: figure out if we can remove -std=c++11 and move it to revdeps.
++set(LLVM_CFLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
++set(LLVM_CXXFLAGS "${CMAKE_CPP_FLAGS} -std=c++11 ${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
+ set(LLVM_BUILD_SYSTEM cmake)
+ set(LLVM_HAS_RTTI ${LLVM_CONFIG_HAS_RTTI})
+ set(LLVM_DYLIB_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}${LLVM_VERSION_SUFFIX}")
+@@ -46,7 +50,8 @@ endif()
+ # Use the C++ link flags, since they should be a superset of C link flags.
+ set(LLVM_LDFLAGS "${CMAKE_CXX_LINK_FLAGS}")
+ set(LLVM_BUILDMODE ${CMAKE_BUILD_TYPE})
+-set(LLVM_SYSTEM_LIBS ${SYSTEM_LIBS})
++# We don't do static libs, so we don't need to supply any system-libs
++set(LLVM_SYSTEM_LIBS "")
+ if(BUILD_SHARED_LIBS)
+ set(LLVM_ENABLE_SHARED ON)
+ else()
+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
+index c63733f..ead11b9 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -522,7 +522,8 @@ int main(int argc, char **argv) {
+ } else if (Arg == "--host-target") {
+ OS << Triple::normalize(LLVM_DEFAULT_TARGET_TRIPLE) << '\n';
+ } else if (Arg == "--build-mode") {
+- OS << build_mode << '\n';
++ // force Release since we force non-standard Gentoo build mode
++ OS << "Release" << '\n';
+ } else if (Arg == "--assertion-mode") {
+ #if defined(NDEBUG)
+ OS << "OFF\n";
+@@ -538,9 +539,17 @@ int main(int argc, char **argv) {
+ } else if (Arg == "--shared-mode") {
+ PrintSharedMode = true;
+ } else if (Arg == "--obj-root") {
+- OS << ActivePrefix << '\n';
++ if (IsInDevelopmentTree) {
++ OS << ActivePrefix << '\n';
++ } else {
++ OS << "/dev/null\n";
++ }
+ } else if (Arg == "--src-root") {
+- OS << LLVM_SRC_ROOT << '\n';
++ if (IsInDevelopmentTree) {
++ OS << LLVM_SRC_ROOT << '\n';
++ } else {
++ OS << "/dev/null\n";
++ }
+ } else if (Arg == "--link-shared") {
+ LinkMode = LinkModeShared;
+ } else if (Arg == "--link-static") {
+--
+2.9.3
+
diff --git a/sys-devel/llvm/files/9999/0008-cmake-Restore-SOVERSIONs-on-shared-libraries.patch b/sys-devel/llvm/files/9999/0008-cmake-Restore-SOVERSIONs-on-shared-libraries.patch
new file mode 100644
index 00000000000..c333bc4b962
--- /dev/null
+++ b/sys-devel/llvm/files/9999/0008-cmake-Restore-SOVERSIONs-on-shared-libraries.patch
@@ -0,0 +1,28 @@
+From 597ebcc28580a8532f6634e2a723901c3448b9ff Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Mon, 28 Mar 2016 22:21:19 +0200
+Subject: [PATCH 08/10] cmake: Restore SOVERSIONs on shared libraries
+
+---
+ cmake/modules/AddLLVM.cmake | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
+index 9590a1b..83a2359 100644
+--- a/cmake/modules/AddLLVM.cmake
++++ b/cmake/modules/AddLLVM.cmake
+@@ -445,6 +445,11 @@ function(llvm_add_library name)
+ PREFIX ""
+ )
+ endif()
++
++ set_target_properties(${name}
++ PROPERTIES
++ SOVERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}
++ VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX})
+ endif()
+
+ if(ARG_MODULE OR ARG_SHARED)
+--
+2.9.3
+
diff --git a/sys-devel/llvm/files/9999/musl-fixes.patch b/sys-devel/llvm/files/9999/musl-fixes.patch
new file mode 100644
index 00000000000..5c516534abc
--- /dev/null
+++ b/sys-devel/llvm/files/9999/musl-fixes.patch
@@ -0,0 +1,33 @@
+diff --git a/include/llvm/Analysis/TargetLibraryInfo.def b/include/llvm/Analysis/TargetLibraryInfo.def
+index 7798e3c..ade2b96 100644
+--- a/include/llvm/Analysis/TargetLibraryInfo.def
++++ b/include/llvm/Analysis/TargetLibraryInfo.def
+@@ -27,6 +27,15 @@
+ #define TLI_DEFINE_STRING_INTERNAL(string_repr) string_repr,
+ #endif
+
++// avoid name conflicts with musl-libc
++#undef fopen64
++#undef fseeko64
++#undef ftello64
++#undef fstat64
++#undef lstat64
++#undef stat64
++#undef tmpfile64
++
+ /// void *new(unsigned int);
+ TLI_DEFINE_ENUM_INTERNAL(msvc_new_int)
+ TLI_DEFINE_STRING_INTERNAL("??2@YAPAXI@Z")
+diff --git a/lib/Support/DynamicLibrary.cpp b/lib/Support/DynamicLibrary.cpp
+index 9a7aeb5..e98ad80 100644
+--- a/lib/Support/DynamicLibrary.cpp
++++ b/lib/Support/DynamicLibrary.cpp
+@@ -143,7 +143,7 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char *symbolName) {
+ // On linux we have a weird situation. The stderr/out/in symbols are both
+ // macros and global variables because of standards requirements. So, we
+ // boldly use the EXPLICIT_SYMBOL macro without checking for a #define first.
+-#if defined(__linux__) and !defined(__ANDROID__)
++#if defined(__linux__) && defined(__GLIBC__)
+ {
+ EXPLICIT_SYMBOL(stderr);
+ EXPLICIT_SYMBOL(stdout);