This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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]

again undefined symbol __dso_handle


Hi,

while building an application for different platforms and compilers,
I stumbled about a strange linking behaviour of ld vs. gcc.
Linking a shared lib with ld will lead to the __dso_symbol not found' message
when starting a binary linked against it. Linking the shared lib with gcc,
the bug doesn't happen.

This is my environment:

--> gcc --version
gcc (GCC) 3.2.1 20021108 (prerelease)

--> ld --version
GNU ld version 2.13.90.0.10 20021010

--> /lib/libc.so.6
GNU C Library stable release version 2.2.5, by Roland McGrath et al.
... <some lines cut>
Compiled by GNU CC version 3.2.
Compiled on a Linux 2.4.18 system on 2002-11-07.


The testfiles:

--> more testlib.h 
#include <iostream>
#include <strstream>
using namespace std;

class MyTest : public std::ostrstream {
 public:
};


--> more testlib.cpp 
#include "testlib.h"

--> more testfile.cpp
#include "testlib.h"

using namespace std;

int main (int argc, char **argv, char **envp) {
  MyTest out;
  out << "This is an apple." << ends;
  std::cout << out.str() << endl;
  return 0;
}


How to reproduce:

g++ -I.  -D_LINUX -D_LINUX24 -c -o testlib.o testlib.cpp
g++ -fPIC -g -I. -D_LINUX -D_LINUX24 -c -o testfile.o testfile.cpp

# linking version 1
ld -shared -o libtestlib1.so testlib.o -soname libtestlib1.so

# and linking version 2
g++ -shared -o libtestlib2.so testlib.o 

g++ -g -I. -o test1 testfile.o -ltestlib1 -L/home/mudra/test
g++ -g -I. -o test2 testfile.o -ltestlib2 -L/home/mudra/test

> ./test1:
./test1: relocation error: /home/mudra/test/libtestlib1.so: undefined symbol: __dso_handle

> ./test2 
This is an apple.


Can somebody reproduce that?

Greetings,

  Christian Mudra.

----------------------------------------------------------------------------
Christian Mudra              Just remember what your mother always told you:
mudra at informatik.uni-kl.de       "When you open windows you let in bugs".


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