diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 1999-07-14 21:59:11 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 1999-07-14 21:59:11 +0000 |
commit | 549a6b102c2ac8c43e32b815191190bc29aef348 (patch) | |
tree | 16371bf0a65e238e68327411cb8f20261ea5b5c0 /ext/DynaLoader | |
parent | 0033605d21c115bf932c13b3219a6ea9a9088d20 (diff) | |
download | perl-549a6b102c2ac8c43e32b815191190bc29aef348.tar.gz |
Fixed AIX dynamic loading and AIX shared Perl library.
Tested in: AIX 4.1.5 cc+useshrplib+usethreads, 4.1.5 cc,
4.1.5 gcc+useshrplib+usethreads, 4.3.1 cc+useshrplib.
Hijacked win32/makedef.pl for more general purpose export
list building, now it is used (as toplevel makedef.pl)
for win32 and AIX (perl_exp.SH made unnecessary).
Because the export lists are now correct in AIX, no more linker
warnings about "Exported symbol not defined" should appear.
p4raw-id: //depot/cfgperl@3673
Diffstat (limited to 'ext/DynaLoader')
-rw-r--r-- | ext/DynaLoader/DynaLoader_pm.PL | 2 | ||||
-rw-r--r-- | ext/DynaLoader/dl_aix.xs | 38 |
2 files changed, 25 insertions, 15 deletions
diff --git a/ext/DynaLoader/DynaLoader_pm.PL b/ext/DynaLoader/DynaLoader_pm.PL index cf7d7085bc..96c9962708 100644 --- a/ext/DynaLoader/DynaLoader_pm.PL +++ b/ext/DynaLoader/DynaLoader_pm.PL @@ -191,7 +191,7 @@ sub bootstrap { # it executed. my $libref = dl_load_file($file, $module->dl_load_flags) or - croak("Can't load '$file' for module $module: ".dl_error()."\n"); + croak("Can't load '$file' for module $module: ".dl_error()); push(@dl_librefs,$libref); # record loaded object diff --git a/ext/DynaLoader/dl_aix.xs b/ext/DynaLoader/dl_aix.xs index 78e434303a..877b28543a 100644 --- a/ext/DynaLoader/dl_aix.xs +++ b/ext/DynaLoader/dl_aix.xs @@ -77,14 +77,14 @@ typedef struct Module { * We keep a list of all loaded modules to be able to call the fini * handlers at atexit() time. */ -static ModulePtr modList; /* XXX threadead */ +static ModulePtr modList; /* XXX threaded */ /* * The last error from one of the dl* routines is kept in static * variables here. Each error is returned only once to the caller. */ -static char errbuf[BUFSIZ]; /* XXX threadead */ -static int errvalid; /* XXX threadead */ +static char errbuf[BUFSIZ]; /* XXX threaded */ +static int errvalid; /* XXX threaded */ static void caterr(char *); static int readExports(ModulePtr); @@ -103,7 +103,7 @@ char *strerrorcat(char *str, int err) { if (buf == 0) return 0; - if (strerror_r(err, buf, sizeof(buf)) == 0) + if (strerror_r(err, buf, BUFSIZ) == 0) msg = buf; else msg = strerror_r_failed; @@ -131,7 +131,7 @@ char *strerrorcpy(char *str, int err) { if (buf == 0) return 0; - if (strerror_r(err, buf, sizeof(buf)) == 0) + if (strerror_r(err, buf, BUFSIZ) == 0) msg = buf; else msg = strerror_r_failed; @@ -155,7 +155,7 @@ void *dlopen(char *path, int mode) { dTHX; register ModulePtr mp; - static int inited; /* XXX threadead */ + static int inited; /* XXX threaded */ /* * Upon the first call register a terminate handler that will @@ -188,11 +188,19 @@ void *dlopen(char *path, int mode) safefree(mp); return NULL; } + /* * load should be declared load(const char *...). Thus we * cast the path to a normal char *. Ugly. */ - if ((mp->entry = (void *)load((char *)path, L_NOAUTODEFER, NULL)) == NULL) { + if ((mp->entry = (void *)load((char *)path, +#ifdef L_LIBPATH_EXEC + L_LIBPATH_EXEC | +#endif + L_NOAUTODEFER, + NULL)) == NULL) { + int saverrno = errno; + safefree(mp->name); safefree(mp); errvalid++; @@ -204,17 +212,17 @@ void *dlopen(char *path, int mode) * can be further described by querying the loader about * the last error. */ - if (errno == ENOEXEC) { - char *tmp[BUFSIZ/sizeof(char *)]; - if (loadquery(L_GETMESSAGES, tmp, sizeof(tmp)) == -1) - strerrorcpy(errbuf, errno); + if (saverrno == ENOEXEC) { + char *moreinfo[BUFSIZ/sizeof(char *)]; + if (loadquery(L_GETMESSAGES, moreinfo, sizeof(moreinfo)) == -1) + strerrorcpy(errbuf, saverrno); else { char **p; - for (p = tmp; *p; p++) + for (p = moreinfo; *p; p++) caterr(*p); } } else - strerrorcat(errbuf, errno); + strerrorcat(errbuf, saverrno); return NULL; } mp->refCnt = 1; @@ -226,10 +234,12 @@ void *dlopen(char *path, int mode) * of the perl core are in the same shared object. */ if (loadbind(0, (void *)dlopen, mp->entry) == -1) { + int saverrno = errno; + dlclose(mp); errvalid++; strcpy(errbuf, "loadbind: "); - strerrorcat(errbuf, errno); + strerrorcat(errbuf, saverrno); return NULL; } if (readExports(mp) == -1) { |