Summary

csc -Ob (-O5) bug (unsafe)

Metadata

Attachments

Description

OS X, 10.6.2 (Snow Leopard), Chicken 4.3.0

There's a bug with the unsafe processing in csc. When it's compiling unsafe, it doesn't reflect this out to the 'install_name_tool' invocation, resulting in no fixup in the resulting image. So if libuchicken.dylib doesn't happen to be in the standard library search path, it blows up at runtime:

fluffy656% csc -verbose hello.scm /usr/local/chicken/bin/chicken hello.scm -output-file hello.c -verbose Loading compiler extensions... debugging info: calltrace loading identifier database /usr/local/chicken/lib/chicken/4/modules.db ... compiling `hello.scm' ... pass: source pass: canonicalized pass: initial node tree pass: cps pass: analysis pass: optimized-iteration pass: analysis pass: optimized-iteration pass: analysis pass: optimized-iteration pass: analysis pass: optimized pass: final-analysis pass: closure-converted generating `hello.c' ... compilation finished. gcc hello.c -o hello.o -c -no-cpp-precomp -fno-strict-aliasing -fno-common -DHAVE_CHICKEN_CONFIG_H -m64 -DC_ENABLE_PTABLES -Os -fomit-frame-pointer -I/usr/local/chicken/include rm hello.c gcc hello.o -o hello -m64 -L/usr/local/chicken/lib -lchicken -lm install_name_tool -change libchicken.dylib /usr/local/chicken/lib/libchicken.dylib hello rm hello.o fluffy657% otool -L hello hello:

/usr/local/chicken/lib/libchicken.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.0.0)

fluffy658% ./hello Hello, World!

fluffy659% csc -O5 -verbose hello.scm /usr/local/chicken/bin/chicken hello.scm -output-file hello.c -unsafe-libraries -optimize-level 5 -verbose Loading compiler extensions... debugging info: none loading identifier database /usr/local/chicken/lib/chicken/4/modules.db ... compiling `hello.scm' ... pass: source pass: canonicalized pass: initial node tree pass: analysis pass: lambda lifted pass: cps pass: analysis pass: optimized-iteration pass: analysis pass: optimized-iteration pass: analysis pass: optimized-iteration pass: analysis pass: optimized pass: final-analysis pass: closure-converted generating `hello.c' ... compilation finished. gcc hello.c -o hello.o -c -no-cpp-precomp -fno-strict-aliasing -fno-common -DHAVE_CHICKEN_CONFIG_H -m64 -DC_ENABLE_PTABLES -Os -fomit-frame-pointer -O3 -fomit-frame-pointer -I/usr/local/chicken/include rm hello.c gcc hello.o -o hello -m64 -L/usr/local/chicken/lib -luchicken -lm install_name_tool -change libchicken.dylib /usr/local/chicken/lib/libchicken.dylib hello rm hello.o fluffy660% otool -L hello hello:

libuchicken.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.0.0)

fluffy661% ./hello dyld: Library not loaded: libuchicken.dylib

 Referenced from: /Users/ddp/src/scm/./hello
 Reason: image not found

Trace/BPT trap fluffy662% install_name_tool -change libuchicken.dylib /usr/local/chicken/lib/libuchicken.dylib hello fluffy663% ./hello Hello, World!

Changes and comments

[2009-12-26 17:01:13 UTC] ddp attached csc.scm.patch (description=patch)

[2009-12-26 18:07:35 UTC] ddp attached csc.scm.2.patch (description=a better patch)

[2009-12-26 20:54:59 UTC] ddp changed milestone from 4.3.0 to 4.4.0

[2009-12-29 01:07:58 UTC] felix changed status from new to accepted

[2009-12-29 01:07:58 UTC] felix set owner to felix

[2009-12-31 01:16:54 UTC] felix changed status from accepted to closed

[2009-12-31 01:16:54 UTC] felix set resolution to fixed

[2009-12-31 01:16:54 UTC] felix wrote:

Patch applied in commit 076d3c14ef009d430fc8cb3458c3a1ecd478c113 (master). Thanks a lot.

[2010-03-11 10:33:12 UTC] Milestone 4.4.0 deleted