From: David Y. <dav...@in...> - 2011-02-15 17:27:05
|
This patch (committed at revision 170183) modifies the way gcil manages libstd calls. Now, each libstd function name is prefixed with "Libstd_", so that they can be linked with the implementation in libstd.so (for more information about "why this patch", take a look at the thread "Libstd, many doubts" in this mailing list). The ancient behavior of gcil is still supported, continue reading. ** New flags This behavior can be tuned with the following flags: -fcil-use-libstd (enabled by default), libstd.so is used. -fcil-use-libstd-builtins (enabled by default), also builtins (ie., cos, log, printf, etc.) are translated into libstd.so naming. And its complementary: -fno-cil-use-libstd-builtins, exclude builtins from translation . -fno-cil-use-libstd, don't translate anything at all (the behavior of gcil before this patch). I'd like to focus on the flag -fno-cil-use-libstd-builtins. I provided it because I thought that it can be interesting to keep the builtins as builtins (because of performance). But actually, calls such as printf make the final executable crash (probably because of interactions between libstd.so and system implementation). A further work will be to select only those builtins that can be considered safe (maths, for instance, pure constant functions). ** Briefly, how to use The traditional way: libstd calls are just bypassed to the system libraries. Absolutely unsafe, use at your own risk: $ gcil -fno-cil-use-libstd <... > The new way: linking with libstd.so: $ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<gcil-be-base-image>/lib/<ARCHITECTURE>/ $ gcil -lstd <...> ** How to build libstd.so This object belongs to the back end. In order to build it (we should incorporate it into the automake system of the back end): <cli-be-base>$ mkdir gcc-build/gcc/libstd <cli-be-base>$ cd gcc-build/gcc/libstd <cli-be-base>$ <cli-be-base>/gcc-src/gcc/libstd/configure --enable-native-lib --with-mcs=gmcs --prefix=<cli-be-base>/image <cli-be-base>$ make && make install |