update to 3.3, add compiler-rt and lldb

- update to 3.3
- enable compiler-rt compilation, enables ASAN
- add lldb sources (LLVM debugger)
- clean up documentation
- remove patches applied upstream
- remove unused patches and snapshot scripts
- place all documentation files in %install (%files seems to have some
  limit on number of files matched by * wildcard)
This commit is contained in:
Jan Vcelak 2013-11-12 21:48:50 +01:00
parent fe12f5f743
commit be655c46e5
17 changed files with 247 additions and 567 deletions

19
.gitignore vendored
View File

@ -1,15 +1,4 @@
/llvm-3.0.tar.gz
/clang-3.0.tar.gz
/clang-3.1.src.tar.gz
/llvm-3.1.src.tar.gz
/llvm-3.2-R600-tstellar-git-b53ed46.patch.gz
/llvm-3.2.src.tar.gz
/clang-3.2.src.tar.gz
/R600-Mesa-9.1.patch.gz
/clang-20130507.tar.xz
/compiler-rt-20130507.tar.xz
/llvm-20130507.tar.xz
/cfe-3.3rc2-source.tar.gz
/llvm-3.3rc2-source.tar.gz
/cfe-source-3.3rc3.tar.gz
/llvm-source-3.3rc3.tar.gz
/cfe-*.src.tar.gz
/compiler-rt-*.src.tar.gz
/lldb-*.src.tar.gz
/llvm-*.src.tar.gz

View File

