Subject: Re: ELF vs. a.out and Python 2.0 build
To: None <tech-pkg@NetBSD.ORG>
From: Kent Polk <kent@tiamat.goathill.org>
List: tech-pkg
Date: 11/10/2000 00:28:38
On 8 Nov 2000 17:22:02 GMT, Kent Polk wrote:
>IT appears to me that Python 2.0 shared modules build correctly on
>ELF machines, but aren't built correctly on the older a.out machines.
>
[...]
>Evidently there's a problem with the symbol naming mechanism to be
>used when building shared modules for a.out. I compared configure
>options with Python 1.5.2 and can't determine how this should be
>fixed for a.out with Python 2.0. (Tried a number of possibilities)
>
>Any suggestions? Thanks
A little help pointed me to the source of the problem. Python 2.0
has a new platform-independent runtime dynamic loading mechanism.
The typical unix loader assumes ELF, with a note wondering if this
was appropriate:
/* ### should there be a leading underscore for some platforms? */
sprintf(funcname, "init%.200s", shortname);
I added the following patch, which works, but as naieve as I am
about this stuff, I was wondering if the patch is appropriate for
other platforms (probably ought to change the comment). If so, I'll
submit it to the Python folks :
Thanks
-----------------------------------------------
--- dynload_shlib.c.org Wed Nov 8 20:01:21 2000
+++ dynload_shlib.c Wed Nov 8 20:38:49 2000
@@ -55,7 +55,11 @@
}
/* ### should there be a leading underscore for some platforms? */
- sprintf(funcname, "init%.200s", shortname);
+#ifndef __ELF__
+ sprintf(funcname, "_init%.200s", shortname);
+#else
+ sprintf(funcname, "init%.200s", shortname);
+#endif
if (fp != NULL) {
int i;