On 2020-11-29 10:41:05 +0000 Anthony Richardby <antho...@gmx.co.uk> wrote:

Hi All,
With this patch squeak-vm builds and runs on my macppc machine. I've
had to make 3 changes. I've removed the -mno-fused-madd which doesn't
seem to exist on clang. I've changed f0 to just 0 in the powerpc
specific inline asm, not sure about this, but I thought the type of
register was implicit anyway. Finally, and this change affects all
platforms, I had to change the order of linker arguments; without this
I got a bunch of linker errors relating to the plugins. If there's
anything else I need to do, let me know.

I've only really tested it by clicking around in the default image,
which seems to function well, though I plan on having a play with
Squeak some more later.

Index: patches/patch-platforms_unix_config_Makefile_in
===================================================================
RCS file: patches/patch-platforms_unix_config_Makefile_in
diff -N patches/patch-platforms_unix_config_Makefile_in
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-platforms_unix_config_Makefile_in     29 Nov 2020
10:18:46 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: platforms/unix/config/Makefile.in
+--- platforms/unix/config/Makefile.in.orig
++++ platforms/unix/config/Makefile.in
+@@ -43,7 +43,7 @@ all : $(squeak) plugins squeak.1 $(npsqueak)
+ # VM
+
+ $(squeak) : config.sh $(SQLIBS) version.o
+-      $(LINK) $(squeak) $(SQLIBS) version.o $(LIBS) [plibs] vm/vm.a
++      $(LINK) $(squeak) vm/vm.a $(SQLIBS) version.o $(LIBS) [plibs]
+       @echo
+       @size $(squeak)
+       @echo
Index: patches/patch-platforms_unix_config_acinclude_m4
===================================================================
RCS file:
/cvs/ports/lang/squeak/vm/patches/patch-platforms_unix_config_acinclude_m4,v
retrieving revision 1.1
diff -u -p -u -r1.1 patch-platforms_unix_config_acinclude_m4
--- patches/patch-platforms_unix_config_acinclude_m4    14 Jan 2020
22:20:29 -0000  1.1
+++ patches/patch-platforms_unix_config_acinclude_m4    29 Nov 2020
10:18:46 -0000
@@ -5,10 +5,20 @@ fix build on alpha
  Index: platforms/unix/config/acinclude.m4
  --- platforms/unix/config/acinclude.m4.orig
  +++ platforms/unix/config/acinclude.m4
-@@ -255,16 +255,6 @@ fi)
+@@ -115,7 +115,7 @@ if test "$GCC" = yes; then
+     ac_optflags="-fomit-frame-pointer"
+     ;;
+   powerpc|ppc)
+-    ac_optflags="-O3 -funroll-loops -mcpu=750 -mno-fused-madd"
++    ac_optflags="-O3 -funroll-loops -mcpu=750"
+     ;;
+   esac
+   AC_DEFINE(VM_BUILD_STRING, ["Unix built on "__DATE__ " "__TIME__"
Compiler: "__VERSION__])
+@@ -254,16 +254,6 @@ else ac_cv_module_prefix="lib"
+ fi)
   AC_DEFINE_UNQUOTED(VM_MODULE_PREFIX,"$mkfrags_lib_prefix")
   test "$ac_cv_module_prefix" = lib && mkfrags_lib_prefix=lib])
-
+-
  -AC_DEFUN([AC_64BIT_ARCH],
  -[AC_MSG_CHECKING(for compiler flags to force 32-bit addresses)
  -case $host in
@@ -18,7 +28,6 @@ Index: platforms/unix/config/acinclude.m
  -    ;;
  -esac
  -AC_MSG_RESULT($CFLAGS_32)])
--

- ### plugin support

