From b7bb2156bad1dab466c1eb5601694863b235806c Mon Sep 17 00:00:00 2001 From: ajacoutot Date: Mon, 15 Jun 2015 06:20:48 +0000 Subject: [PATCH] Backport commit from upstream LLVM: r239046 [SPARC] Fix types of size_t, intptr_t, and ptrdiff_t on Linux. from brad (maintainer) --- devel/llvm/Makefile | 4 +- .../patch-tools_clang_lib_Basic_Targets_cpp | 72 ++++++++++++++++++- 2 files changed, 71 insertions(+), 5 deletions(-) diff --git a/devel/llvm/Makefile b/devel/llvm/Makefile index a7a917503e0..0aa8274c70a 100644 --- a/devel/llvm/Makefile +++ b/devel/llvm/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.106 2015/06/04 05:58:43 ajacoutot Exp $ +# $OpenBSD: Makefile,v 1.107 2015/06/15 06:20:48 ajacoutot Exp $ # XXX: Remember to bump MODCLANG_VERSION in lang/clang/clang.port.mk when # updating this port. @@ -10,7 +10,7 @@ COMMENT = modular, fast C/C++/ObjC compiler, static analyzer and tools LLVM_V = 3.5 DISTNAME = llvm-${LLVM_V}.20140228 -REVISION = 33 +REVISION = 34 CATEGORIES = devel MASTER_SITES = http://comstyle.com/source/ EXTRACT_SUFX = .tar.xz diff --git a/devel/llvm/patches/patch-tools_clang_lib_Basic_Targets_cpp b/devel/llvm/patches/patch-tools_clang_lib_Basic_Targets_cpp index 9cad33a1fd5..3082262767a 100644 --- a/devel/llvm/patches/patch-tools_clang_lib_Basic_Targets_cpp +++ b/devel/llvm/patches/patch-tools_clang_lib_Basic_Targets_cpp @@ -1,12 +1,19 @@ -$OpenBSD: patch-tools_clang_lib_Basic_Targets_cpp,v 1.12 2015/05/21 05:37:50 ajacoutot Exp $ +$OpenBSD: patch-tools_clang_lib_Basic_Targets_cpp,v 1.13 2015/06/15 06:20:48 ajacoutot Exp $ r236179 Propagate a terrible hack to the sparc target feature handling code by erasing the soft-float target feature if the rest of the front end added it because of defaults or the soft float option. ---- tools/clang/lib/Basic/Targets.cpp.orig Wed May 20 14:30:32 2015 -+++ tools/clang/lib/Basic/Targets.cpp Wed May 20 14:38:08 2015 +r239046 +[SPARC] Fix types of size_t, intptr_t, and ptrdiff_t on Linux. + +They should be 'int' instead of 'long int' everywhere else except +NetBSD too, from what I gather in GCC's spec files. So, optimistically +changing it for everyone else, too. + +--- tools/clang/lib/Basic/Targets.cpp.orig Sun Mar 2 22:03:40 2014 ++++ tools/clang/lib/Basic/Targets.cpp Fri Jun 5 00:55:44 2015 @@ -4477,9 +4477,12 @@ class SparcTargetInfo : public TargetInfo { (public) virtual bool handleTargetFeatures(std::vector &Features, DiagnosticsEngine &Diags) { @@ -23,3 +30,62 @@ end added it because of defaults or the soft float option. return true; } virtual void getTargetDefines(const LangOptions &Opts, +@@ -4579,6 +4582,20 @@ class SparcV8TargetInfo : public SparcTargetInfo { + public: + SparcV8TargetInfo(const llvm::Triple &Triple) : SparcTargetInfo(Triple) { + DescriptionString = "E-m:e-p:32:32-i64:64-f128:64-n32-S64"; ++ // NetBSD / OpenBSD use long (same as llvm default); everyone else uses int. ++ switch (getTriple().getOS()) { ++ default: ++ SizeType = UnsignedInt; ++ IntPtrType = SignedInt; ++ PtrDiffType = SignedInt; ++ break; ++ case llvm::Triple::NetBSD: ++ case llvm::Triple::OpenBSD: ++ SizeType = UnsignedLong; ++ IntPtrType = SignedLong; ++ PtrDiffType = SignedLong; ++ break; ++ } + } + + virtual void getTargetDefines(const LangOptions &Opts, +@@ -4650,25 +4667,6 @@ class SparcV9TargetInfo : public SparcTargetInfo { (pu + } // end anonymous namespace. + + namespace { +-class AuroraUXSparcV8TargetInfo : public AuroraUXTargetInfo { +-public: +- AuroraUXSparcV8TargetInfo(const llvm::Triple &Triple) +- : AuroraUXTargetInfo(Triple) { +- SizeType = UnsignedInt; +- PtrDiffType = SignedInt; +- } +-}; +-class SolarisSparcV8TargetInfo : public SolarisTargetInfo { +-public: +- SolarisSparcV8TargetInfo(const llvm::Triple &Triple) +- : SolarisTargetInfo(Triple) { +- SizeType = UnsignedInt; +- PtrDiffType = SignedInt; +- } +-}; +-} // end anonymous namespace. +- +-namespace { + class SystemZTargetInfo : public TargetInfo { + static const char *const GCCRegNames[]; + +@@ -5812,9 +5810,9 @@ static TargetInfo *AllocateTarget(const llvm::Triple & + case llvm::Triple::Linux: + return new LinuxTargetInfo(Triple); + case llvm::Triple::AuroraUX: +- return new AuroraUXSparcV8TargetInfo(Triple); ++ return new AuroraUXTargetInfo(Triple); + case llvm::Triple::Solaris: +- return new SolarisSparcV8TargetInfo(Triple); ++ return new SolarisTargetInfo(Triple); + case llvm::Triple::NetBSD: + return new NetBSDTargetInfo(Triple); + case llvm::Triple::OpenBSD: