chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] csc and -O3 vs. -O2


From: Peter BARABAS
Subject: [Chicken-users] csc and -O3 vs. -O2
Date: Thu, 27 May 2004 14:24:04 +0200
User-agent: Mutt/1.5.6i

Good day,


ix:~/devel/Scheme/CHICKEN$ cat bug.scm  
(define foo 1)

ix:~/devel/Scheme/CHICKEN$ csc -v -s -O3 bug.scm 
/usr/local/bin/chicken bug.scm -output-file bug.c -dynamic -feature
chicken-compile-shared -quiet -optimize-level 3
gcc bug.c -o bug.o -O3 -fomit-frame-pointer -fno-strict-aliasing -Wall
-Wno-unused -Wno-uninitialized -DHAVE_ALLOCA_H
-DC_STACK_GROWS_DOWNWARD=1
"-DC_INSTALL_LIB_HOME=\"/usr/local/lib/chicken\"" -DC_USE_C_DEFAULTS
-fPIC -DPIC -DC_SHARED -c -DC_NO_PIC_NO_DLL
rm bug.c
gcc -o bug.so bug.o -lchicken -lsrfi-chicken -lstuffed-chicken -fPIC
-shared -L/usr/local/lib -Wl,-R/usr/local/lib -ldl -lm  -ldl
rm bug.o

ix:~/devel/Scheme/CHICKEN$ csi -batch -quiet -eval '(load "bug.so")'
Error: code to load dynamically was linked with safe runtime libraries,
but executing runtime was not

After some debugging, it turned out that .so loading works fine if I
compile with -O2:

ix:~/devel/Scheme/CHICKEN$ csc -v -s -O2 bug.scm 
/usr/local/bin/chicken bug.scm -output-file bug.c -dynamic -feature
chicken-compile-shared -quiet -optimize-level 2
gcc bug.c -o bug.o -O3 -fomit-frame-pointer -fno-strict-aliasing -Wall
-Wno-unused -Wno-uninitialized -DHAVE_ALLOCA_H
-DC_STACK_GROWS_DOWNWARD=1
"-DC_INSTALL_LIB_HOME=\"/usr/local/lib/chicken\"" -DC_USE_C_DEFAULTS
-fPIC -DPIC -DC_SHARED -c -DC_NO_PIC_NO_DLL
rm bug.c
gcc -o bug.so bug.o -lchicken -lsrfi-chicken -lstuffed-chicken -fPIC
-shared -L/usr/local/lib -Wl,-R/usr/local/lib -ldl -lm  -ldl
rm bug.o

ix:~/devel/Scheme/CHICKEN$ csi -batch -quiet -eval '(load "bug.so")'
ix:~/devel/Scheme/CHICKEN$

I'm using CHICKEN 1.51 linux-unix-gnu-x86 and gcc 3.3.3 ( though I don't
think it matters ).


-- 
peter barabas . http://Y99k.com/    .    perl -wle 'print substr+qr,-,,-3'
                                                                         .
                                                                         .
Do not help people, if you can teach them to help themselves.            .





reply via email to

[Prev in Thread] Current Thread [Next in Thread]