Improving underscore detection

Alexandre Oliva oliva at dcc.unicamp.br
Sat Aug 15 18:00:09 PDT 1998


Hi!

Petter Reinholdtsen <pere at cc.uit.no> has just called my attention to
the underscore detection mechanism of Kaffe.  There's much room for
improvement.

First of all, the C code that detects whether the C compiler inserts
underscores needs not be executed; linking is enough, so the attached
patch does exactly that, which allows the test to be performed even
when cross-compiling.  I've tested it on several platforms, and the
existing functionality was retained.

The second issue has to do with the code that tests whether dlopen
needs leading underscores in symbol names.  On SunOS 4.1.3, leading
underscores are optional (but it's better to use them).  However, the
test fails to run because dlopen() cannot be used to link libc in.
This problem may explain why Kaffe can't run on SunOS 4.1.3; I'll
investigate.

The correct approach, that is taken by Japhar, is to created a shared
library that defines a known symbol, create a test program that
dlopen()s the just-created library and tries to find the symbol in it.
If we used libtool in Kaffe, the test used in Japhar could be simply
copied into Kaffe.  I can do that for sure, because I contributed
myself the test code to Japhar.

-- 
Alexandre Oliva
mailto:oliva at dcc.unicamp.br mailto:aoliva at acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil
-------------- next part --------------
A non-text attachment was scrubbed...
Name: underscore.diff
Type: application/octet-stream
Size: 1117 bytes
Desc: not available
Url : http://kaffe.org/pipermail/kaffe/attachments/19980815/a0c36235/attachment-0007.obj 


More information about the kaffe mailing list