On Thu, 30 Jul 2020 08:32:25 -0700
Josh Elsasser <j...@elsasser.org> wrote:

> With George's patch, it segfaults in ecl_min as he predicted,
> similarly to mips64:
> ...
> Got signal before environment was installed on our thread                     
>       

Daniel Kochmański put up a diff for ecl_find_package_nolock() that
"is not a proper fix", but gets around the segfault:
https://gitlab.com/embeddable-common-lisp/ecl/-/issues/604#note_388147381

Here's the diff as a ports/lang/ecl patch.  With this diff, and the
boehm-gc diff from my last mail, I can build and run ecl on my
powerpc64.  "make test" says,

Did 245 tests (0 crashed), 17999 checks.                                        
   Pass: 17908 (99%)                                                            
   Fail: 91 ( 1%)                                                               

--- /dev/null   Thu Jul 30 14:17:54 2020
+++ patches/patch-src_c_package_d       Thu Jul 30 13:44:33 2020
@@ -0,0 +1,45 @@
+$OpenBSD$
+
+Index: src/c/package.d
+--- src/c/package.d.orig
++++ src/c/package.d
+@@ -308,15 +308,14 @@ ecl_rename_package(cl_object x, cl_object name, cl_obj
+ }
+ 
+ /*
+-  ecl_find_package_nolock(n) seaches for a package with name n, where n is
+-  a valid string designator, or simply outputs n if it is a
+-  package.
++  ecl_find_package_nolock(n) seaches for a package with name n, where n is a
++  valid string designator, or simply outputs n if it is a package.
+ 
+-  This is not a locking routine and someone may replace the list of
+-  packages while we are scanning it. Nevertheless, the list IS NOT
+-  be destructively modified, which means that we are on the safe side.
+-  Routines which need to ensure that the package list remains constant
+-  should enforce a global lock with PACKAGE_OP_LOCK().
++  This is not a locking routine and someone may replace the list of packages
++  while we are scanning it. Nevertheless, the list IS NOT destructively
++  modified, which means that we are on the safe side.  Routines which need to
++  ensure that the package list remains constant should enforce a global lock
++  with PACKAGE_OP_LOCK().
+ */
+ cl_object
+ ecl_find_package_nolock(cl_object name)
+@@ -327,10 +326,12 @@ ecl_find_package_nolock(cl_object name)
+     return name;
+   name = cl_string(name);
+ 
+-  p = ecl_symbol_value(@'*package*');
+-  if (ECL_PACKAGEP(p)) {
+-    p = ecl_assoc(name, p->pack.local_nicknames);
+-    if (!Null(p)) return ECL_CONS_CDR(p);
++  if (ecl_option_values[ECL_OPT_BOOTED]) {
++    p = ecl_symbol_value(@'*package*');
++    if (ECL_PACKAGEP(p)) {
++      p = ecl_assoc(name, p->pack.local_nicknames);
++      if (!Null(p)) return ECL_CONS_CDR(p);
++    }
+   }
+ 
+   l = cl_core.packages;

Reply via email to