+ ### plugin support
Index:
patches/patch-platforms_unix_plugins_FloatMathPlugin_acinclude_m4
===================================================================
RCS file:
patches/patch-platforms_unix_plugins_FloatMathPlugin_acinclude_m4
diff -N
patches/patch-platforms_unix_plugins_FloatMathPlugin_acinclude_m4
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++
patches/patch-platforms_unix_plugins_FloatMathPlugin_acinclude_m4       29
Nov 2020 10:18:46 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: platforms/unix/plugins/FloatMathPlugin/acinclude.m4
+--- platforms/unix/plugins/FloatMathPlugin/acinclude.m4.orig
++++ platforms/unix/plugins/FloatMathPlugin/acinclude.m4
+@@ -6,7 +6,7 @@ if test "$GCC" = yes; then
+     libm_cflags="-O -fomit-frame-pointer"
+     ;;
+   powerpc|ppc)
+-    libm_cflags="-O3 -funroll-loops -mcpu=750 -mno-fused-madd"
++    libm_cflags="-O3 -funroll-loops -mcpu=750"
+     ;;
+   esac
+ fi
Index: patches/patch-platforms_unix_vm_sqUnixMain_c
===================================================================
RCS file:
/cvs/ports/lang/squeak/vm/patches/patch-platforms_unix_vm_sqUnixMain_c,v
retrieving revision 1.7
diff -u -p -u -r1.7 patch-platforms_unix_vm_sqUnixMain_c
--- patches/patch-platforms_unix_vm_sqUnixMain_c        14 Jan 2020 22:20:29
-0000   1.7
+++ patches/patch-platforms_unix_vm_sqUnixMain_c        29 Nov 2020 10:18:46
-0000
@@ -25,6 +25,17 @@ Index: platforms/unix/vm/sqUnixMain.c
     { &soundModule,   "sound",   "custom" },   /*** NO DEFAULT ***/
     /* defaults */
     { &displayModule, "display", "Quartz" },
+@@ -1292,8 +1289,8 @@ void imgInit(void)
+                       || defined(POWERPC) || defined(__POWERPC) || defined
(__POWERPC__) )
+   void mtfsfi(unsigned long long fpscr)
+   {
+-    __asm__("lfd   f0, %0" :: "m"(fpscr));
+-    __asm__("mtfsf 0xff, f0");
++    __asm__("lfd   0, %0" :: "m"(fpscr));
++    __asm__("mtfsf 0xff, 0");
+   }
+ #else
+ # define mtfsfi(fpscr)
  @@ -1329,17 +1326,6 @@ int main(int argc, char **argv, char **envp)
       outOfMemory();






Oops, my mail client had mangled it. Diff provided as an attachment:

<squeak3.patch>
Index: patches/patch-platforms_unix_config_Makefile_in
===================================================================
RCS file: patches/patch-platforms_unix_config_Makefile_in
diff -N patches/patch-platforms_unix_config_Makefile_in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-platforms_unix_config_Makefile_in	29 Nov 2020 10:18:46 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: platforms/unix/config/Makefile.in
+--- platforms/unix/config/Makefile.in.orig
++++ platforms/unix/config/Makefile.in
+@@ -43,7 +43,7 @@ all : $(squeak) plugins squeak.1 $(npsqueak)
+ # VM
+ 
+ $(squeak) : config.sh $(SQLIBS) version.o
+-	$(LINK) $(squeak) $(SQLIBS) version.o $(LIBS) [plibs] vm/vm.a
++	$(LINK) $(squeak) vm/vm.a $(SQLIBS) version.o $(LIBS) [plibs]
+ 	@echo
+ 	@size $(squeak)
+ 	@echo
Index: patches/patch-platforms_unix_config_acinclude_m4
===================================================================
RCS file: /cvs/ports/lang/squeak/vm/patches/patch-platforms_unix_config_acinclude_m4,v
retrieving revision 1.1
diff -u -p -u -r1.1 patch-platforms_unix_config_acinclude_m4
--- patches/patch-platforms_unix_config_acinclude_m4	14 Jan 2020 22:20:29 -0000	1.1
+++ patches/patch-platforms_unix_config_acinclude_m4	29 Nov 2020 10:18:46 -0000
@@ -5,10 +5,20 @@ fix build on alpha
 Index: platforms/unix/config/acinclude.m4
 --- platforms/unix/config/acinclude.m4.orig
 +++ platforms/unix/config/acinclude.m4
