[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-hackers] Re: csc -Ob (-O5) bug
From: |
Derrell Piper |
Subject: |
[Chicken-hackers] Re: csc -Ob (-O5) bug |
Date: |
Sat, 26 Dec 2009 14:59:24 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (darwin) |
PS,
I'm happy to assign this to myself and commit a fix to the trunk if
that's acceptable. Not sure what the commit protocol is around here...
The actual fix I'd submit is this (I moved the three places that swap
out the library lists to a single function):
diff --git a/csc.scm b/csc.scm
index 4f3afe5..b88c261 100644
--- a/csc.scm
+++ b/csc.scm
@@ -199,6 +199,7 @@
(define default-shared-library-files (if msvc
(list (string-append "libchicken."
library-extension))
'("-lchicken")))
+(define unsafe-libraries #f)
(define unsafe-library-files
(list
(quotewrap
@@ -209,6 +210,11 @@
(define unsafe-shared-library-files (if msvc
(list (string-append "libuchicken."
library-extension))
'("-luchicken")))
+(define (use-unsafe-libraries)
+ (set! unsafe-libraries #t)
+ (set! library-files unsafe-library-files)
+ (set! shared-library-files unsafe-shared-library-files))
+
(define gui-library-files default-library-files)
(define gui-shared-library-files default-shared-library-files)
(define library-files default-library-files)
@@ -639,8 +645,7 @@ EOF
[(|-O5|)
(set! rest (cons* "-optimize-level" "5" rest))
(t-options "-unsafe-libraries")
- (set! library-files unsafe-library-files)
- (set! shared-library-files unsafe-shared-library-files)
+ (use-unsafe-libraries)
(when (memq (build-platform) '(mingw32 cygwin gnu))
(set! compile-options
(cons* "-O3" "-fomit-frame-pointer" compile-options)) ) ]
@@ -685,8 +690,7 @@ EOF
(set! rest (cdr rest)) ]
[(-unsafe-libraries)
(t-options arg)
- (set! library-files unsafe-library-files)
- (set! shared-library-files unsafe-shared-library-files) ]
+ (use-unsafe-libraries) ]
[(-rpath)
(check s rest)
(when (eq? 'gnu (build-platform))
@@ -699,8 +703,7 @@ EOF
[else
(when (memq s '(-unsafe -benchmark-mode))
(when (eq? s '-benchmark-mode)
- (set! library-files unsafe-library-files)
- (set! shared-library-files unsafe-shared-library-files) ) )
+ (use-unsafe-libraries) ) )
(when (eq? s '-to-stdout)
(set! to-stdout #t)
(set! translate-only #t) )
@@ -845,14 +848,14 @@ EOF
(when (and osx (or (not cross-chicken) host-mode))
(unless (zero? ($system
(string-append
- "install_name_tool -change libchicken.dylib "
+ "install_name_tool -change lib" (if unsafe-libraries "u"
"") "chicken.dylib "
(quotewrap
(make-pathname
(prefix "" "lib"
(if host-mode
INSTALL_LIB_HOME
TARGET_RUN_LIB_HOME))
- "libchicken.dylib") )
+ (if unsafe-libraries "libuchicken.dylib"
"libchicken.dylib")) )
" "
target) ) )
(exit last-exit-code) ) )