OriginalBugID: 2637 Bug
Version: 8.2
SubmitDate: '1999-08-31'
LastModified: '2000-02-02'
Severity: CRIT
Status: Closed
Submitter: techsupp
ChangedBy: ericm
OS: Solaris
OSVersion: V2.6 and V2.5.1
Machine: Other
FixedDate: '2000-10-25'
ClosedDate: '2000-02-02'
Name:
Duncan Webb
Extensions:
None
ReproducibleScript:
We've build a shared object (.so) to interface to an application. The
code is written in C++. It has been compiled with the SUNspro V4.2 C++
compiler and the build process is performed on Solaris V2.6.
When the Tcl load command is executed, under Tcl8.0.4/Tcl8.1/Tcl8.2
running on Solaris V2.6, to load the shared object the program cores
with an illegal instruction error. When exactly the same code is loaded
under Solaris 2.5.1 the load is successful.
The core file reveals that dlopen() command has been called.
The Tcl8.1 version has been downloaded and installed from the Sun site,
the other two version of Tcl were compiled under Solaris 2.6.
I've written a small test harness to execute the dlopen() command and
this worked correctly under both versions of Solaris. The test harness
is:
#include <stdio.h>
#include <dlfcn.h>
int main(int argc, char *argv[])
{
char *name = "/opt2/summit/V2.6/lib/libstktcl1.1.so";
fprintf(stderr, "about to load \"%s\"\n", name);
void *p = dlopen(name, RTLD_NOW | RTLD_GLOBAL);
if (p == NULL) {
fprintf(stderr, "cannot load \"%s\" reason \"%s\"\n", name,
dlerror());
} else {
fprintf(stderr, "loaded \"%s\" at %p\n", name, p);
}
char *sym1 = "Stktcl_Init";
void *addr1 = dlsym(p, sym1);
if (addr1 == NULL) {
fprintf(stderr, "cannot find symbol \"%s\" reason \"%s\"\n",
sym1, dlerror());
} else {
fprintf(stderr, "found symbol \"%s\" at %p\n", sym1, addr1);
}
char *sym2 = "Stktcl_SafeInit";
void *addr2 = dlsym(p, sym2);
if (addr2 == NULL) {
fprintf(stderr, "cannot find symbol \"%s\" reason \"%s\"\n",
sym2, dlerror());
} else {
fprintf(stderr, "found symbol \"%s\" at %p\n", sym2, addr2);
}
int rc = dlclose(p);
if (rc) {
fprintf(stderr, "cannot unload \"%s\" reason \"%s\"\n", name,
dlerror());
} else {
fprintf (stderr, "unloaded \"%s\"\n", name);
}
return 0;
}
ObservedBehavior:
t@1 (l@1) terminated by signal ILL (illegal opcode)
Current function is TclpLoadFile
78 handle = dlopen(native, RTLD_NOW | RTLD_GLOBAL); /* INTL:
Native. */
current thread: t@1
[1] 0xed6d68b4(0xed6d5d64, 0x0, 0x0, 0x0, 0x0, 0x0), at 0xed6d68b3
[2] _init(0xeddf0c2c, 0x0, 0xef7ed130, 0xef7ed118, 0xed676ad0,
0xef7c9f18), at 0xed6c315c
[3] call_init(0xed7e1bc4, 0xef7ed110, 0xef7ec9c0, 0x400000, 0x80000,
0x4201), at 0xef7c9f50
[4] elf_intp_find_sym(0xed7e1a40, 0xeddf068c, 0xed7e1700, 0x4,
0xed7e16e0, 0xef7ec9c0), at 0xef7c69c0
[5] lookup_sym(0x0, 0xefffe030, 0x0, 0xef7b0148, 0xedd90ed0,
0x1ff1be4), at 0xef7c47d0
[6] elf_reloc(0xeddf068c, 0xeddd2f80, 0xc, 0xeddd0000, 0xeddd2f80,
0xed692078), at 0xef7d0670
[7] relocate_so(0xeddf068c, 0xef7ed2ac, 0xef7ec9c0, 0x4000000,
0xffffbfff, 0x4000), at 0xef7c3a80
[8] dl_new_so(0xeddf1c24, 0xefffe244, 0xef7ed25c, 0xefffe1cc,
0xef7ed2b8, 0x0), at 0xef7cd580
[9] dlmopen_core(0xef7ed210, 0xefffe244, 0xd02, 0x102, 0xefffe1cc,
0xef7b08f4), at 0xef7cd124
[10] dlmopen_lock(0xef7ed210, 0xefffe244, 0xd02, 0xef7b08f4,
0xef7ec9c0, 0x102), at 0xef7cd270
=>[11] TclpLoadFile(interp = 0x239c0, fileName = 0xefffe4a0
"/opt2/summit/V2.6/lib/libstktcl1.1.so", sym1 = 0xefffe648
"Stktcl_Init", sym2 = 0xefffe574 "Stktcl_SafeInit", proc1Ptr =
0xefffe490, proc2Ptr = 0xefffe48c, clientDataPtr = 0xefffe464), line 78
in "tclLoadDl.c"
[12] Tcl_LoadObjCmd(dummy = (nil), interp = 0x239c0, objc = 2, objv =
0x25710), line 333 in "tclLoad.c"
[13] TclExecuteByteCode(interp = 0x239c0, codePtr = 0x3e8c8), line 844
in "tclExecute.c"
[14] Tcl_EvalObjEx(interp = 0x239c0, objPtr = 0x2beb8, flags = 0),
line 2698 in "tclBasic.c"
[15] Tcl_RecordAndEvalObj(interp = 0x239c0, cmdPtr = 0x2beb8, flags =
0), line 142 in "tclHistory.c"
[16] Tcl_Main(argc = 1, argv = 0xeffff1c4, appInitProc = 0x10b20 =
&Tcl_AppInit(Tcl_Interp *interp)), line 236 in "tclMain.c"
[17] main(argc = 1, argv = 0xeffff1c4), line 83 in "tclAppInit.c"
I don't have enough information to debug this problem. If you have a minimal test case (ie, a small library that causes this behavior), that would be helpful. Also, have you tried compiling with gcc/g++? An error like "illegal opcode" probably means that something is generating bad machine code, which makes the compiler a suspect. If you could try compiling with gcc/g++ and inform us of the results, that would be quite helpful. And if you can send us source for a minimal test case, that would be great too.
Thank you,
- eric
-- 02/01/2000 ericm
From the user:
I found the problem for this quite a while ago. The problem was with the
threads model, one library was using a different model than another. I can't
remember exactly how I fixed it.
Regards,
Duncan
-- 02/02/2000 ericm
|