@ -1,30 +0,0 @@
From af4d115e2c9c4cfd8b099aaef9a13c2972c36272 Mon Sep 17 00:00:00 2001
From: Tom Stellard <thomas.stellard@amd.com>
Date: Thu, 6 Dec 2012 18:05:30 +0000
Subject: [PATCH] LegalizeDAG: Allow type promotion for scalar stores
---
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index abf40b7..9946694 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -731,9 +731,10 @@ void SelectionDAGLegalize::LegalizeStoreOps(SDNode *Node) {
return;
}
case TargetLowering::Promote: {
- assert(VT.isVector() && "Unknown legal promote case!");
- Value = DAG.getNode(ISD::BITCAST, dl,
- TLI.getTypeToPromoteTo(ISD::STORE, VT), Value);
+ EVT NVT = TLI.getTypeToPromoteTo(ISD::STORE, VT);
+ assert(NVT.getSizeInBits() == VT.getSizeInBits() &&
+ "Can only promote stores to same size type");
+ Value = DAG.getNode(ISD::BITCAST, dl, NVT, Value);
SDValue Result =
DAG.getStore(Chain, dl, Value, Ptr,
ST->getPointerInfo(), isVolatile,
--
1.7.11.4

View File

@ -0,0 +1,22 @@
Preserve timestamps when installing data files
---
Makefile.rules | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.rules b/Makefile.rules
index f0c542b..0ff92bb 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -773,7 +773,7 @@ BCCompile.CXX = $(LLVMCXX) $(CPP.Flags) $(CXX.Flags) $(CXXFLAGS) $(CPPFLAGS) \
ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755
ScriptInstall = $(INSTALL) -m 0755
-DataInstall = $(INSTALL) -m 0644
+DataInstall = $(INSTALL) -p -m 0644
# When compiling under Mingw/Cygwin, the tblgen tool expects Windows
# paths. In this case, the SYSPATH function (defined in
--
1.8.3.1

View File

@ -1,29 +0,0 @@
From 831cdb83e03319eeb36b6249e20e2908672397c2 Mon Sep 17 00:00:00 2001
From: Tom Stellard <thomas.stellard@amd.com>
Date: Thu, 6 Dec 2012 22:43:13 +0000
Subject: [PATCH] LegalizeDAG: Allow promotion of scalar loads
---
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 9946694..2596f00 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -890,10 +890,9 @@ void SelectionDAGLegalize::LegalizeLoadOps(SDNode *Node) {
break;
}
case TargetLowering::Promote: {
- // Only promote a load of vector type to another.
- assert(VT.isVector() && "Cannot promote this load!");
- // Change base type to a different vector type.
EVT NVT = TLI.getTypeToPromoteTo(Node->getOpcode(), VT);
+ assert(NVT.getSizeInBits() == VT.getSizeInBits() &&
+ "Can only promote loads to same size type");
SDValue Res = DAG.getLoad(NVT, dl, Chain, Ptr, LD->getPointerInfo(),
LD->isVolatile(), LD->isNonTemporal(),
--
1.7.11.4

View File

@ -0,0 +1,22 @@
Hack the linker flags for shared libs for speed and memory usage
---
tools/llvm-shlib/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/llvm-shlib/Makefile b/tools/llvm-shlib/Makefile
index 6d6c6e9..4038df4 100644
--- a/tools/llvm-shlib/Makefile
+++ b/tools/llvm-shlib/Makefile
@@ -76,7 +76,7 @@ endif
ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux GNU))
# Don't allow unresolved symbols.
- LLVMLibsOptions += -Wl,--no-undefined
+ LLVMLibsOptions += -Wl,--no-undefined -Wl,-Bsymbolic
endif
ifeq ($(HOST_OS),SunOS)
--
1.8.3.1

View File

@ -1,53 +0,0 @@
From 85259e7305201764ae9d85a7cbf2809da779bf5c Mon Sep 17 00:00:00 2001
From: tstellar <tstellar@91177308-0d34-0410-b5e6-96231b3b80d8>
Date: Wed, 2 Jan 2013 22:13:01 +0000
Subject: [PATCH] DAGCombiner: Avoid generating illegal vector INT_TO_FP nodes
DAGCombiner::reduceBuildVecConvertToConvertBuildVec() was making two
mistakes:
1. It was checking the legality of scalar INT_TO_FP nodes and then generating
vector nodes.
2. It was passing the result value type to
TargetLoweringInfo::getOperationAction() when it should have been
passing the value type of the first operand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171420 91177308-0d34-0410-b5e6-96231b3b80d8
---
lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 9 +++---
.../R600/dagcombiner-bug-illegal-vec4-int-to-fp.ll | 33 ++++++++++++++++++++++
test/CodeGen/R600/vec4-expand.ll | 3 --
test/CodeGen/X86/cvtv2f32.ll | 4 +++
4 files changed, 42 insertions(+), 7 deletions(-)
create mode 100644 test/CodeGen/R600/dagcombiner-bug-illegal-vec4-int-to-fp.ll
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 37d7731..d0ca5c0 100644
--- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -8514,11 +8514,8 @@ SDValue DAGCombiner::reduceBuildVecConvertToConvertBuildVec(SDNode *N) {
if (Opcode == ISD::DELETED_NODE &&
(Opc == ISD::UINT_TO_FP || Opc == ISD::SINT_TO_FP)) {
Opcode = Opc;
- // If not supported by target, bail out.
- if (TLI.getOperationAction(Opcode, VT) != TargetLowering::Legal &&
- TLI.getOperationAction(Opcode, VT) != TargetLowering::Custom)
- return SDValue();
}
+
if (Opc != Opcode)
return SDValue();
@@ -8543,6 +8540,10 @@ SDValue DAGCombiner::reduceBuildVecConvertToConvertBuildVec(SDNode *N) {
assert(SrcVT != MVT::Other && "Cannot determine source type!");
EVT NVT = EVT::getVectorVT(*DAG.getContext(), SrcVT, NumInScalars);
+
+ if (!TLI.isOperationLegalOrCustom(Opcode, NVT))
+ return SDValue();
+
SmallVector<SDValue, 8> Opnds;
for (unsigned i = 0; i != NumInScalars; ++i) {
SDValue In = N->getOperand(i);

View File

@ -1,13 +0,0 @@
--- llvm-3.2.src.orig/tools/clang/lib/Driver/Tools.cpp 2012-11-21 01:56:23.000000000 -0600
+++ llvm-3.2.src/tools/clang/lib/Driver/Tools.cpp 2013-03-31 21:08:41.890206683 -0500
@@ -688,8 +688,8 @@
}
default:
// Assume "soft", but warn the user we are guessing.
- FloatABI = "soft";
- D.Diag(diag::warn_drv_assuming_mfloat_abi_is) << "soft";
+ FloatABI = "hard";
+ D.Diag(diag::warn_drv_assuming_mfloat_abi_is) << "hard";
break;
}
}

View File

@ -1,11 +0,0 @@
--- llvm-2.6/Makefile.rules.timestamp 2009-08-19 18:04:44.000000000 -0400
+++ llvm-2.6/Makefile.rules 2009-09-09 02:10:38.287389725 -0400
@@ -672,7 +672,7 @@
ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755
ScriptInstall = $(INSTALL) -m 0755
-DataInstall = $(INSTALL) -m 0644
+DataInstall = $(INSTALL) -p -m 0644
# When compiling under Mingw/Cygwin, the tblgen tool expects Windows
# paths. In this case, the SYSPATH function (defined in

View File

@ -1,28 +0,0 @@
--- llvm-3.1.src/docs/CommandGuide/lit.pod~ 2012-03-27 03:01:14.000000000 +0900
+++ llvm-3.1.src/docs/CommandGuide/lit.pod 2013-01-23 12:47:30.297510832 +0900
@@ -386,8 +386,6 @@
********************
PASS: D (4 of 4)
-=back
-
=head2 LIT EXAMPLE TESTS
The B<lit> distribution contains several example implementations of test suites
--- llvm-3.1.src/docs/CommandGuide/llvm-cov.pod~ 2011-11-29 08:39:25.000000000 +0900
+++ llvm-3.1.src/docs/CommandGuide/llvm-cov.pod 2013-01-23 13:44:32.184212441 +0900
@@ -18,12 +18,12 @@
=over
-=item B<-gcno=filename]
+=item B<-gcno=filename>
This option selects input description file generated by compiler while instrumenting
program.
-=item B<-gcda=filename]
+=item B<-gcda=filename>
This option selects coverage data file generated by instrumented compiler.

View File

