[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem with new binutils?
- To: tech_(_at_)_openbsd_(_dot_)_org
- Subject: Problem with new binutils?
- From: Kurt Miller <truk_(_at_)_optonline_(_dot_)_net>
- Date: Fri, 21 May 2004 16:53:39 -0400
I know I'm on the bleeding edge by using the new binutils, but
I ran into this problem:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10877
with the old version using gcc3, so I upgraded to avoid that.
I'm experiencing a new problem (i386, gcc3). It appears to be a
dynamic linking problem that I found while building the native 1.3
jdk. Calling strcpy segfaults, but strdup is fine. It looks like the
GOT entry for strcpy is bad.
The following debug session shows the problem in detail.
Breakpoint 12, GetJavaProperties () at ../../../src/solaris/native/java/lang/java_props_md.c:242
242 lc = strdup(lc); /* keep a copy, setlocale trashes original. */
1: x/i $eip 0x408f1d7 <GetJavaProperties+287>: sub $0xc,%esp
(gdb) stepi 5
242 lc = strdup(lc); /* keep a copy, setlocale trashes original. */
1: x/i $eip 0x408f1f9 <GetJavaProperties+321>: call 0x4087ab8 <_init+1928>
(gdb) stepi
0x04087ab8 in ?? () from /usr/ports/devel/jdk/1.3.native/w-jdk-1.3.1-no_plugin/j2sdk1.3.1/build/bsd-i386/lib/i386/libjava_g.so
1: x/i $eip 0x4087ab8 <_init+1928>: jmp *0x1e8(%ebx)
(gdb) p /x *(int *)($ebx+0x1e8)
$104 = 0xfea6e5c <-- ***** CORRECT matches &strdup
(gdb) p &strdup
$105 = (char *(*)(const char *)) 0xfea6e5c <strdup>
(gdb) stepi
strdup (str=0x2fe4fee0 "C") at /usr/src/lib/libc/string/strdup.c:48
48 {
1: x/i $eip 0xfea6e5c <strdup>: push %ebp
(gdb) finish
Run till exit from #0 strdup (str=0x2fe4fee0 "C") at /usr/src/lib/libc/string/strdup.c:48
GetJavaProperties () at ../../../src/solaris/native/java/lang/java_props_md.c:243
243 strcpy(temp, lc);
1: x/i $eip 0x408f1fe <GetJavaProperties+326>: pop %ecx
Value returned is $106 = 0x3c064300 "C"
(gdb) stepi 7
0x0408f210 243 strcpy(temp, lc);
1: x/i $eip 0x408f210 <GetJavaProperties+344>: call 0x4087358 <_init+40>
(gdb) stepi
0x04087358 in ?? () from /usr/ports/devel/jdk/1.3.native/w-jdk-1.3.1-no_plugin/j2sdk1.3.1/build/bsd-i386/lib/i386/libjava_g.so
1: x/i $eip 0x4087358 <_init+40>: jmp *0x10(%ebx)
(gdb) p /x *(int *)($ebx+0x10)
$107 = 0x735e <----- ****** WRONG should match &strcpy
(gdb) p &strcpy
$108 = (<text variable, no debug info> *) 0xfe522c4 <strcpy>
(gdb) stepi
0x0000735e in ?? ()
1: x/i $eip 0x735e: Error accessing memory address 0x735e: Invalid argument.
Disabling display 1 to avoid infinite recursion.
(gdb) stepi
Program received signal SIGSEGV, Segmentation fault.
0x0000735e in ?? ()
Visit your host, monkey.org