I have Prolog working on x86_64 Solaris

"Scott L. Burson" <[email protected]>
Newsgroups gmane.comp.gnu.prolog.bugs
Message-ID <[email protected]>
Hi,

After encountering the bug reported in my previous message, I got 
inspired to try building Prolog for x86_64 Solaris.  I am pleased to 
report that I was successful (at least, it seems to work in some simple 
experiments -- including compiled programs).

I enclose my changes.  These should be reviewed, of course.  Also, I 
edited `configure' directly rather than via `configure.in'; the changes 
will need to be transferred.

-- Scott

_______________________________________________
Bug-prolog mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-prolog
patch-x86_64-solaris (text/plain, 6.7 KB)
*** ./src/EnginePl/engine1.c.~1~	2007-01-04 02:35:13.000000000 -0800
--- ./src/EnginePl/engine1.c	2007-01-12 12:50:54.000000000 -0800
***************
*** 105,110 ****
--- 105,115 ----
    register WamWord *rb asm("%r12") = reg_bank;
    ensure_reserved = (WamWord *) rb; /* to avoid gcc warning */
  
+ #elif defined(M_x86_64_solaris)
+ 
+   register WamWord *rb asm("%r12") = reg_bank;
+   ensure_reserved = (WamWord *) rb; /* to avoid gcc warning */
+ 
  #endif
  
  #endif
*** ./src/EnginePl/gp_config.h.in.~1~	2007-01-04 02:21:49.000000000 -0800
--- ./src/EnginePl/gp_config.h.in	2007-01-12 13:38:10.000000000 -0800
***************
*** 177,182 ****
--- 177,185 ----
  /* Define if the system is a x86-64/linux */
  #undef M_x86_64_linux
  
+ /* Define if the system is a x86-64/solaris */
+ #undef M_x86_64_solaris
+ 
  
  
  /* Constant definitions */
*** ./src/EnginePl/engine.c.~1~	2007-01-04 02:35:13.000000000 -0800
--- ./src/EnginePl/engine.c	2007-01-12 12:46:41.000000000 -0800
***************
*** 455,461 ****
  {
  #ifdef M_ix86_darwin		/* see comment in Ma2Asm/ix86_any.c */
    asm("subl $4,%esp");
! #elif defined(M_x86_64_linux) 	/* see comment in Ma2Asm/x86_64_any.c */
    asm("subq $8,%rsp");
  #endif
    Save_Machine_Regs(p_buff_save);
--- 455,461 ----
  {
  #ifdef M_ix86_darwin		/* see comment in Ma2Asm/ix86_any.c */
    asm("subl $4,%esp");
! #elif defined(M_x86_64) 	/* see comment in Ma2Asm/x86_64_any.c */
    asm("subq $8,%rsp");
  #endif
    Save_Machine_Regs(p_buff_save);
***************
*** 475,481 ****
  {
  #ifdef M_ix86_darwin		/* see comment in Ma2Asm/ix86_any.c */
    asm("subl $4,%esp");
! #elif defined(M_x86_64_linux) 	/* see comment in Ma2Asm/x86_64_any.c */
    asm("subq $8,%rsp");
  #endif
    Save_Machine_Regs(p_buff_save);
--- 475,481 ----
  {
  #ifdef M_ix86_darwin		/* see comment in Ma2Asm/ix86_any.c */
    asm("subl $4,%esp");
! #elif defined(M_x86_64) 	/* see comment in Ma2Asm/x86_64_any.c */
    asm("subq $8,%rsp");
  #endif
    Save_Machine_Regs(p_buff_save);
*** ./src/EnginePl/machine.c.~1~	2007-01-04 02:35:13.000000000 -0800
--- ./src/EnginePl/machine.c	2007-01-12 12:53:12.000000000 -0800
***************
*** 389,395 ****
      }
  
  #if defined(M_sparc_solaris) || defined(M_ix86_solaris) || \
!     defined(M_ix86_sco) || defined(M_x86_64_linux)
    {
      struct sigaction act;
  
--- 389,395 ----
      }
  
  #if defined(M_sparc_solaris) || defined(M_ix86_solaris) || \
!     defined(M_ix86_sco) || defined(M_x86_64_linux) || defined(M_x86_64_solaris)
    {
      struct sigaction act;
  
***************
*** 442,448 ****
  static void
  SIGSEGV_Handler(int sig, int code, int scp, WamWord *addr)
  
! #elif defined(M_sparc_solaris) || defined(M_ix86_solaris)
  void
  SIGSEGV_Handler(int sig, siginfo_t * sip)
  
--- 442,448 ----
  static void
  SIGSEGV_Handler(int sig, int code, int scp, WamWord *addr)
  
! #elif defined(M_sparc_solaris) || defined(M_ix86_solaris) || defined(M_x86_64_solaris)
  void
  SIGSEGV_Handler(int sig, siginfo_t * sip)
  
***************
*** 501,507 ****
  
    /* WamWord *addr=(WamWord *) (scp.sc_traparg_a0); */
  
! #elif defined(M_sparc_solaris) || defined(M_ix86_solaris)
  
    WamWord *addr = (WamWord *) sip->si_addr;
  
--- 501,507 ----
  
    /* WamWord *addr=(WamWord *) (scp.sc_traparg_a0); */
  
! #elif defined(M_sparc_solaris) || defined(M_ix86_solaris) || defined(M_x86_64_solaris)
  
    WamWord *addr = (WamWord *) sip->si_addr;
  
*** ./src/EnginePl/machine.h.~1~	2007-01-04 02:35:13.000000000 -0800
--- ./src/EnginePl/machine.h	2007-01-12 12:54:19.000000000 -0800
***************
*** 154,160 ****
  
  #   define M_MMAP_HIGH_ADR1        0x3f800000000ULL
  
! #elif defined(M_x86_64_linux)
  
  #   define M_MMAP_HIGH_ADR1        0x4000000000ULL
  
--- 154,160 ----
  
  #   define M_MMAP_HIGH_ADR1        0x3f800000000ULL
  
! #elif defined(M_x86_64_linux) || defined(M_x86_64_solaris)
  
  #   define M_MMAP_HIGH_ADR1        0x4000000000ULL
  
*** ./src/Ma2Asm/FromC/mach.h.~1~	2007-01-04 02:21:48.000000000 -0800
--- ./src/Ma2Asm/FromC/mach.h	2007-01-12 12:56:30.000000000 -0800
***************
*** 64,70 ****
  
  #    define M_Direct_Goto(lab)     {_asm {jmp M_Asm_Symbol(lab)}; return;}
  
! #elif defined(M_x86_64_linux)
  
  #    define M_Direct_Goto(lab)     {asm("jmp " M_Asm_Symbol(lab)); return;}
  
--- 64,70 ----
  
  #    define M_Direct_Goto(lab)     {_asm {jmp M_Asm_Symbol(lab)}; return;}
  
! #elif defined(M_x86_64_linux) || defined(M_x86_64_solaris)
  
  #    define M_Direct_Goto(lab)     {asm("jmp " M_Asm_Symbol(lab)); return;}
  
*** ./src/configure.~1~	2007-01-05 04:13:28.000000000 -0800
--- ./src/configure	2007-01-12 13:57:30.000000000 -0800
***************
*** 3062,3068 ****
  echo "$as_me: error: gcc is required (or MSVC++ under win32)" >&2;}
     { (exit 1); exit 1; }; }
      fi
!     AS=as
      if test -n "$ac_tool_prefix"; then
    # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
  set dummy ${ac_tool_prefix}ranlib; ac_word=$2
--- 3062,3079 ----
  echo "$as_me: error: gcc is required (or MSVC++ under win32)" >&2;}
     { (exit 1); exit 1; }; }
      fi
