On Tue, Aug 21, 2012 at 02:48:59PM -0400, Brian Callahan wrote: > I noticed that devel/llvm now has target support for mips64 and > mips64el. The following patch is needed for those two archs. LLVM > builds and seems to work OK from my admittedly basic testing on > mips64el. > > Clang builds only with a newer version of gas (I used 2.22) but it > does not compile anything; it crashes when you try to compile even a > simple Hello World. I've reported it upstream but I'm unable to > follow any of their suggestions - my yeeloong cannot compile clang > with -O0 or a debug build because it runs out of memory (ulimit -d > is maxed at 1G in the kernel). > > Thanks. > > ~Brian
I'd like to get this in as a start to getting the clang Driver closer to being usable on mips64 and having LLVM being builable. Index: Makefile =================================================================== RCS file: /home/cvs/ports/devel/llvm/Makefile,v retrieving revision 1.51 diff -u -p -r1.51 Makefile --- Makefile 29 Aug 2012 00:45:47 -0000 1.51 +++ Makefile 29 Aug 2012 13:01:07 -0000 @@ -10,7 +10,7 @@ COMMENT = modular, fast C/C++/ObjC compi LLVM_V = 3.1 DISTNAME = llvm-${LLVM_V}.src PKGNAME = llvm-${LLVM_V} -REVISION = 6 +REVISION = 7 CATEGORIES = devel # packager notes in http://llvm.org/docs/Packaging.html Index: patches/patch-lib_Support_Memory_cpp =================================================================== RCS file: patches/patch-lib_Support_Memory_cpp diff -N patches/patch-lib_Support_Memory_cpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-lib_Support_Memory_cpp 23 Aug 2012 05:40:43 -0000 @@ -0,0 +1,16 @@ +$OpenBSD$ +--- lib/Support/Memory.cpp.orig Thu Aug 23 01:39:02 2012 ++++ lib/Support/Memory.cpp Thu Aug 23 01:40:14 2012 +@@ -17,7 +17,11 @@ + #include "llvm/Config/config.h" + + #if defined(__mips__) +-#include <sys/cachectl.h> ++# if defined(__OpenBSD__) ++# include <mips64/sysarch.h> ++# else ++# include <sys/cachectl.h> ++# endif + #endif + + namespace llvm { Index: patches/patch-tools_clang_lib_Basic_Targets_cpp =================================================================== RCS file: /home/cvs/ports/devel/llvm/patches/patch-tools_clang_lib_Basic_Targets_cpp,v retrieving revision 1.7 diff -u -p -r1.7 patch-tools_clang_lib_Basic_Targets_cpp --- patches/patch-tools_clang_lib_Basic_Targets_cpp 8 Aug 2012 09:35:24 -0000 1.7 +++ patches/patch-tools_clang_lib_Basic_Targets_cpp 30 Aug 2012 00:18:06 -0000 @@ -3,8 +3,8 @@ $OpenBSD: patch-tools_clang_lib_Basic_Ta - OpenBSD does not support TLS. - Provide target support for powerpc, arm, mips64, mips64el and sparc. ---- tools/clang/lib/Basic/Targets.cpp.orig Wed Apr 25 19:26:22 2012 -+++ tools/clang/lib/Basic/Targets.cpp Wed Aug 8 10:32:41 2012 +--- tools/clang/lib/Basic/Targets.cpp.orig Wed Apr 25 14:26:22 2012 ++++ tools/clang/lib/Basic/Targets.cpp Wed Aug 29 19:59:33 2012 @@ -371,6 +371,7 @@ class OpenBSDTargetInfo : public OSTargetInfo<Target> OpenBSDTargetInfo(const std::string &triple) : OSTargetInfo<Target>(triple) { @@ -23,7 +23,76 @@ $OpenBSD: patch-tools_clang_lib_Basic_Ta Builder.defineMacro("_BIG_ENDIAN"); Builder.defineMacro("__BIG_ENDIAN__"); -@@ -3926,6 +3928,8 @@ static TargetInfo *AllocateTarget(const std::string &T +@@ -3471,6 +3473,10 @@ class MipsTargetInfoBase : public TargetInfo { (public + + virtual void getArchDefines(const LangOptions &Opts, + MacroBuilder &Builder) const { ++ DefineStd(Builder, "mips", Opts); ++ Builder.defineMacro("_mips"); ++ Builder.defineMacro("__REGISTER_PREFIX__", ""); ++ + if (SoftFloat) + Builder.defineMacro("__mips_soft_float", Twine(1)); + else if (SingleFloat) +@@ -3654,11 +3660,8 @@ class Mips32EBTargetInfo : public Mips32TargetInfoBase + } + virtual void getTargetDefines(const LangOptions &Opts, + MacroBuilder &Builder) const { +- DefineStd(Builder, "mips", Opts); +- Builder.defineMacro("_mips"); + DefineStd(Builder, "MIPSEB", Opts); + Builder.defineMacro("_MIPSEB"); +- Builder.defineMacro("__REGISTER_PREFIX__", ""); + getArchDefines(Opts, Builder); + } + }; +@@ -3672,11 +3675,8 @@ class Mips32ELTargetInfo : public Mips32TargetInfoBase + } + virtual void getTargetDefines(const LangOptions &Opts, + MacroBuilder &Builder) const { +- DefineStd(Builder, "mips", Opts); +- Builder.defineMacro("_mips"); + DefineStd(Builder, "MIPSEL", Opts); + Builder.defineMacro("_MIPSEL"); +- Builder.defineMacro("__REGISTER_PREFIX__", ""); + getArchDefines(Opts, Builder); + } + }; +@@ -3711,6 +3711,9 @@ class Mips64TargetInfoBase : public MipsTargetInfoBase + MacroBuilder &Builder) const { + MipsTargetInfoBase::getArchDefines(Opts, Builder); + ++ Builder.defineMacro("__mips64"); ++ Builder.defineMacro("__mips64__"); ++ + if (ABI == "n32") { + Builder.defineMacro("__mips_n32"); + Builder.defineMacro("_ABIN32", "2"); +@@ -3781,11 +3784,8 @@ class Mips64EBTargetInfo : public Mips64TargetInfoBase + } + virtual void getTargetDefines(const LangOptions &Opts, + MacroBuilder &Builder) const { +- DefineStd(Builder, "mips", Opts); +- Builder.defineMacro("_mips"); + DefineStd(Builder, "MIPSEB", Opts); + Builder.defineMacro("_MIPSEB"); +- Builder.defineMacro("__REGISTER_PREFIX__", ""); + getArchDefines(Opts, Builder); + } + }; +@@ -3808,11 +3808,8 @@ class Mips64ELTargetInfo : public Mips64TargetInfoBase + } + virtual void getTargetDefines(const LangOptions &Opts, + MacroBuilder &Builder) const { +- DefineStd(Builder, "mips", Opts); +- Builder.defineMacro("_mips"); + DefineStd(Builder, "MIPSEL", Opts); + Builder.defineMacro("_MIPSEL"); +- Builder.defineMacro("__REGISTER_PREFIX__", ""); + getArchDefines(Opts, Builder); + } + }; +@@ -3926,6 +3923,8 @@ static TargetInfo *AllocateTarget(const std::string &T return new FreeBSDTargetInfo<ARMTargetInfo>(T); case llvm::Triple::NetBSD: return new NetBSDTargetInfo<ARMTargetInfo>(T); @@ -32,7 +101,7 @@ $OpenBSD: patch-tools_clang_lib_Basic_Ta case llvm::Triple::RTEMS: return new RTEMSTargetInfo<ARMTargetInfo>(T); default: -@@ -3973,6 +3977,8 @@ static TargetInfo *AllocateTarget(const std::string &T +@@ -3973,6 +3972,8 @@ static TargetInfo *AllocateTarget(const std::string &T return new FreeBSDTargetInfo<Mips64EBTargetInfo>(T); case llvm::Triple::NetBSD: return new NetBSDTargetInfo<Mips64EBTargetInfo>(T); @@ -41,7 +110,7 @@ $OpenBSD: patch-tools_clang_lib_Basic_Ta default: return new Mips64EBTargetInfo(T); } -@@ -3987,6 +3993,8 @@ static TargetInfo *AllocateTarget(const std::string &T +@@ -3987,6 +3988,8 @@ static TargetInfo *AllocateTarget(const std::string &T return new FreeBSDTargetInfo<Mips64ELTargetInfo>(T); case llvm::Triple::NetBSD: return new NetBSDTargetInfo<Mips64ELTargetInfo>(T); @@ -50,7 +119,7 @@ $OpenBSD: patch-tools_clang_lib_Basic_Ta default: return new Mips64ELTargetInfo(T); } -@@ -4009,6 +4017,8 @@ static TargetInfo *AllocateTarget(const std::string &T +@@ -4009,6 +4012,8 @@ static TargetInfo *AllocateTarget(const std::string &T return new FreeBSDTargetInfo<PPC32TargetInfo>(T); case llvm::Triple::NetBSD: return new NetBSDTargetInfo<PPC32TargetInfo>(T); @@ -59,7 +128,7 @@ $OpenBSD: patch-tools_clang_lib_Basic_Ta case llvm::Triple::RTEMS: return new RTEMSTargetInfo<PPC32TargetInfo>(T); default: -@@ -4049,6 +4059,8 @@ static TargetInfo *AllocateTarget(const std::string &T +@@ -4049,6 +4054,8 @@ static TargetInfo *AllocateTarget(const std::string &T return new SolarisSparcV8TargetInfo(T); case llvm::Triple::NetBSD: return new NetBSDTargetInfo<SparcV8TargetInfo>(T); -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.