From 29727ce6e434d8265350bbe7d1c47b13d17eb192 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Sat, 10 Sep 2016 10:43:12 +0200 Subject: sys-devel/llvm: restore llvm-3.4.2 for Prefix bootstraps, bug #588132 Package-Manager: portage-2.2.28 --- ...clang-3.1-gentoo-runtime-gcc-detection-v3.patch | 29 +++++++ .../llvm/files/clang-3.4-darwin_build_fix.patch | 47 +++++++++++ .../llvm/files/clang-3.4-gentoo-install.patch | 80 ++++++++++++++++++ sys-devel/llvm/files/llvm-3.4-gentoo-install.patch | 96 ++++++++++++++++++++++ 4 files changed, 252 insertions(+) create mode 100644 sys-devel/llvm/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch create mode 100644 sys-devel/llvm/files/clang-3.4-darwin_build_fix.patch create mode 100644 sys-devel/llvm/files/clang-3.4-gentoo-install.patch create mode 100644 sys-devel/llvm/files/llvm-3.4-gentoo-install.patch (limited to 'sys-devel/llvm/files') diff --git a/sys-devel/llvm/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch b/sys-devel/llvm/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch new file mode 100644 index 000000000000..49f108533404 --- /dev/null +++ b/sys-devel/llvm/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch @@ -0,0 +1,29 @@ +diff -upNr a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp +--- a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-24 03:32:31.593191000 -0400 ++++ b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-24 03:38:31.733163513 -0400 +@@ -1145,6 +1145,25 @@ Generic_GCC::GCCInstallationDetector::GC + Prefixes.push_back(D.InstalledDir + "/.."); + } + ++ llvm::OwningPtr File; ++ for (unsigned k = 0, ke = CandidateTripleAliases.size(); k < ke; ++k) { ++ if (!llvm::MemoryBuffer::getFile(D.SysRoot + "/etc/env.d/gcc/config-" + CandidateTripleAliases[k].str(), File)) ++ { ++ bool Exists; ++ const std::string VersionText = File.get()->getBuffer().rsplit('-').second.substr(0,5).str(); ++ const std::string GentooPath = D.SysRoot + "/usr/lib/gcc/" + CandidateTripleAliases[k].str() + "/" + VersionText; ++ if (!llvm::sys::fs::exists(GentooPath + "/crtbegin.o", Exists) && Exists) ++ { ++ Version = GCCVersion::Parse(VersionText); ++ GCCInstallPath = GentooPath; ++ GCCParentLibPath = GCCInstallPath + "/../../.."; ++ GCCTriple.setTriple(CandidateTripleAliases[k]); ++ IsValid = true; ++ return; ++ } ++ } ++ } ++ + // Loop over the various components which exist and select the best GCC + // installation available. GCC installs are ranked by version number. + Version = GCCVersion::Parse("0.0.0"); diff --git a/sys-devel/llvm/files/clang-3.4-darwin_build_fix.patch b/sys-devel/llvm/files/clang-3.4-darwin_build_fix.patch new file mode 100644 index 000000000000..113b04bc6637 --- /dev/null +++ b/sys-devel/llvm/files/clang-3.4-darwin_build_fix.patch @@ -0,0 +1,47 @@ +Our (gcc/binutils) toolchain doesn't do ARM targets, hence we will get +"unable to interface with target machine" errors while building if we +attempt to. Disable those targets. + +Patch by Reza Jelveh from +https://github.com/fishman/timebomb-gentoo-osx-overlay/blob/master/sys-devel/llvm/files/llvm-3.4-fix_darwin_build.patch + +--- a/projects/compiler-rt/make/platform/clang_darwin_embedded.mk ++++ b/projects/compiler-rt/make/platform/clang_darwin_embedded.mk +@@ -27,20 +27,20 @@ UniversalArchs := + # Soft-float version of the runtime. No floating-point instructions will be used + # and the ABI (out of necessity) passes floating values in normal registers: + # non-VFP variant of the AAPCS. +-Configs += soft_static +-UniversalArchs.soft_static := armv6m armv7m armv7em armv7 ++# Configs += soft_static ++# UniversalArchs.soft_static := armv6m armv7m armv7em armv7 + + # Hard-float version of the runtime. On ARM VFP instructions and registers are + # allowed, and floating point values get passed in them. VFP variant of the + # AAPCS. + Configs += hard_static +-UniversalArchs.hard_static := armv7em armv7 i386 x86_64 ++UniversalArchs.hard_static := i386 x86_64 + +-Configs += soft_pic +-UniversalArchs.soft_pic := armv6m armv7m armv7em armv7 ++# Configs += soft_pic ++# UniversalArchs.soft_pic := armv6m armv7m armv7em armv7 + + Configs += hard_pic +-UniversalArchs.hard_pic := armv7em armv7 i386 x86_64 ++UniversalArchs.hard_pic := i386 x86_64 + + CFLAGS := -Wall -Werror -Oz -fomit-frame-pointer -ffreestanding + +--- a/tools/clang/runtime/compiler-rt/Makefile ++++ b/tools/clang/runtime/compiler-rt/Makefile +@@ -85,7 +85,7 @@ RuntimeLibrary.darwin.Configs := \ + profile_osx.a profile_ios.a \ + ubsan_osx.a + RuntimeLibrary.darwin_embedded.Configs := \ +- soft_static.a hard_static.a soft_pic.a hard_pic.a ++ hard_static.a hard_pic.a + + # Support building compiler-rt with relocatable SDKs. + # diff --git a/sys-devel/llvm/files/clang-3.4-gentoo-install.patch b/sys-devel/llvm/files/clang-3.4-gentoo-install.patch new file mode 100644 index 000000000000..0a1d9eb3c353 --- /dev/null +++ b/sys-devel/llvm/files/clang-3.4-gentoo-install.patch @@ -0,0 +1,80 @@ +From a12fc090b3b43fe25c7de50c09782611e3834aeb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= +Date: Sat, 14 Jun 2014 19:35:33 +0200 +Subject: [PATCH] clang gentoo fixes + +--- + tools/clang/lib/Driver/Tools.cpp | 6 +++--- + tools/clang/tools/scan-build/scan-build | 4 ++-- + tools/clang/tools/scan-view/scan-view | 2 +- + 3 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/tools/clang/lib/Driver/Tools.cpp b/tools/clang/lib/Driver/Tools.cpp +index b013eb5..dbbcacb 100644 +--- a/tools/clang/lib/Driver/Tools.cpp ++++ b/tools/clang/lib/Driver/Tools.cpp +@@ -222,7 +222,7 @@ static void addProfileRT(const ToolChain &TC, const ArgList &Args, + // libprofile_rt.so. We used to use the -l:libprofile_rt.a syntax, but that is + // not supported by old linkers. + std::string ProfileRT = +- std::string(TC.getDriver().Dir) + "/../lib/libprofile_rt.a"; ++ "-l:libprofile_rt.a"; + + CmdArgs.push_back(Args.MakeArgString(ProfileRT)); + } +@@ -5911,7 +5911,7 @@ void freebsd::Link::ConstructJob(Compilation &C, const JobAction &JA, + // forward. + if (D.IsUsingLTO(Args)) { + CmdArgs.push_back("-plugin"); +- std::string Plugin = ToolChain.getDriver().Dir + "/../lib/LLVMgold.so"; ++ std::string Plugin = ToolChain.getDriver().Dir + "/../@libdir@/LLVMgold.so"; + CmdArgs.push_back(Args.MakeArgString(Plugin)); + + // Try to pass driver level flags relevant to LTO code generation down to +@@ -6534,7 +6534,7 @@ void gnutools::Link::ConstructJob(Compilation &C, const JobAction &JA, + // forward. + if (D.IsUsingLTO(Args)) { + CmdArgs.push_back("-plugin"); +- std::string Plugin = ToolChain.getDriver().Dir + "/../lib/LLVMgold.so"; ++ std::string Plugin = ToolChain.getDriver().Dir + "/../@libdir@/LLVMgold.so"; + CmdArgs.push_back(Args.MakeArgString(Plugin)); + + // Try to pass driver level flags relevant to LTO code generation down to +diff --git a/tools/clang/tools/scan-build/scan-build b/tools/clang/tools/scan-build/scan-build +index 0f119f6..58f78d9 100755 +--- a/tools/clang/tools/scan-build/scan-build ++++ b/tools/clang/tools/scan-build/scan-build +@@ -419,7 +419,7 @@ sub CopyFiles { + + my $Dir = shift; + +- my $JS = Cwd::realpath("$RealBin/sorttable.js"); ++ my $JS = Cwd::realpath("@EPREFIX@/usr/share/llvm/sorttable.js"); + + DieDiag("Cannot find 'sorttable.js'.\n") + if (! -r $JS); +@@ -429,7 +429,7 @@ sub CopyFiles { + DieDiag("Could not copy 'sorttable.js' to '$Dir'.\n") + if (! -r "$Dir/sorttable.js"); + +- my $CSS = Cwd::realpath("$RealBin/scanview.css"); ++ my $CSS = Cwd::realpath("@EPREFIX@/usr/share/llvm/scanview.css"); + + DieDiag("Cannot find 'scanview.css'.\n") + if (! -r $CSS); +diff --git a/tools/clang/tools/scan-view/scan-view b/tools/clang/tools/scan-view/scan-view +index fb27da6..1f8ddb8 100755 +--- a/tools/clang/tools/scan-view/scan-view ++++ b/tools/clang/tools/scan-view/scan-view +@@ -54,7 +54,7 @@ def start_browser(port, options): + webbrowser.open(url) + + def run(port, options, root): +- import ScanView ++ from clang import ScanView + try: + print 'Starting scan-view at: http://%s:%d'%(options.host, + port) +-- +2.0.0 + diff --git a/sys-devel/llvm/files/llvm-3.4-gentoo-install.patch b/sys-devel/llvm/files/llvm-3.4-gentoo-install.patch new file mode 100644 index 000000000000..a2ba7dee47ed --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.4-gentoo-install.patch @@ -0,0 +1,96 @@ +From b8846d389ff5e2b768a114f752cf39788accba26 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= +Date: Mon, 19 Aug 2013 13:22:46 +0200 +Subject: [PATCH] gentoo install fixes + +--- + Makefile.config.in | 6 +++--- + Makefile.rules | 6 +++--- + tools/llvm-config/BuildVariables.inc.in | 2 ++ + tools/llvm-config/Makefile | 4 ++++ + tools/llvm-config/llvm-config.cpp | 5 +++-- + utils/FileCheck/Makefile | 2 +- + 7 files changed, 17 insertions(+), 10 deletions(-) + +diff --git a/Makefile.config.in b/Makefile.config.in +index dcca45f..e75ae2e 100644 +--- a/Makefile.config.in ++++ b/Makefile.config.in +@@ -95,10 +95,10 @@ PROJ_internal_prefix := $(prefix) + endif + + PROJ_bindir := $(PROJ_prefix)/bin +-PROJ_libdir := $(PROJ_prefix)/lib ++PROJ_libdir := $(PROJ_prefix)/$(GENTOO_LIBDIR) + PROJ_datadir := $(PROJ_prefix)/share +-PROJ_docsdir := $(PROJ_prefix)/docs/llvm +-PROJ_etcdir := $(PROJ_prefix)/etc/llvm ++PROJ_docsdir := $(PROJ_prefix)/share/doc/@PF@ ++PROJ_etcdir := @EPREFIX@/etc/llvm + PROJ_includedir := $(PROJ_prefix)/include + PROJ_infodir := $(PROJ_prefix)/info + PROJ_mandir := $(PROJ_prefix)/share/man +diff --git a/Makefile.rules b/Makefile.rules +index e53598b..217f754 100644 +--- a/Makefile.rules ++++ b/Makefile.rules +@@ -275,7 +275,7 @@ ifeq ($(ENABLE_OPTIMIZED),1) + BuildMode := Release + # Don't use -fomit-frame-pointer on Darwin or FreeBSD. + ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin Darwin DragonFly FreeBSD GNU/kFreeBSD)) +- OmitFramePointer := -fomit-frame-pointer ++ OmitFramePointer := + endif + + CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer) +diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in +index fe87afb..fd9f2c6 100644 +--- a/tools/llvm-config/BuildVariables.inc.in ++++ b/tools/llvm-config/BuildVariables.inc.in +@@ -25,3 +25,4 @@ + #define LLVM_BUILDMODE "@LLVM_BUILDMODE@" + #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@" + #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@" ++#define LLVM_LIBDIR "@LLVM_LIBDIR@" +diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile +index b20b6bf..fc56781 100644 +--- a/tools/llvm-config/Makefile ++++ b/tools/llvm-config/Makefile +@@ -55,6 +55,8 @@ $(ObjDir)/BuildVariables.inc: $(BUILDVARIABLES_SRCPATH) Makefile $(ObjDir)/.dir + >> temp.sed + $(Verb) $(ECHO) 's/@LLVM_TARGETS_BUILT@/$(subst /,\/,$(TARGETS_TO_BUILD))/' \ + >> temp.sed ++ $(Verb) $(ECHO) 's/@LLVM_LIBDIR@/$(subst /,\/,$(GENTOO_LIBDIR))/' \ ++ >> temp.sed + $(Verb) $(SED) -f temp.sed < $< > $@ + $(Verb) $(RM) temp.sed + +diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp +index 3924e2e..f439c60 100644 +--- a/tools/llvm-config/llvm-config.cpp ++++ b/tools/llvm-config/llvm-config.cpp +@@ -250,7 +250,7 @@ int main(int argc, char **argv) { + ActivePrefix = CurrentExecPrefix; + ActiveIncludeDir = ActivePrefix + "/include"; + ActiveBinDir = ActivePrefix + "/bin"; +- ActiveLibDir = ActivePrefix + "/lib"; ++ ActiveLibDir = ActivePrefix + "/" LLVM_LIBDIR; + ActiveIncludeOption = "-I" + ActiveIncludeDir; + } + +diff --git a/utils/FileCheck/Makefile b/utils/FileCheck/Makefile +index 268b7bc..e7674f9 100644 +--- a/utils/FileCheck/Makefile ++++ b/utils/FileCheck/Makefile +@@ -15,7 +15,7 @@ USEDLIBS = LLVMSupport.a + TOOL_NO_EXPORTS = 1 + + # Don't install this utility +-NO_INSTALL = 1 ++#NO_INSTALL = 1 + + include $(LEVEL)/Makefile.common + +-- +1.8.4.2 + -- cgit v1.2.3-65-gdbad