public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug dynamic-link/14370] ld.so crashes on mismatched TLS/non-TLS symbols
Date: Tue, 04 Sep 2012 21:32:00 -0000	[thread overview]
Message-ID: <bug-14370-131-xyC4biZAfH@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-14370-131@http.sourceware.org/bugzilla/>

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

--- Comment #17 from H.J. Lu <hjl.tools at gmail dot com> 2012-09-04 21:32:31 UTC ---
Created attachment 6624
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6624
A patch

With the patch, I got

[hjl@gnu-6 pr14370]$ LD_TRACE_LOADED_OBJECTS=1 LD_WARN=yes LD_BIND_NOW=yes
LD_LIBRARY_VERSION=6   ./ld.so ./pr14370.so 
    linux-gate.so.1 (0xf7ffd000)
    libsds_server.so => not found
    libxtor_threads_boost.so => not found
    libaldecpli.so => not found
    libsvdpi_exp.so => not found
    libstdc++.so.6 => /lib/libstdc++.so.6 (0xf7e57000)
    libsce_mi.so => not found
    libScemiDpiBridgeApi.so => not found
    libm.so.6 => /lib/libm.so.6 (0xf7e2c000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xf7e0f000)
    libc.so.6 => /lib/libc.so.6 (0xf7c5c000)
    ./ld.so (0x56555000)
TLS definition `errno' mismatches non-TLS reference in ./pr14370.so   
(/lib/libm.so.6)
undefined symbol: svSetScope    (./pr14370.so)
undefined symbol: svGetScope    (./pr14370.so)
undefined symbol: svGetCallerInfo    (./pr14370.so)
undefined symbol: svGetNameFromScope    (./pr14370.so)
undefined symbol: svGetScopeFromName    (./pr14370.so)
undefined symbol: DpiApiSetCallerInfo    (./pr14370.so)
undefined symbol: DpiApiSvSetScope    (./pr14370.so)
undefined symbol: CloseServerSession    (./pr14370.so)
undefined symbol: DpiApiAddImportXtor    (./pr14370.so)
undefined symbol: DpiApiRegisterSynchronizationEventXtor    (./pr14370.so)
undefined symbol: DpiApiSvGetUserData    (./pr14370.so)
undefined symbol: _ZN11xtorThreads9PostEventEPv    (./pr14370.so)
undefined symbol: DpiApiRegisterGroupingImportXtor    (./pr14370.so)
undefined symbol: _ZN11xtorThreads13InitThreadLibENS_8thread_tE   
(./pr14370.so)
undefined symbol: DpiApiSvGetScopeFromName    (./pr14370.so)
undefined symbol: DpiApiSetSvScalarVal    (./pr14370.so)
undefined symbol: DpiApiExitHardwareSide    (./pr14370.so)
undefined symbol: DpiApiGetSvBitVecVal    (./pr14370.so)
undefined symbol: DpiApiGetSvScalarVal    (./pr14370.so)
undefined symbol: DpiApiSvGetCallerInfo    (./pr14370.so)
undefined symbol: DpiApiEnterHardwareSide    (./pr14370.so)
undefined symbol: DpiApiInitialize    (./pr14370.so)
undefined symbol: InitialiseDebugAndTrace    (./pr14370.so)
undefined symbol: StopConnectionManager    (./pr14370.so)
undefined symbol: _ZN11xtorThreads11CreateEventEPPvNS_8thread_tE   
(./pr14370.so)
undefined symbol: StartConnectionManager    (./pr14370.so)
undefined symbol: DpiApiSvPutUserData    (./pr14370.so)
undefined symbol: DpiApiRunExportXtor    (./pr14370.so)
undefined symbol: DpiApiAddScopePath    (./pr14370.so)
undefined symbol: DpiApiRegisterExportXtor    (./pr14370.so)
undefined symbol: DpiApiSvGetNameFromScope    (./pr14370.so)
undefined symbol: DpiApiSvGetScope    (./pr14370.so)
undefined symbol: OpenServerSession    (./pr14370.so)
undefined symbol: DpiApiRegisterSynchronizationXtor    (./pr14370.so)
undefined symbol: _ZN11xtorThreads9WaitEventEPv    (./pr14370.so)
undefined symbol: DpiApiSetSvBitVecVal    (./pr14370.so)
[hjl@gnu-6 pr14370]$ cat x.c
#if 0
#include <errno.h>
#else
int errno = 3;
#endif

int
bar (void)
{
  errno = 4;
  return errno;
}
[hjl@gnu-6 pr14370]$ cat main.c 
#include <stdio.h>
#include <dlfcn.h>

int
main ()
{
  void *handle;
  int (*func)();

  handle = dlopen ("./libfoo.so", RTLD_LAZY);

  if (!handle)
    {
      fprintf (stderr, "%s\n", dlerror());
      return 1;
    }

  func = dlsym (handle, "bar");
  if (func == NULL)
    {
      fprintf (stderr, "%s\n", dlerror());
      return 1;
    }

  printf ("errno: %d\n", func ());

  dlclose (handle);

  return 0;
}
[hjl@gnu-6 pr14370]$ make run.dynamic
gcc -m32    -c -o main.o main.c
gcc -m32 -L. -nostdlib -nostartfiles -o dynamic \
-Wl,-dynamic-linker=/export/build/gnu/glibc-32bit/build-i686-linux/elf/ld-linux.so.2
\
-Wl,-z,nocombreloc \
/export/build/gnu/glibc-32bit/build-i686-linux/csu/crt1.o
/export/build/gnu/glibc-32bit/build-i686-linux/csu/crti.o \
`gcc -m32 --print-file-name=crtbegin.o` \
main.o /export/build/gnu/glibc-32bit/build-i686-linux/dlfcn/libdl.so
-Wl,-rpath,. \
-Wl,-rpath=/export/build/gnu/glibc-32bit/build-i686-linux:/export/build/gnu/glibc-32bit/build-i686-linux/dlfcn:/export/build/gnu/glibc-32bit/build-i686-linux/rt:/export/build/gnu/glibc-32bit/build-i686-linux/nptl
\
/export/build/gnu/glibc-32bit/build-i686-linux/elf/ld-linux.so.2 \
/export/build/gnu/glibc-32bit/build-i686-linux/libc.so.6
/export/build/gnu/glibc-32bit/build-i686-linux/libc_nonshared.a \
-lgcc -lgcc_eh `gcc -m32 --print-file-name=crtend.o` \
/export/build/gnu/glibc-32bit/build-i686-linux/csu/crtn.o
gcc -m32    -c -o x.o x.c
./ld -m elf_i386 -shared -o libfoo.so x.o
./dynamic
./libfoo.so: non-TLS definition `errno' mismatches TLS reference in
/export/build/gnu/glibc-32bit/build-i686-linux/libc.so.6
make: *** [run.dynamic] Error 1
[hjl@gnu-6 pr14370]$ 

