Re: llvm 3.1

2012-05-31 Thread Brian Callahan

Hi --
On 5/27/2012 8:32 PM, Jonathan Gray wrote:


you'll need to modify the driver as well

Here is a diff against clang svn that adds OpenBSD specific
arm/mips64/mips64el/powerpc/sparc targets.  If the gcc config has
arch specific OpenBSD settings that differ from the defaults
more will have to be done.

I don't know if this is enough as I've only compile tested
it on i386.  In particular I'm not sure which arm/mips64 abi
is being defaulted to.

Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp   (revision 155625)
+++ lib/Basic/Targets.cpp   (working copy)
@@ -3924,6 +3924,8 @@
return new FreeBSDTargetInfoARMTargetInfo(T);
  case llvm::Triple::NetBSD:
return new NetBSDTargetInfoARMTargetInfo(T);
+case llvm::Triple::OpenBSD:
+  return new OpenBSDTargetInfoARMTargetInfo(T);
  case llvm::Triple::RTEMS:
return new RTEMSTargetInfoARMTargetInfo(T);
  default:
@@ -3971,6 +3973,8 @@
return new FreeBSDTargetInfoMips64EBTargetInfo(T);
  case llvm::Triple::NetBSD:
return new NetBSDTargetInfoMips64EBTargetInfo(T);
+case llvm::Triple::OpenBSD:
+  return new OpenBSDTargetInfoMips64EBTargetInfo(T);
  default:
return new Mips64EBTargetInfo(T);
  }
@@ -3985,6 +3989,8 @@
return new FreeBSDTargetInfoMips64ELTargetInfo(T);
  case llvm::Triple::NetBSD:
return new NetBSDTargetInfoMips64ELTargetInfo(T);
+case llvm::Triple::OpenBSD:
+  return new OpenBSDTargetInfoMips64ELTargetInfo(T);
  default:
return new Mips64ELTargetInfo(T);
  }
@@ -4007,6 +4013,8 @@
return new FreeBSDTargetInfoPPC32TargetInfo(T);
  case llvm::Triple::NetBSD:
return new NetBSDTargetInfoPPC32TargetInfo(T);
+case llvm::Triple::OpenBSD:
+  return new OpenBSDTargetInfoPPC32TargetInfo(T);
  case llvm::Triple::RTEMS:
return new RTEMSTargetInfoPPC32TargetInfo(T);
  default:
@@ -4047,6 +4055,8 @@
return new SolarisSparcV8TargetInfo(T);
  case llvm::Triple::NetBSD:
return new NetBSDTargetInfoSparcV8TargetInfo(T);
+case llvm::Triple::OpenBSD:
+  return new OpenBSDTargetInfoSparcV8TargetInfo(T);
  case llvm::Triple::RTEMS:
return new RTEMSTargetInfoSparcV8TargetInfo(T);
  default:


No change with this patch :(

Thanks.

~Brian



Re: llvm 3.1

2012-05-28 Thread Brian Callahan
I believe that it defaults to N64 if it detects a mips64* arch, O32 
otherwise.

I'll test the patch and report back.

~Brian

On 5/27/2012 8:32 PM, Jonathan Gray wrote:

On Sun, May 27, 2012 at 11:52:47AM -0400, Brian Callahan wrote:

Sorry, I forgot to add a few more caveats to the mips64el build:

You need the patch at the bottom of this email (hopefully
Thunderbird won't mangle it).

Additionally, I ported gas-2.22 to the loongson, which is needed for
the loongson build. I can send that separately, if such a port is
desired.

Thanks.

~Brian


you'll need to modify the driver as well

Here is a diff against clang svn that adds OpenBSD specific
arm/mips64/mips64el/powerpc/sparc targets.  If the gcc config has
arch specific OpenBSD settings that differ from the defaults
more will have to be done.

I don't know if this is enough as I've only compile tested
it on i386.  In particular I'm not sure which arm/mips64 abi
is being defaulted to.

Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp   (revision 155625)
+++ lib/Basic/Targets.cpp   (working copy)
@@ -3924,6 +3924,8 @@
return new FreeBSDTargetInfoARMTargetInfo(T);
  case llvm::Triple::NetBSD:
return new NetBSDTargetInfoARMTargetInfo(T);
+case llvm::Triple::OpenBSD:
+  return new OpenBSDTargetInfoARMTargetInfo(T);
  case llvm::Triple::RTEMS:
return new RTEMSTargetInfoARMTargetInfo(T);
  default:
@@ -3971,6 +3973,8 @@
return new FreeBSDTargetInfoMips64EBTargetInfo(T);
  case llvm::Triple::NetBSD:
return new NetBSDTargetInfoMips64EBTargetInfo(T);
+case llvm::Triple::OpenBSD:
+  return new OpenBSDTargetInfoMips64EBTargetInfo(T);
  default:
return new Mips64EBTargetInfo(T);
  }
@@ -3985,6 +3989,8 @@
return new FreeBSDTargetInfoMips64ELTargetInfo(T);
  case llvm::Triple::NetBSD:
return new NetBSDTargetInfoMips64ELTargetInfo(T);
+case llvm::Triple::OpenBSD:
+  return new OpenBSDTargetInfoMips64ELTargetInfo(T);
  default:
return new Mips64ELTargetInfo(T);
  }