-@@ -255,16 +255,6 @@ fi)
+@@ -115,7 +115,7 @@ if test "$GCC" = yes; then
+     ac_optflags="-fomit-frame-pointer"
+     ;;
+   powerpc|ppc)
+-    ac_optflags="-O3 -funroll-loops -mcpu=750 -mno-fused-madd"
++    ac_optflags="-O3 -funroll-loops -mcpu=750"
+     ;;
+   esac
+   AC_DEFINE(VM_BUILD_STRING, ["Unix built on "__DATE__ " "__TIME__" Compiler: "__VERSION__])
+@@ -254,16 +254,6 @@ else ac_cv_module_prefix="lib"
+ fi)
  AC_DEFINE_UNQUOTED(VM_MODULE_PREFIX,"$mkfrags_lib_prefix")
  test "$ac_cv_module_prefix" = lib && mkfrags_lib_prefix=lib])
- 
+-
 -AC_DEFUN([AC_64BIT_ARCH],
 -[AC_MSG_CHECKING(for compiler flags to force 32-bit addresses)
 -case $host in
@@ -18,7 +28,6 @@ Index: platforms/unix/config/acinclude.m
 -    ;;
 -esac
 -AC_MSG_RESULT($CFLAGS_32)])
--
  
- ### plugin support
  
+ ### plugin support
Index: patches/patch-platforms_unix_plugins_FloatMathPlugin_acinclude_m4
===================================================================
RCS file: patches/patch-platforms_unix_plugins_FloatMathPlugin_acinclude_m4
diff -N patches/patch-platforms_unix_plugins_FloatMathPlugin_acinclude_m4
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-platforms_unix_plugins_FloatMathPlugin_acinclude_m4	29 Nov 2020 10:18:46 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+
+Index: platforms/unix/plugins/FloatMathPlugin/acinclude.m4
+--- platforms/unix/plugins/FloatMathPlugin/acinclude.m4.orig
++++ platforms/unix/plugins/FloatMathPlugin/acinclude.m4
+@@ -6,7 +6,7 @@ if test "$GCC" = yes; then
+     libm_cflags="-O -fomit-frame-pointer"
+     ;;
+   powerpc|ppc)
+-    libm_cflags="-O3 -funroll-loops -mcpu=750 -mno-fused-madd"
++    libm_cflags="-O3 -funroll-loops -mcpu=750"
+     ;;
+   esac
+ fi
Index: patches/patch-platforms_unix_vm_sqUnixMain_c
===================================================================
RCS file: /cvs/ports/lang/squeak/vm/patches/patch-platforms_unix_vm_sqUnixMain_c,v
retrieving revision 1.7
diff -u -p -u -r1.7 patch-platforms_unix_vm_sqUnixMain_c
--- patches/patch-platforms_unix_vm_sqUnixMain_c	14 Jan 2020 22:20:29 -0000	1.7
+++ patches/patch-platforms_unix_vm_sqUnixMain_c	29 Nov 2020 10:18:46 -0000
@@ -25,6 +25,17 @@ Index: platforms/unix/vm/sqUnixMain.c
    { &soundModule,   "sound",   "custom" },	/*** NO DEFAULT ***/
    /* defaults */
    { &displayModule, "display", "Quartz" },
+@@ -1292,8 +1289,8 @@ void imgInit(void)
+ 			|| defined(POWERPC) || defined(__POWERPC) || defined (__POWERPC__) )
+   void mtfsfi(unsigned long long fpscr)
+   {
+-    __asm__("lfd   f0, %0" :: "m"(fpscr));
+-    __asm__("mtfsf 0xff, f0");
++    __asm__("lfd   0, %0" :: "m"(fpscr));
++    __asm__("mtfsf 0xff, 0");
+   }
+ #else
+ # define mtfsfi(fpscr)
 @@ -1329,17 +1326,6 @@ int main(int argc, char **argv, char **envp)
      outOfMemory();
  

Reply via email to