~ chicken-core (master) d490fc02344e00b8f5d5e4b4c61a6e04a8c10652


commit d490fc02344e00b8f5d5e4b4c61a6e04a8c10652
Author:     Peter Bex <peter@more-magic.net>
AuthorDate: Mon Oct 19 14:44:06 2026 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Mon Oct 19 22:20:10 2026 +0200

    Refuse to compile in block mode when also emitting import libraries
    
    The emitted import library cannot be used in block mode, because block
    mode uses a closed world assumption in which anything may be inlined.
    Nothing from the unit is visible to other compilation units, this even
    includes module exports.
    
    (reported by "Juan")
    
    Signed-off-by: felix <felix@call-with-current-continuation.org>

diff --git a/NEWS b/NEWS
index 277519a1..61c478bf 100644
--- a/NEWS
+++ b/NEWS
@@ -93,6 +93,7 @@
   - Fix misspelled primitives in extended bindings list for compiler
     rewrites, added rewrites for R7RS bytevector operations (thanks
     to Massimo Nocentini).
+  - Refuse block compilation while emitting import libs (reported by "Juan").
 
 6.0.0
 
diff --git a/batch-driver.scm b/batch-driver.scm
index b03bda09..cd023871 100644
--- a/batch-driver.scm
+++ b/batch-driver.scm
@@ -572,6 +572,9 @@
 	       '() ) ) )
 	(dribble "generating ~aprofiled code" (if acc "accumulative " "")) ))
 
+    (when (and block-compilation (or all-import-libraries (pair? import-libraries)))
+      (quit-compiling "Cannot combine block compilation mode with emitting import libraries"))
+
     ;;XXX hardcoded "modules.db" is bad (also used in chicken-install.scm)
     (load-identifier-database "modules.db")
 
diff --git a/manual/Using the compiler b/manual/Using the compiler
index 114b48ed..c14085a9 100644
--- a/manual/Using the compiler	
+++ b/manual/Using the compiler	
@@ -24,7 +24,7 @@ the source text should be read from standard input.
 
 ; -analyze-only : Stop compilation after first analysis pass.
 
-; -block : Enable block-compilation. When this option is specified, the compiler assumes that global variables are not modified outside of this compilation-unit.  Specifically, toplevel bindings are not seen by {{eval}} and unused toplevel bindings are removed.
+; -block : Enable block-compilation. When this option is specified, the compiler assumes that global variables are not modified outside of this compilation-unit.  Specifically, toplevel bindings are not seen by {{eval}} and unused toplevel bindings are removed.  Note that you cannot combine this with -j or -J because even exported identifiers are hidden.
 
 ; -case-insensitive : Enables the reader to read symbols case insensitive. The default is to read case sensitive (in violation of R5RS).  This option registers the {{case-insensitive}} feature identifier.
 
Trap