@ -1,30 +0,0 @@
diff -up llvm-3.2.src/tools/llvm-config/llvm-config.cpp.jx llvm-3.2.src/tools/llvm-config/llvm-config.cpp
--- llvm-3.2.src/tools/llvm-config/llvm-config.cpp.jx 2013-03-07 07:13:24.000000000 -0500
+++ llvm-3.2.src/tools/llvm-config/llvm-config.cpp 2013-03-07 07:39:26.485677609 -0500
@@ -316,7 +316,9 @@ int main(int argc, char **argv) {
if (!HasAnyOption)
usage();
- if (PrintLibs || PrintLibNames || PrintLibFiles) {
+ if (PrintLibs) {
+ OS << "-lLLVM-3.3svn";
+ } else if (PrintLibNames || PrintLibFiles) {
// If no components were specified, default to "all".
if (Components.empty())
Components.push_back("all");
@@ -335,15 +337,6 @@ int main(int argc, char **argv) {
OS << Lib;
} else if (PrintLibFiles) {
OS << ActiveLibDir << '/' << Lib;
- } else if (PrintLibs) {
- // If this is a typical library name, include it using -l.
- if (Lib.startswith("lib") && Lib.endswith(".a")) {
- OS << "-l" << Lib.slice(3, Lib.size()-2);
- continue;
- }
-
- // Otherwise, print the full path.
- OS << ActiveLibDir << '/' << Lib;
}
}
OS << '\n';

View File

@ -1,12 +0,0 @@
diff -up llvm-3.2.src/tools/llvm-shlib/Makefile.jx llvm-3.2.src/tools/llvm-shlib/Makefile
--- llvm-3.2.src/tools/llvm-shlib/Makefile.jx 2012-08-06 16:52:18.000000000 -0400
+++ llvm-3.2.src/tools/llvm-shlib/Makefile 2013-05-01 16:55:20.286980046 -0400
@@ -76,7 +76,7 @@ endif
ifeq ($(HOST_OS), $(filter $(HOST_OS), Linux GNU))
# Don't allow unresolved symbols.
- LLVMLibsOptions += -Wl,--no-undefined
+ LLVMLibsOptions += -Wl,--no-undefined -Wl,-Bsymbolic
endif
ifeq ($(HOST_OS),SunOS)

View File

@ -1,128 +0,0 @@
Index: lib/Target/ARM/ARMFrameLowering.cpp
===================================================================
--- lib/Target/ARM/ARMFrameLowering.cpp (revision 159085)
+++ lib/Target/ARM/ARMFrameLowering.cpp (working copy)
@@ -15,6 +15,8 @@
#include "ARMBaseInstrInfo.h"
#include "ARMBaseRegisterInfo.h"
#include "ARMMachineFunctionInfo.h"
+#include "llvm/CallingConv.h"
+#include "llvm/Function.h"
#include "MCTargetDesc/ARMAddressingModes.h"
#include "llvm/Function.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
@@ -151,6 +153,10 @@
int FramePtrSpillFI = 0;
int D8SpillFI = 0;
+ // All calls are tail calls in GHC calling conv, and functions have no prologue/epilogue.
+ if (MF.getFunction()->getCallingConv() == CallingConv::GHC)
+ return;
+
// Allocate the vararg register save area. This is not counted in NumBytes.
if (VARegSaveSize)
emitSPUpdate(isARM, MBB, MBBI, dl, TII, -VARegSaveSize,
@@ -354,6 +360,10 @@
int NumBytes = (int)MFI->getStackSize();
unsigned FramePtr = RegInfo->getFrameRegister(MF);
+ // All calls are tail calls in GHC calling conv, and functions have no prologue/epilogue.
+ if (MF.getFunction()->getCallingConv() == CallingConv::GHC)
+ return;
+
if (!AFI->hasStackFrame()) {
if (NumBytes != 0)
emitSPUpdate(isARM, MBB, MBBI, dl, TII, NumBytes);
Index: lib/Target/ARM/ARMISelLowering.cpp
===================================================================
--- lib/Target/ARM/ARMISelLowering.cpp (revision 159085)
+++ lib/Target/ARM/ARMISelLowering.cpp (working copy)
@@ -1171,6 +1171,8 @@
return (Return ? RetCC_ARM_AAPCS : CC_ARM_AAPCS);
case CallingConv::ARM_APCS:
return (Return ? RetCC_ARM_APCS : CC_ARM_APCS);
+ case CallingConv::GHC:
+ return (Return ? RetCC_ARM_APCS : CC_ARM_APCS_GHC);
}
}
Index: lib/Target/ARM/ARMCallingConv.td
===================================================================
--- lib/Target/ARM/ARMCallingConv.td (revision 159085)
+++ lib/Target/ARM/ARMCallingConv.td (working copy)
@@ -79,7 +79,26 @@
CCDelegateTo<RetCC_ARM_APCS>
]>;
+//===----------------------------------------------------------------------===//
+// ARM APCS Calling Convention for GHC
+//===----------------------------------------------------------------------===//
+def CC_ARM_APCS_GHC : CallingConv<[
+ // Handle all vector types as either f64 or v2f64.
+ CCIfType<[v1i64, v2i32, v4i16, v8i8, v2f32], CCBitConvertToType<f64>>,
+ CCIfType<[v2i64, v4i32, v8i16, v16i8, v4f32], CCBitConvertToType<v2f64>>,
+
+ CCIfType<[v2f64], CCAssignToReg<[Q4, Q5]>>,
+ CCIfType<[f64], CCAssignToReg<[D8, D9, D10, D11]>>,
+ CCIfType<[f32], CCAssignToReg<[S16, S17, S18, S19, S20, S21, S22, S23]>>,
+
+ // Promote i8/i16 arguments to i32.
+ CCIfType<[i8, i16], CCPromoteToType<i32>>,
+
+ // Pass in STG registers: Base, Sp, Hp, R1, R2, R3, R4, SpLim
+ CCIfType<[i32], CCAssignToReg<[R4, R5, R6, R7, R8, R9, R10, R11]>>
+]>;
+
//===----------------------------------------------------------------------===//
// ARM AAPCS (EABI) Calling Convention, common parts
//===----------------------------------------------------------------------===//
@@ -171,3 +190,9 @@
// iOS ABI deviates from ARM standard ABI. R9 is not a callee-saved register.
// Also save R7-R4 first to match the stack frame fixed spill areas.
def CSR_iOS : CalleeSavedRegs<(add LR, R7, R6, R5, R4, (sub CSR_AAPCS, R9))>;
+
+// GHC set of callee saved regs is empty as all those regs are
+// used for passing STG regs around
+// sub/add LR is a workaround for not being able to compile empty list:
+// def CSR_GHC : CalleeSavedRegs<()>;
+def CSR_GHC : CalleeSavedRegs<(sub (add LR), LR)>;
Index: lib/Target/ARM/ARMFastISel.cpp
===================================================================
--- lib/Target/ARM/ARMFastISel.cpp (revision 159085)
+++ lib/Target/ARM/ARMFastISel.cpp (working copy)
@@ -1835,6 +1835,11 @@
return (Return ? RetCC_ARM_AAPCS: CC_ARM_AAPCS);
case CallingConv::ARM_APCS:
return (Return ? RetCC_ARM_APCS: CC_ARM_APCS);
+ case CallingConv::GHC:
+ if (Return)
+ llvm_unreachable("Can't return in GHC call convention");
+ else
+ return CC_ARM_APCS_GHC;
}
}
--- lib/Target/ARM/ARMBaseRegisterInfo.cpp.orig 2012-07-12 09:59:58.181723592 +0100
+++ lib/Target/ARM/ARMBaseRegisterInfo.cpp 2012-07-12 10:01:15.301344412 +0100
@@ -62,7 +62,19 @@
const uint16_t*
ARMBaseRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
- return (STI.isTargetIOS()) ? CSR_iOS_SaveList : CSR_AAPCS_SaveList;
+ bool ghcCall = false;
+
+ if (MF) {
+ const Function *F = MF->getFunction();
+ ghcCall = (F ? F->getCallingConv() == CallingConv::GHC : false);
+ }
+
+ if (ghcCall) {
+ return CSR_GHC_SaveList;
+ }
+ else {
+ return (STI.isTargetIOS()) ? CSR_iOS_SaveList : CSR_AAPCS_SaveList;
+ }
}
const uint32_t*