Here are before and after timings of "make all" and "make check".

1. On x32;

Before:

598.89user 101.05system 2:26.71elapsed 477%CPU (0avgtext+0avgdata
113240maxresident)k
986.60user 556.24system 22:57.75elapsed 111%CPU (0avgtext+0avgdata
1048804maxresident)k

After:

608.99user 99.81system 2:17.10elapsed 516%CPU (0avgtext+0avgdata
113240maxresident)k
988.58user 553.93system 22:56.45elapsed 112%CPU (0avgtext+0avgdata
1048832maxresident)k

2. On x86-64:

Before

526.71user 93.03system 2:15.57elapsed 457%CPU (0avgtext+0avgdata
116028maxresident)k
974.58user 544.92system 23:13.73elapsed 109%CPU (0avgtext+0avgdata
1048760maxresident)k

After:

533.58user 91.94system 2:05.10elapsed 500%CPU (0avgtext+0avgdata
116028maxresident)k
977.58user 547.24system 23:05.13elapsed 110%CPU (0avgtext+0avgdata
1048920maxresident)k

3. On ia32,

Before

458.18user 84.22system 1:59.10elapsed 455%CPU (0avgtext+0avgdata
119016maxresident)k
921.42user 522.70system 21:57.64elapsed 109%CPU (0avgtext+0avgdata
1048888maxresident)k

After

465.45user 85.70system 1:53.79elapsed 484%CPU (0avgtext+0avgdata
119016maxresident)k
920.35user 525.40system 21:57.62elapsed 109%CPU (0avgtext+0avgdata
1048904maxresident)k

-- 
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.


  parent reply	other threads:[~2012-09-04 21:32 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-18 10:05 [Bug dynamic-link/14370] New: SIGFPE in 'ldd -r' pluto at agmk dot net
2012-07-18 10:11 ` [Bug dynamic-link/14370] " aj at suse dot de
2012-07-18 10:49 ` pluto at agmk dot net
2012-07-18 10:54 ` jakub at redhat dot com
2012-07-18 11:00 ` pluto at agmk dot net
2012-07-18 12:37 ` pluto at agmk dot net
2012-07-24  2:04 ` carlos_odonell at mentor dot com
2012-07-24  6:14 ` pluto at agmk dot net
2012-09-02 20:00 ` hjl.tools at gmail dot com
2012-09-02 22:57 ` hjl.tools at gmail dot com
2012-09-03  2:54 ` bugdal at aerifal dot cx
2012-09-03 13:39 ` carlos_odonell at mentor dot com
2012-09-03 15:29 ` pluto at agmk dot net
2012-09-03 18:59 ` hjl.tools at gmail dot com
2012-09-03 20:07 ` aj at suse dot de
2012-09-04 19:09 ` [Bug dynamic-link/14370] ld.so crashes on mismatched TLS/non-TLS symbols hjl.tools at gmail dot com
2012-09-04 19:41 ` carlos_odonell at mentor dot com
2012-09-04 21:32 ` hjl.tools at gmail dot com [this message]
2012-09-04 22:03 ` carlos_odonell at mentor dot com
2012-09-04 22:15 ` bugdal at aerifal dot cx
2012-09-04 22:22 ` hjl.tools at gmail dot com
2012-09-04 23:26 ` bugdal at aerifal dot cx
2012-09-05 15:24 ` ppluzhnikov at google dot com
2012-09-05 15:30 ` hjl.tools at gmail dot com
2012-12-04  0:00 ` carlos at systemhalted dot org
2013-10-02 22:44 ` neleai at seznam dot cz
2014-06-17 18:59 ` fweimer at redhat dot com
2023-07-30 16:53 ` sam at gentoo dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-14370-131-xyC4biZAfH@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).