From d4e40e0b256ab15d633075cd35f5bfc1ae791307 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 10 Sep 2009 19:39:37 +0000 Subject: [PATCH] fix some problems with sandboxes and extension (PR 10381) and Snow Leopard extension building (also demonstrated by PR 10381) svn: r15964 --- collects/dynext/compile-unit.ss | 4 +++- collects/dynext/link-unit.ss | 6 ++++-- collects/scheme/sandbox.ss | 9 +++++++-- collects/syntax/modcode.ss | 5 ++++- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/collects/dynext/compile-unit.ss b/collects/dynext/compile-unit.ss index aa593ec925..f2d9099cb6 100644 --- a/collects/dynext/compile-unit.ss +++ b/collects/dynext/compile-unit.ss @@ -65,8 +65,10 @@ (define gcc-cpp-flags (add-variant-flags (case (string->symbol (path->string (system-library-subpath #f))) [(parisc-hpux) '("-D_HPUX_SOURCE")] - [(ppc-macosx i386-macosx) '("-DOS_X")] + [(ppc-macosx) '("-DOS_X")] + [(i386-macosx) '("-DOS_X" "-m32")] [(ppc-darwin) '("-DOS_X" "-DXONX")] + [(i386-darwin) '("-DOS_X" "-DXONX" "-m32")] [else null]))) (define gcc-compile-flags (append '("-c" "-O2" "-fPIC") diff --git a/collects/dynext/link-unit.ss b/collects/dynext/link-unit.ss index a594be35d3..14120dccde 100644 --- a/collects/dynext/link-unit.ss +++ b/collects/dynext/link-unit.ss @@ -124,6 +124,8 @@ (define win-gcc-linker-flags (list "--dll")) (define borland-linker-flags (list "/Tpd" "/c")) + (define mac-link-flags (list "-bundle" "-flat_namespace" "-undefined" "suppress")) + (define (get-unix-link-flags) (case (string->symbol (path->string (system-library-subpath #f))) [(sparc-solaris i386-solaris) (list "-G")] @@ -138,8 +140,8 @@ (format "-bE:~a/ext.exp" include-dir) "-bnoentry")] [(parisc-hpux) (list "-b")] - [(ppc-macosx ppc-darwin i386-macosx i386-darwin) - (list "-bundle" "-flat_namespace" "-undefined" "suppress")] + [(ppc-macosx ppc-darwin) mac-link-flags] + [(i386-macosx i386-darwin) (append mac-link-flags '("-m32"))] [(i386-cygwin) win-gcc-linker-flags] [else (list "-fPIC" "-shared")])) diff --git a/collects/scheme/sandbox.ss b/collects/scheme/sandbox.ss index 9b0e37b50b..d63694396e 100644 --- a/collects/scheme/sandbox.ss +++ b/collects/scheme/sandbox.ss @@ -266,8 +266,13 @@ (simplify-path* (resolve-module-path-index i path))) (filter (lambda (i) (and (module-path-index? i) (not (lib? i)))) - (append-map cdr (module-compiled-imports - (get-module-code path)))))) + (append-map cdr (let ([m (get-module-code + path + #:extension-handler + (lambda (path loader?) #f))]) + (if m + (module-compiled-imports m) + null)))))) (cons path r)))]))) ;; Resources ---------------------------------------------------------------- diff --git a/collects/syntax/modcode.ss b/collects/syntax/modcode.ss index 74832df19c..b0f732497d 100644 --- a/collects/syntax/modcode.ss +++ b/collects/syntax/modcode.ss @@ -72,7 +72,10 @@ (define-struct (exn:get-module-code exn) (path)) (define (get-module-code path - [sub-path "compiled"] [compiler compile] [extension-handler #f] + #:sub-path [sub-path0 "compiled"] + #:compile [compile0 compile] + #:extension-handler [ext-handler0 #f] + [sub-path sub-path0] [compiler compile0] [extension-handler ext-handler0] #:choose [choose (lambda (src zo so) #f)] #:notify [notify void] #:source-reader [read-src-syntax read-syntax])