356
llvm.spec
View File

@ -1,87 +1,57 @@
# Build options:
#
# --with doxygen
# The doxygen docs are HUGE, so they are not built by default.
# Components skipped by default:
%bcond_with doxygen
# clang header paths are hard-coded at compile time
# and need adjustment whenever there's a new GCC version
%if 0%{?fedora} == 18
%global gcc_version 4.7.2
%else
%global gcc_version 4.8.2
%endif
%ifarch s390 s390x sparc64
# No ocaml on these arches
%bcond_with ocaml
%else
%bcond_without ocaml
%endif
# compiler-rt not actually working yet
%bcond_with crt
# Components built by default:
%bcond_without clang
%bcond_without crt
%bcond_without lldb
%global prerel rc3
%global downloadurl http://llvm.org/%{?prerel:pre-}releases/%{version}%{?prerel:/%{prerel}}
%global gitdate 20130507
# gold linker support
# arch list from binutils spec
%global gold_arches %ix86 x86_64
%ifarch %gold_arches
%bcond_without gold
# Components enabled if supported by target arch:
%ifnarch s390 s390x sparc64
%bcond_without ocaml
%else
%bcond_with gold
%bcond_with ocaml
%endif
%ifarch %ix86 x86_64
%bcond_without gold
%else
%bcond_with gold
%endif
# Documentation install path
%if 0%{fedora} < 20
%global llvmdocdir() %{_docdir}/%1-%{version}
%else
%global llvmdocdir() %{_docdir}/%1
%endif
%global downloadurl http://llvm.org/releases/%{version}
Name: llvm
Version: 3.3
Release: 0.10.%{prerel}%{?dist}
Release: 1%{?dist}
Summary: The Low Level Virtual Machine
Group: Development/Languages
License: NCSA
URL: http://llvm.org/
Source0: %{downloadurl}/llvm-source-%{version}%{?prerel:%{prerel}}.tar.gz
Source1: %{downloadurl}/cfe-source-%{version}%{?prerel:%{prerel}}.tar.gz
#Source0: llvm-%{gitdate}.tar.xz
#Source1: clang-%{gitdate}.tar.xz
Source2: compiler-rt-%{gitdate}.tar.xz
# source archives
Source0: %{downloadurl}/llvm-%{version}.src.tar.gz
Source1: %{downloadurl}/cfe-%{version}.src.tar.gz
Source2: %{downloadurl}/compiler-rt-%{version}.src.tar.gz
Source3: %{downloadurl}/lldb-%{version}.src.tar.gz
# multilib fixes
Source10: llvm-Config-config.h
Source11: llvm-Config-llvm-config.h
Source10: llvm-Config-config.h
Source11: llvm-Config-llvm-config.h
# snapshot scripts
Source100: make-llvm-snapshot.sh
Source101: make-clang-snapshot.sh
Source102: make-compiler-rt-snapshot.sh
# Data files should be installed with timestamps preserved
Patch0: llvm-2.6-timestamp.patch
Patch11: clang-hardfloat-hack.patch
# hack llvm-config to print -lLLVM-3.* instead of ALL THE THINGS
#
# you really, really, really want not to use the static libs, otherwise
# if you ever end up with two (static) copies of llvm in the same process
# things will go boom quite nicely
#
# this isn't enabled yet because it makes the ocaml bindings fail the
# test suite. i don't even.
Patch20: llvm-3.2-llvm-config-dso-hack.patch
# hack the link flags for the shared libs for speed and memory usage
Patch21: llvm-3.2-symbolic-shlib.patch
# patches
Patch1: 0001-data-install-preserve-timestamps.patch
Patch2: 0002-linker-flags-speedup-memory.patch
BuildRequires: bison
BuildRequires: chrpath
BuildRequires: flex
BuildRequires: gcc = %{gcc_version}
BuildRequires: gcc-c++ = %{gcc_version}
BuildRequires: groff
BuildRequires: libffi-devel
BuildRequires: libtool-ltdl-devel
@ -130,8 +100,7 @@ Summary: Documentation for LLVM
Group: Documentation
BuildArch: noarch
Requires: %{name} = %{version}-%{release}
# might seem redundant, but needed to kill off the old arch-ed -doc
# subpackage
# might seem redundant, but needed to kill off the old arch-ed -doc subpackage
Obsoletes: %{name}-doc < %{version}-%{release}
%description doc
@ -163,8 +132,7 @@ License: NCSA
Group: Development/Languages
Requires: llvm%{?_isa} = %{version}-%{release}
# clang requires gcc, clang++ requires libstdc++-devel
Requires: gcc = %{gcc_version}
Requires: libstdc++-devel = %{gcc_version}
Requires: libstdc++-devel
%description -n clang
clang: noun
@ -201,17 +169,24 @@ framework and a standalone tool that finds bugs in C and Objective-C
programs. The standalone tool is invoked from the command-line, and is
intended to run in tandem with a build of a project or code base.
%package -n clang-doc
Summary: Documentation for Clang
Group: Documentation
BuildArch: noarch
Requires: %{name} = %{version}-%{release}
%description -n clang-doc
Documentation for the Clang compiler front-end.
%endif
%if %{with lldb}
%package -n lldb
Summary: Next generation high-performance debugger
License: NCSA
Group: Development/Languages
Requires: llvm%{?_isa} = %{version}-%{release}
BuildRequires: swig
BuildRequires: libedit-devel
BuildRequires: python-devel
%description -n lldb
LLDB is a next generation, high-performance debugger. It is built as a set
of reusable components which highly leverage existing libraries in the
larger LLVM Project, such as the Clang expression parser and LLVM
disassembler.
%endif
%if %{with doxygen}
%package apidoc
@ -274,40 +249,68 @@ HTML documentation for LLVM's OCaml binding.
%prep
#setup -q -n llvm-%{version}%{?prerel}.src %{?with_clang:-a1} %{?with_crt:-a2}
%setup -q -n llvm.src %{?with_clang:-a1} %{?with_crt:-a2}
rm -f tools/clang
%setup -q -n llvm-%{version}.src %{?with_clang:-a1} %{?with_crt:-a2} %{?with_lldb:-a3}
rm -rf tools/clang tools/lldb projects/compiler-rt
%if %{with clang}
mv cfe.src tools/clang
mv cfe-%{version}.src tools/clang
%endif
%if %{with crt}
mv compiler-rt-%{version}.src projects/compiler-rt
%endif
%if %{with lldb}
mv lldb-%{version}.src tools/lldb
%endif
# llvm patches
%patch0 -p1 -b .timestamp
# arm hard float
%patch11 -p1 -b .orig
# fix llvm-config --libs
#patch20 -p1 -b .orig
%patch21 -p1 -b .orig
%patch1 -p1
%patch2 -p1
# fix ld search path
sed -i 's|/lib /usr/lib $lt_ld_extra|%{_libdir} $lt_ld_extra|' \
./configure
sed -i 's|/lib /usr/lib $lt_ld_extra|%{_libdir} $lt_ld_extra|' ./configure
%build
# clang is lovely and all, but fedora builds with gcc
export CC=gcc
export CXX=c++
%configure \
--prefix=%{_prefix} \
--libdir=%{_libdir}/%{name} \
--disable-polly \
--disable-libcpp \
--enable-cxx11 \
--enable-clang-arcmt \
--enable-clang-static-analyzer \
--enable-clang-rewriter \
--enable-optimized \
--disable-profiling \
--disable-assertions \
--disable-werror \
--disable-expensive-checks \
--enable-debug-runtime \
--enable-keep-symbols \
--enable-jit \
--enable-docs \
%if %{with doxygen}
--enable-doxygen \
%else
--disable-doxygen \
%endif
%if %{with gold}
--with-binutils-include=%{_includedir} \
--enable-threads \
--enable-pthreads \
--enable-zlib \
--enable-pic \
--enable-shared \
--disable-embed-stdcxx \
--enable-timestamps \
--enable-backtraces \
--enable-targets=x86,powerpc,arm,aarch64,cpp,nvptx,systemz \
--enable-experimental-targets=R600 \
%if %{with ocaml}
--enable-bindings=ocaml \
%else
--enable-bindings=none \
%endif
--enable-libffi \
--enable-ltdl-install \
\
%ifarch armv7hl armv7l
--with-cpu=cortex-a8 \
--with-tune=cortex-a8 \
@ -316,15 +319,12 @@ export CXX=c++
--with-fpu=vfpv3-d16 \
--with-abi=aapcs-linux \
%endif
--disable-assertions \
--enable-debug-runtime \
--enable-optimized \
--enable-jit \
--enable-libffi \
--enable-shared \
--with-c-include-dirs=%{_includedir}:$(echo %{_prefix}/lib/gcc/%{_target_cpu}*/%{gcc_version}/include) \
--enable-targets=x86,powerpc,arm,aarch64,cpp,nvptx,systemz \
--enable-experimental-targets=R600
\
%if %{with gold}
--with-binutils-include=%{_includedir} \
%endif
--with-c-include-dirs=%{_includedir}:$(echo %{_prefix}/lib/gcc/%{_target_cpu}*/*/include) \
--with-optimize-option=-O3
# FIXME file this
# configure does not properly specify libdir
@ -332,7 +332,7 @@ sed -i 's|(PROJ_prefix)/lib|(PROJ_prefix)/%{_lib}/%{name}|g' Makefile.config
# FIXME upstream need to fix this
# llvm-config.cpp hardcodes lib in it
sed -i 's|ActiveLibDir = ActivePrefix + "/lib"|ActiveLibDir = ActivePrefix + "/%{_lib}/%{name}"|g' tools/llvm-config/llvm-config.cpp
sed -i 's|/lib\>|/%{_lib}/%{name}|g' tools/llvm-config/llvm-config.cpp
make %{_smp_mflags} REQUIRES_RTTI=1 VERBOSE=1 \
%ifarch ppc
@ -343,13 +343,7 @@ make %{_smp_mflags} REQUIRES_RTTI=1 VERBOSE=1 \
%install
# workaround for http://llvm.org/bugs/show_bug.cgi?id=11177
%if %{with ocaml}
cp -p bindings/ocaml/llvm/META.llvm bindings/ocaml/llvm/Release/
%endif
make install DESTDIR=%{buildroot} \
PROJ_docsdir=/moredocs
make install DESTDIR=%{buildroot} PROJ_docsdir=/moredocs
# multilib fixes
mv %{buildroot}%{_bindir}/llvm-config{,-%{__isa_bits}}
@ -376,50 +370,69 @@ for f in scan-{build,view}; do
ln -s %{_libdir}/clang-analyzer/$f/$f %{buildroot}%{_bindir}/$f
done
(cd tools/clang/tools && cp -pr scan-{build,view} \
%{buildroot}%{_libdir}/clang-analyzer/)
(cd tools/clang/tools && cp -pr scan-{build,view} %{buildroot}%{_libdir}/clang-analyzer/)
%endif
# Move documentation back to build directory
#
mv %{buildroot}/moredocs .
rm -f moredocs/*.tar.gz
rm -f moredocs/ocamldoc/html/*.tar.gz
# and separate the apidoc
%if %{with doxygen}
mv moredocs/html/doxygen apidoc
mv tools/clang/docs/doxygen/html clang-apidoc
%endif
# And prepare Clang documentation
#
%if %{with clang}
mkdir clang-docs
for f in LICENSE.TXT NOTES.txt README.txt; do # TODO.txt; do
ln tools/clang/$f clang-docs/
done
rm -rf tools/clang/docs/{doxygen*,Makefile*,*.graffle,tools}
%endif
#find %%{buildroot} -name .dir -print0 | xargs -0r rm -f
file %{buildroot}/%{_bindir}/* | awk -F: '$2~/ELF/{print $1}' | xargs -r chrpath -d
file %{buildroot}/%{_libdir}/llvm/*.so | awk -F: '$2~/ELF/{print $1}' | xargs -r chrpath -d
#chrpath -d %%{buildroot}/%%{_libexecdir}/clang-cc
# Get rid of erroneously installed example files.
rm %{buildroot}%{_libdir}/%{name}/*LLVMHello.*
# FIXME file this bug
sed -i 's,ABS_RUN_DIR/lib",ABS_RUN_DIR/%{_lib}/%{name}",' \
%{buildroot}%{_bindir}/llvm-config-%{__isa_bits}
# remove executable bit from static libraries
find %{buildroot}%{_libdir} -name "*.a" -type f -print0 | xargs -0 chmod -x
chmod -x %{buildroot}%{_libdir}/%{name}/*.a
# Install man page for LLDB
%if %{with lldb}
mkdir -p %{buildroot}%{_mandir}/man1
cp tools/lldb/docs/lldb.1 %{buildroot}%{_mandir}/man1/
%endif
# remove documentation makefiles:
# they require the build directory to work
find examples -name 'Makefile' | xargs -0r rm -f
# Install documentation documentation
find %{buildroot}/moredocs/ -name "*.tar.gz" -print0 | xargs -0 rm -rf
mkdir -p %{buildroot}%{_docdir}
# llvm
mkdir -p %{buildroot}%{llvmdocdir llvm}
for f in CREDITS.TXT LICENSE.TXT README.txt; do
cp $f %{buildroot}%{llvmdocdir llvm}
done
# llvm-doc
mkdir -p %{buildroot}%{llvmdocdir llvm-doc}
cp -ar examples %{buildroot}%{llvmdocdir llvm-doc}/examples
find %{buildroot}%{llvmdocdir llvm-doc} -name Makefile -o -name CMakeLists.txt -o -name LLVMBuild.txt -print0 | xargs -0 rm -f
# llvm-apidoc
%if %{with doxygen}
mv %{buildroot}/moredocs/html/doxygen %{buildroot}%{llvmdocdir llvm-apidoc}
%endif
# llvm-ocaml-doc
%if %{with ocaml}
mv %{buildroot}/moredocs/ocamldoc/html %{buildroot}%{llvmdocdir llvm-ocaml-doc}
%endif
# clang
%if %{with clang}
mkdir -p %{buildroot}%{llvmdocdir clang}
for f in LICENSE.TXT NOTES.txt README.txt CODE_OWNERS.TXT; do
cp tools/clang/$f %{buildroot}%{llvmdocdir clang}/
done
%endif
# clang-apidoc
%if %{with clang}
%if %{with doxygen}
cp -ar tools/clang/docs/doxygen/html %{buildroot}%{llvmdocdir clang-apidoc}
%endif
%endif
# lldb
%if %{with lldb}
mkdir -p %{buildroot}%{llvmdocdir lldb}
cp tools/lldb/LICENSE.TXT %{buildroot}%{llvmdocdir lldb}/
%endif
# delete the rest of installed documentation (because it's bad)
rm -rf %{buildroot}/moredocs
%check
@ -430,14 +443,16 @@ find examples -name 'Makefile' | xargs -0r rm -f
# broken makefiles in the doc dirs.
# LLVM test suite failing on ARM, PPC64 and s390(x)
make -k check LIT_ARGS="-v -j4" | tee llvm-testlog-%{_arch}.txt || :
mkdir -p %{buildroot}%{llvmdocdir llvm-devel}
make -k check LIT_ARGS="-v -j4" | tee %{buildroot}%{llvmdocdir llvm-devel}/testlog-%{_arch}.txt || :
%if %{with clang}
# clang test suite failing on PPC and s390(x)
# FIXME:
# unexpected failures on all platforms with GCC 4.7.0.
# capture logs
make -C tools/clang/test TESTARGS="-v -j4" | tee clang-testlog-%{_arch}.txt || :
mkdir -p %{buildroot}%{llvmdocdir clang-devel}
make -C tools/clang/test TESTARGS="-v -j4" | tee %{buildroot}%{llvmdocdir clang-devel}/testlog-%{_arch}.txt || :
%endif
@ -475,7 +490,7 @@ exit 0
%files
%defattr(-,root,root,-)
%doc CREDITS.TXT LICENSE.TXT README.txt
%doc %{llvmdocdir llvm}/
%{_bindir}/bugpoint
%{_bindir}/llc
%{_bindir}/lli
@ -486,11 +501,14 @@ exit 0
%if %{with clang}
%exclude %{_mandir}/man1/clang.1.*
%endif
%if %{with lldb}
%exclude %{_mandir}/man1/lldb.1.*
%endif
%doc %{_mandir}/man1/*.1.*
%files devel
%defattr(-,root,root,-)
%doc llvm-testlog-%{_arch}.txt
%doc %{llvmdocdir llvm-devel}/
%{_bindir}/llvm-config-%{__isa_bits}
%{_includedir}/%{name}
%{_includedir}/%{name}-c
@ -502,6 +520,9 @@ exit 0
%if %{with clang}
%exclude %{_libdir}/%{name}/libclang.so
%endif
%if %{with lldb}
%exclude %{_libdir}/%{name}/liblldb.so
%endif
%{_libdir}/%{name}/*.so
%files static
@ -511,7 +532,7 @@ exit 0
%if %{with clang}
%files -n clang
%defattr(-,root,root,-)
%doc clang-docs/* clang-testlog-%{_arch}.txt
%doc %{llvmdocdir clang}/
%{_bindir}/clang*
%{_bindir}/c-index-test
%{_libdir}/%{name}/libclang.so
@ -520,6 +541,7 @@ exit 0
%files -n clang-devel
%defattr(-,root,root,-)
%doc %{llvmdocdir clang-devel}/
%{_includedir}/clang
%{_includedir}/clang-c
@ -528,15 +550,21 @@ exit 0
%{_bindir}/scan-build
%{_bindir}/scan-view
%{_libdir}/clang-analyzer
%endif
%files -n clang-doc
%if %{with lldb}
%files -n lldb
%defattr(-,root,root,-)
%doc tools/clang/docs/*
%doc %{llvmdocdir lldb}/
%{_bindir}/lldb
%{_bindir}/lldb-platform
%{_libdir}/%{name}/liblldb.so
%doc %{_mandir}/man1/lldb.1.*
%endif
%files doc
%defattr(-,root,root,-)
%doc examples moredocs/html
%doc %{llvmdocdir llvm-doc}/
%if %{with ocaml}
%files ocaml
@ -553,22 +581,28 @@ exit 0
%files ocaml-doc
%defattr(-,root,root,-)
%doc moredocs/ocamldoc/html/*
%doc %{llvmdocdir llvm-ocaml-doc}/
%endif
%if %{with doxygen}
%files apidoc
%defattr(-,root,root,-)
%doc apidoc/*
%doc %{llvmdocdir llvm-apidoc}/
%if %{with clang}
%files -n clang-apidoc
%defattr(-,root,root,-)
%doc clang-apidoc/*
%doc %{llvmdocdir clang-apidoc}/
%endif
%endif
%changelog
* Tue Nov 12 2013 Jan Vcelak <jvcelak@fedoraproject.org> 3.3-1
- upgrade to 3.3 release
- add compiler-rt, enables address sanitizer (#949489)
- add LLDB - debugger from LLVM project (#1009406)
- clean up documentation
* Thu Oct 17 2013 Jakub Jelinek <jakub@redhat.com> - 3.3-0.10.rc3
- Rebuild for gcc 4.8.2

View File

@ -1,18 +0,0 @@
#!/bin/sh
DIRNAME=clang-$( date +%Y%m%d )
URL=http://llvm.org/git/clang.git
rm -rf $DIRNAME
git clone $URL $DIRNAME
cd $DIRNAME
if [ -z "$1" ]; then
git log | head -1
else
git checkout $1
fi
git log | head -1 | awk '{ print $2 }' > ../commitid
rm -rf .git
cd ..
tar cf - $DIRNAME | xz -c9 > $DIRNAME.tar.xz
rm -rf $DIRNAME

View File

@ -1,18 +0,0 @@
#!/bin/sh
DIRNAME=compiler-rt-$( date +%Y%m%d )
URL=http://llvm.org/git/compiler-rt.git
rm -rf $DIRNAME
git clone $URL $DIRNAME
cd $DIRNAME
if [ -z "$1" ]; then
git log | head -1
else
git checkout $1
fi
git log | head -1 | awk '{ print $2 }' > ../commitid
rm -rf .git
cd ..
tar cf - $DIRNAME | xz -c9 > $DIRNAME.tar.xz
rm -rf $DIRNAME

View File

@ -1,18 +0,0 @@
#!/bin/sh
DIRNAME=llvm-$( date +%Y%m%d )
URL=http://llvm.org/git/llvm.git
rm -rf $DIRNAME
git clone $URL $DIRNAME
cd $DIRNAME
if [ -z "$1" ]; then
git log | head -1
else
git checkout $1
fi
git log | head -1 | awk '{ print $2 }' > ../commitid
rm -rf .git
cd ..
tar cf - $DIRNAME | xz -c9 > $DIRNAME.tar.xz
rm -rf $DIRNAME

View File

@ -1,3 +1,4 @@
f113764a80fc87ad2b5898b156fa8f4b compiler-rt-20130507.tar.xz
35d7fc075fb92d1640cfc58e2116635b cfe-source-3.3rc3.tar.gz
98909ddc9016f2c6e9021202499f4dae llvm-source-3.3rc3.tar.gz
8284891e3e311829b8e44ac813d0c9ef cfe-3.3.src.tar.gz
9c129ce24514467cfe492cf2fed8e2c4 compiler-rt-3.3.src.tar.gz
c583c80c25e56a41e3e5ae7c2f442929 lldb-3.3.src.tar.gz
40564e1dc390f9844f1711c08b08e391 llvm-3.3.src.tar.gz