!     case "$host" in
! 	x86_64*solaris*)
! 	    AS='gas --64'
!         ;;
! 	*)
! 	    if test "$with_gas" = yes; then
! 		AS=gas
! 	    else
! 		AS=as
! 	    fi
!         ;;
!     esac
      if test -n "$ac_tool_prefix"; then
    # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
  set dummy ${ac_tool_prefix}ranlib; ac_word=$2
***************
*** 3558,3563 ****
--- 3569,3579 ----
  #define M_ix86_linux 1
  _ACEOF
  ;;
+         x86_64*solaris*)   cat >>confdefs.h <<\_ACEOF
+ #define M_x86_64_solaris 1
+ _ACEOF
+ CFLAGS="$CFLAGS -m64"
+ ;;
          i*86*solaris*)   cat >>confdefs.h <<\_ACEOF
  #define M_ix86_solaris 1
  _ACEOF
***************
*** 5536,5541 ****
--- 5552,5558 ----
          i586*)             CFLAGS_MACHINE='-march=pentium';;
          i*86*)             CFLAGS_MACHINE='-march=i486';;
          powerpc*darwin*)   CFLAGS_MACHINE='-mpowerpc -no-cpp-precomp';;
+         x86_64*solaris*)   CFLAGS_MACHINE='-m64';;
      esac
  
      case "$host" in
*** ./src/TopComp/top_comp.c.~1~	2007-01-04 02:35:15.000000000 -0800
--- ./src/TopComp/top_comp.c	2007-01-12 14:09:43.000000000 -0800
***************
*** 193,199 ****
  CmdInf cmd_asm = { EXE_FILE_ASM, " ", "-o " };
  CmdInf cmd_fd2c = { EXE_FILE_FD2C, " ", "-o " };
  CmdInf cmd_cc = { EXE_FILE_CC, " ", CC_OBJ_NAME_OPT };
! CmdInf cmd_link = { EXE_FILE_LINK, " ", CC_EXE_NAME_OPT };
  
  char *cc_fd2c_flags = CFLAGS " ";
  
--- 193,199 ----
  CmdInf cmd_asm = { EXE_FILE_ASM, " ", "-o " };
  CmdInf cmd_fd2c = { EXE_FILE_FD2C, " ", "-o " };
  CmdInf cmd_cc = { EXE_FILE_CC, " ", CC_OBJ_NAME_OPT };
! CmdInf cmd_link = { EXE_FILE_LINK, " " CFLAGS_MACHINE " ", CC_EXE_NAME_OPT };
  
  char *cc_fd2c_flags = CFLAGS " ";
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.