https://qa.mandrakesoft.com/show_bug.cgi?id=602
[EMAIL PROTECTED] changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID ------- Additional Comments From [EMAIL PROTECTED] 2003-02-08 16:19 ------- Invalid accoding to previous comment. Works as follows: [gbeauchesne@thalys dso]$ gcc -fPIC -c junk2.c [gbeauchesne@thalys dso]$ gcc -shared -o junk2.so junk2.o [gbeauchesne@thalys dso]$ gcc main.c ./junk2.so [gbeauchesne@thalys dso]$ ./a.out sys_errlist[2]: No such file or directory ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. ------- Reminder: ------- assigned_to: [EMAIL PROTECTED] status: RESOLVED creation_date: description: Sytem is installed from "Mandrake Linux release 9.0 (dolphin)" CDs Expected output: sys_errlist[2]: No such file or directory Current output: bogus sys_errlist Details: $ cat main.c int main() { return test(); } $ cat junk2.c #include <stdio.h> test() { const char *s = sys_errlist[2]; if (s) { printf("sys_errlist[2]: %s\n", s); } else { fprintf(stderr, "bogus sys_errlist\n"); return 1; } return 0; } $ gcc -g -c -fPIC junk2.c $ ld -shared -o junk2.so junk2.o $ gcc -g main.c ./junk2.so $ ./a.out bogus sys_errlist $ gdb a.out GNU gdb 5.2.1-2mdk (Mandrake Linux) Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i586-mandrake-linux-gnu"... (gdb) b main Breakpoint 1 at 0x80484a6: file main.c, line 3. (gdb) r Breakpoint 1, main () at main.c:3 3 return test(); (gdb) step test () at junk2.c:5 5 const char *s = sys_errlist[2]; (gdb) x/10i $pc 0x400133c6 <test+18>: mov 0x14(%ebx),%eax 0x400133cc <test+24>: mov 0x8(%eax),%edx 0x400133cf <test+27>: mov %edx,0xfffffffc(%ebp) 0x400133d2 <test+30>: cmpl $0x0,0xfffffffc(%ebp) 0x400133d6 <test+34>: je 0x400133f2 <test+62> 0x400133d8 <test+36>: add $0xfffffff8,%esp 0x400133db <test+39>: mov 0xfffffffc(%ebp),%eax 0x400133de <test+42>: push %eax 0x400133df <test+43>: lea 0xffffef47(%ebx),%edx 0x400133e5 <test+49>: mov %edx,%eax (gdb) stepi (gdb) p/a $eax $1 = 0x4013c0e0 <sys_siglist> (gdb) ### should have been sys_errlist !!! (gdb) n 6 if (s) { (gdb) p s $2 = 0x0 (gdb) p &sys_errlist $4 = (<data variable, no debug info> *) 0x4013eb60 (gdb) x/3x 0x4013eb60 0x4013eb60 <sys_errlist>: 0x401369d3 0x401369db 0x401369f3 (gdb) x/s 0x401369f3 0x401369f3 <in6addr_loopback+8011>: "No such file or directory" (gdb) c bogus sys_errlist Program exited with code 01. (gdb) quit Workaround: relinking junk2.so with '-lc' magically cures the bug: $ ld -shared -o junk2.so junk2.o -lc $ ./a.out sys_errlist[2]: No such file or directory