[LLVMbugs] [Bug 8713] New: "relocation R_X86_64_PC32 against undefined symbol ..."

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Dec 1 03:16:29 PST 2010


           Summary: "relocation R_X86_64_PC32 against undefined symbol
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: hans at chromium.org
                CC: llvmbugs at cs.uiuc.edu

Trying to compile and link the following into a shared library fails:

#include <ostream>

extern std::ostream& get_ostream();

void f() {
  get_ostream() << "foo";

$ clang++ -fno-exceptions -fvisibility=hidden -fPIC -fno-rtti
-fno-threadsafe-statics -fvisibility-inlines-hidden -c a.cc -o fail.o
$ clang++ -shared -o fail.so fail.o
/usr/bin/ld: fail.o: relocation R_X86_64_PC32 against undefined symbol
`_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@@GLIBCXX_3.4' can not
be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)

If g++ is used in the first step, the link step succeeds.

$ clang++ -v
clang version 2.9 (trunk 120563)
Target: x86_64-unknown-linux-gnu
Thread model: posix

gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)

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

More information about the llvm-bugs mailing list