@@ -4007,6 +4013,8 @@
return new FreeBSDTargetInfoPPC32TargetInfo(T);
  case llvm::Triple::NetBSD:
return new NetBSDTargetInfoPPC32TargetInfo(T);
+case llvm::Triple::OpenBSD:
+  return new OpenBSDTargetInfoPPC32TargetInfo(T);
  case llvm::Triple::RTEMS:
return new RTEMSTargetInfoPPC32TargetInfo(T);
  default:
@@ -4047,6 +4055,8 @@
return new SolarisSparcV8TargetInfo(T);
  case llvm::Triple::NetBSD:
return new NetBSDTargetInfoSparcV8TargetInfo(T);
+case llvm::Triple::OpenBSD:
+  return new OpenBSDTargetInfoSparcV8TargetInfo(T);
  case llvm::Triple::RTEMS:
return new RTEMSTargetInfoSparcV8TargetInfo(T);
  default:





Re: llvm 3.1

2012-05-27 Thread Stuart Henderson
On 2012/05/26 20:10, Brad Smith wrote:
 On Sat, May 26, 2012 at 11:53:17PM +0100, Stuart Henderson wrote:
  BTW it would be nice if somebody could add to ONLY_FOR_ARCHS
  and try this on some of the various mips arch. Don't forget to
  log the build. (It's in the tree now).
 
 BTW, sparc64 should be removed as LLVM has no 64-bit SPARC support.

I think that was fixed, from docs/WritingAnLLVMBackend.html:

For example, the LLVM SPARC implementation provided covers
three major versions of the SPARC microprocessor architecture:
Version 8 (V8, which is a 32-bit architecture), Version 9
(V9, a 64-bit architecture), and the UltraSPARC architecture.



Re: llvm 3.1

2012-05-27 Thread Brian Callahan

On 5/26/2012 6:53 PM, Stuart Henderson wrote:

BTW it would be nice if somebody could add to ONLY_FOR_ARCHS
and try this on some of the various mips arch. Don't forget to
log the build. (It's in the tree now).

LLVM-3.1 builds successfully on loongson (it has for a while now, 
actually, since at least a few versions ago I've been doing it). But 
clang fails to compile even a simple Hello World.

clang --version does report correctly, for what that's worth.

Here's the runup of clang trying to compile Hello World. I'm in the 
process of trying a few patches, so I'll post a coredump tomorrow after 
I recompile a vanilla llvm-3.1


Terminal output (which was 'clang -v hw.c'):
clang version 3.1 (branches/release_31)
Target: mips64el-unknown-openbsd5.1
Thread model: posix
 /usr/local/bin/clang-3.1 -cc1 -triple mips64el-unknown-openbsd5.1 -S 
-disable-free -disable-llvm-verifier -main-file-name hw.c 
-mrelocation-model static -mdisable-fp-elim -mconstructor-aliases 
-target-cpu mips64 -target-abi n64 -mfloat-abi hard 
-momit-leaf-frame-pointer -v -resource-dir 
/usr/local/bin/../lib/clang/3.1 -fmodule-cache-path 
/var/tmp/clang-module-cache -fno-dwarf-directory-asm -ferror-limit 19 
-fmessage-length 0 -mstackrealign -fgnu-runtime -fobjc-runtime-has-arc 
-fobjc-runtime-has-weak -fdiagnostics-show-option -o /tmp/hw-sPizWW.s -x 
c hw.c
clang -cc1 version 3.1 based upon LLVM 3.1svn default target 
mips64el-unknown-openbsd5.1

#include ... search starts here:
#include ... search starts here:
 /usr/local/include
 /usr/local/bin/../lib/clang/3.1/include
 /usr/include
End of search list.
Stack dump:
0.	Program arguments: /usr/local/bin/clang-3.1 -cc1 -triple 
mips64el-unknown-openbsd5.1 -S -disable-free -disable-llvm-verifier 
-main-file-name hw.c -mrelocation-model static -mdisable-fp-elim 
-mconstructor-aliases -target-cpu mips64 -target-abi n64 -mfloat-abi 
hard -momit-leaf-frame-pointer -v -resource-dir 
/usr/local/bin/../lib/clang/3.1 -fmodule-cache-path 
/var/tmp/clang-module-cache -fno-dwarf-directory-asm -ferror-limit 19 
-fmessage-length 0 -mstackrealign -fgnu-runtime -fobjc-runtime-has-arc 
-fobjc-runtime-has-weak -fdiagnostics-show-option -o /tmp/hw-sPizWW.s -x 
c hw.c

1.  /usr/include/sys/endian.h:162:1: current parser token '__uint64_t'
clang-3: error: unable to execute command: Bus error (core dumped)
clang-3: error: clang frontend command failed due to signal (use -v to 
see invocation)
clang-3: note: diagnostic msg: Please submit a bug report to  and 
include command line arguments and all diagnostic information.
clang-3: note: diagnostic msg: Preprocessed source(s) and associated run 
script(s) are located at:

clang-3: note: diagnostic msg: /tmp/hw-pquwK2.i
clang-3: note: diagnostic msg: /tmp/hw-pquwK2.sh

/tmp/hw-pquwK2.i and /tmp/hw-pquwK2.sh are available here:
http://devio.us/~bcallah/hw-pquwK2.i
http://devio.us/~bcallah/hw-pquwK2.sh

Thanks.

~Brian



Re: llvm 3.1

2012-05-27 Thread Brian Callahan

Sorry, I forgot to add a few more caveats to the mips64el build:

You need the patch at the bottom of this email (hopefully Thunderbird 
won't mangle it).


Additionally, I ported gas-2.22 to the loongson, which is needed for the 
loongson build. I can send that separately, if such a port is desired.


Thanks.

~Brian

$OpenBSD$
--- lib/Support/Memory.cpp.orig Fri May 25 21:49:01 2012
+++ lib/Support/Memory.cpp  Fri May 25 21:50:12 2012
@@ -17,7 +17,7 @@
 #include llvm/Config/config.h

 #if defined(__mips__)
-#include sys/cachectl.h
+#include mips64/sysarch.h
 #endif

 namespace llvm {



Re: llvm 3.1

2012-05-27 Thread Brad Smith
On Sun, May 27, 2012 at 11:18:27AM +0100, Stuart Henderson wrote:
 On 2012/05/26 20:10, Brad Smith wrote:
  On Sat, May 26, 2012 at 11:53:17PM +0100, Stuart Henderson wrote:
   BTW it would be nice if somebody could add to ONLY_FOR_ARCHS
   and try this on some of the various mips arch. Don't forget to
   log the build. (It's in the tree now).
  
  BTW, sparc64 should be removed as LLVM has no 64-bit SPARC support.
 
 I think that was fixed, from docs/WritingAnLLVMBackend.html:
 
 For example, the LLVM SPARC implementation provided covers
 three major versions of the SPARC microprocessor architecture:
 Version 8 (V8, which is a 32-bit architecture), Version 9
 (V9, a 64-bit architecture), and the UltraSPARC architecture.

I don't see any indication that is really true. I see one commit to the
SPARC backend to enable 64-bit support 3 years ago and zero work on the
SPARC backend since then. The LLVM developers have been talking about
ripping out the SPARC backend for awhile now as it is unmaintained.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



Re: llvm 3.1

2012-05-27 Thread Jonathan Gray
On Sun, May 27, 2012 at 11:52:47AM -0400, Brian Callahan wrote:
 Sorry, I forgot to add a few more caveats to the mips64el build:
 
 You need the patch at the bottom of this email (hopefully
 Thunderbird won't mangle it).
 
 Additionally, I ported gas-2.22 to the loongson, which is needed for
 the loongson build. I can send that separately, if such a port is
 desired.
 
 Thanks.
 
 ~Brian

you'll need to modify the driver as well

Here is a diff against clang svn that adds OpenBSD specific
arm/mips64/mips64el/powerpc/sparc targets.  If the gcc config has
arch specific OpenBSD settings that differ from the defaults
more will have to be done.

I don't know if this is enough as I've only compile tested
it on i386.  In particular I'm not sure which arm/mips64 abi
is being defaulted to.

Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp   (revision 155625)
+++ lib/Basic/Targets.cpp   (working copy)
@@ -3924,6 +3924,8 @@
   return new FreeBSDTargetInfoARMTargetInfo(T);
 case llvm::Triple::NetBSD:
   return new NetBSDTargetInfoARMTargetInfo(T);
+case llvm::Triple::OpenBSD:
+  return new OpenBSDTargetInfoARMTargetInfo(T);
 case llvm::Triple::RTEMS:
   return new RTEMSTargetInfoARMTargetInfo(T);
 default:
@@ -3971,6 +3973,8 @@
   return new FreeBSDTargetInfoMips64EBTargetInfo(T);
 case llvm::Triple::NetBSD:
   return new NetBSDTargetInfoMips64EBTargetInfo(T);
+case llvm::Triple::OpenBSD:
+  return new OpenBSDTargetInfoMips64EBTargetInfo(T);
 default:
   return new Mips64EBTargetInfo(T);
 }
@@ -3985,6 +3989,8 @@
   return new FreeBSDTargetInfoMips64ELTargetInfo(T);
 case llvm::Triple::NetBSD:
   return new NetBSDTargetInfoMips64ELTargetInfo(T);
+case llvm::Triple::OpenBSD:
+  return new OpenBSDTargetInfoMips64ELTargetInfo(T);
 default:
   return new Mips64ELTargetInfo(T);
 }
@@ -4007,6 +4013,8 @@
   return new FreeBSDTargetInfoPPC32TargetInfo(T);
 case llvm::Triple::NetBSD:
   return new NetBSDTargetInfoPPC32TargetInfo(T);
+case llvm::Triple::OpenBSD:
+  return new OpenBSDTargetInfoPPC32TargetInfo(T);
 case llvm::Triple::RTEMS:
   return new RTEMSTargetInfoPPC32TargetInfo(T);
 default:
@@ -4047,6 +4055,8 @@
   return new SolarisSparcV8TargetInfo(T);
 case llvm::Triple::NetBSD:
   return new NetBSDTargetInfoSparcV8TargetInfo(T);
+case llvm::Triple::OpenBSD:
+  return new OpenBSDTargetInfoSparcV8TargetInfo(T);
 case llvm::Triple::RTEMS:
   return new RTEMSTargetInfoSparcV8TargetInfo(T);
 default:



Re: llvm 3.1

2012-05-27 Thread Brad Smith
On Mon, May 28, 2012 at 10:32:51AM +1000, Jonathan Gray wrote:
 On Sun, May 27, 2012 at 11:52:47AM -0400, Brian Callahan wrote:
  Sorry, I forgot to add a few more caveats to the mips64el build:
  
  You need the patch at the bottom of this email (hopefully
  Thunderbird won't mangle it).
  
  Additionally, I ported gas-2.22 to the loongson, which is needed for
  the loongson build. I can send that separately, if such a port is
  desired.
  
  Thanks.
  
  ~Brian
 
 you'll need to modify the driver as well
 
 Here is a diff against clang svn that adds OpenBSD specific
 arm/mips64/mips64el/powerpc/sparc targets.  If the gcc config has
 arch specific OpenBSD settings that differ from the defaults
 more will have to be done.
 
 I don't know if this is enough as I've only compile tested
 it on i386.  In particular I'm not sure which arm/mips64 abi
 is being defaulted to.

ARM support is dead in the water until OpenBSD updates to binutils
2.17 and switches to the ARM EABI ABI.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



Re: llvm 3.1

2012-05-26 Thread Stuart Henderson
BTW it would be nice if somebody could add to ONLY_FOR_ARCHS
and try this on some of the various mips arch. Don't forget to
log the build. (It's in the tree now).



Re: llvm 3.1

2012-05-26 Thread Brad Smith
On Sat, May 26, 2012 at 11:53:17PM +0100, Stuart Henderson wrote:
 BTW it would be nice if somebody could add to ONLY_FOR_ARCHS
 and try this on some of the various mips arch. Don't forget to
 log the build. (It's in the tree now).

BTW, sparc64 should be removed as LLVM has no 64-bit SPARC support.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



Re: llvm 3.1

2012-05-23 Thread Brad Smith
On Wed, May 23, 2012 at 08:15:20PM +0100, Stuart Henderson wrote:
 any comments, OK?
 
 rubinius fails hard during configure if this is installed, as it assumes
 llvm-config is a perl script, will send a diff for that next.

- You missed cvs rm'ing the patch-tools_clang_lib_Driver_Tools_cpp patch.
- Remove the first line from pre-configure.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.