This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug dynamic-link/14370] SIGFPE in 'ldd -r'


http://sourceware.org/bugzilla/show_bug.cgi?id=14370

--- Comment #8 from H.J. Lu <hjl.tools at gmail dot com> 2012-09-02 20:00:15 UTC ---
(In reply to comment #0)
> Created attachment 6536 [details]
> testcase
> 
> $ ldd -r SceMiDpiBridge.so
>         linux-gate.so.1 (0xf76eb000)
>         libsds_server.so => not found
>         libxtor_threads_boost.so => not found
>         libaldecpli.so => not found
>         libsvdpi_exp.so => not found
>         libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xf755e000)
>         libsce_mi.so => not found
>         libScemiDpiBridgeApi.so => not found
>         libm.so.6 => /lib/libm.so.6 (0xf7520000)
>         libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xf7505000)
>         librt.so.1 => /lib/librt.so.1 (0xf74fb000)
>         libc.so.6 => /lib/libc.so.6 (0xf735b000)
>         /lib/ld-linux.so.2 (0xf76ec000)
>         libpthread.so.0 => /lib/libpthread.so.0 (0xf7340000)
> Floating point exception

This DSO is bad in several ways:

[hjl@gnu-6 pr14370]$ readelf -d pr14370.so 

Dynamic section at offset 0x953e0 contains 29 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libsds_server.so]
 0x00000001 (NEEDED)                     Shared library:
[libxtor_threads_boost.so]
 0x00000001 (NEEDED)                     Shared library: [libaldecpli.so]
 0x00000001 (NEEDED)                     Shared library: [libsvdpi_exp.so]
 0x00000001 (NEEDED)                     Shared library: [libstdc++.so.6]
 0x00000001 (NEEDED)                     Shared library: [libsce_mi.so]
 0x00000001 (NEEDED)                     Shared library:
[libScemiDpiBridgeApi.so]
 0x00000001 (NEEDED)                     Shared library: [libm.so.6]
 0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
 0x0000000c (INIT)                       0x1de28
 0x0000000d (FINI)                       0x794d4
 0x00000004 (HASH)                       0xd4
 0x00000005 (STRTAB)                     0x6558
 0x00000006 (SYMTAB)                     0x21d8
 0x0000000a (STRSZ)                      15815 (bytes)
 0x0000000b (SYMENT)                     16 (bytes)
 0x00000003 (PLTGOT)                     0x955c0
 0x00000002 (PLTRELSZ)                   856 (bytes)
 0x00000014 (PLTREL)                     REL
 0x00000017 (JMPREL)                     0x1dad0
 0x00000011 (REL)                        0xabf0
 0x00000012 (RELSZ)                      77536 (bytes)
 0x00000013 (RELENT)                     8 (bytes)
 0x00000016 (TEXTREL)                    0x0
 0x6ffffffe (VERNEED)                    0xab90
 0x6fffffff (VERNEEDNUM)                 2
 0x6ffffff0 (VERSYM)                     0xa320
 0x6ffffffa (RELCOUNT)                   3970
 0x00000000 (NULL)                       0x0
[hjl@gnu-6 pr14370]$ readelf -sWr pr14370.so | grep errno | tail -5
00078dcc  0003a502 R_386_PC32             00033110   __errno_location
00033120  0000ad01 R_386_32               00097254   errno
   173: 00097254     4 OBJECT  GLOBAL DEFAULT   27 errno
   933: 00033110    37 FUNC    WEAK   DEFAULT   10 __errno_location
   959: 00097254     4 OBJECT  GLOBAL DEFAULT   27 _errno
[hjl@gnu-6 pr14370]$ 

1. It wasn't compiled with -fPIC.
2. It wasn't linked against libc.so.
3. It defines errno as int.

A testcase:

[hjl@gnu-6 pr14370]$ cat x.c 
int errno = 3;

extern void foo (void);

int
bar (void)
{
  foo ();
  return errno;
}
[hjl@gnu-6 pr14370]$ cat foo.c
void
foo (void)
{
}
[hjl@gnu-6 pr14370]$  gcc -m32 -shared -o libm.so.6 foo.c -fPIC
[hjl@gnu-6 pr14370]$ gcc -m32 x.c -c       
[hjl@gnu-6 pr14370]$ ld -m elf_i386  -shared x.o libm.so.6   
[hjl@gnu-6 pr14370]$ ldd -r a.out  
    linux-gate.so.1 =>  (0xf7ffd000)
    libm.so.6 => /lib/libm.so.6 (0xf7fad000)
    /lib/ld-linux.so.2 (0x56555000)
    libc.so.6 => /lib/libc.so.6 (0xf7dfb000)
/usr/local/bin/ldd: line 118: 17528 Floating point
exceptionLD_TRACE_LOADED_OBJECTS=1 LD_WARN=yes LD_BIND_NOW=yes
LD_LIBRARY_VERSION=$verify_out LD_VERBOSE= "$@"
[hjl@gnu-6 pr14370]$

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]