[LLVMbugs] [Bug 10022] New: Ubuntu 11.04 Natty x86: clang++ fails to build shared library

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu May 26 07:01:47 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=10022

           Summary: Ubuntu 11.04 Natty x86: clang++ fails to build shared
                    library
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Driver
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: ofv at wanadoo.es
                CC: llvmbugs at cs.uiuc.edu


Source code:


#include <math.h>

double foo(double x) {
  return cos(x);
}


Create a shared library:


clang++ -v -fPIC -O2 -shared foo.cpp

 "/usr/bin/ld" -z relro --hash-style=gnu --build-id --eh-frame-hdr -m elf_i386
-shared -o a.out /usr/lib/../lib/crti.o
/usr/lib/gcc/i686-linux-gnu/4.5.2/crtbeginS.o
-L/usr/lib/gcc/i686-linux-gnu/4.5.2
-L/usr/lib/gcc/i686-linux-gnu/4.5.2/../../../../lib -L/lib/../lib
-L/usr/lib/../lib -L/usr/lib/gcc/i686-linux-gnu/4.5.2/../../..
-L/usr/lib/i686-linux-gnu /tmp/cc-fztJm0.o -lstdc++ -lm -lgcc_s -lc -lgcc_s
/usr/lib/gcc/i686-linux-gnu/4.5.2/crtendS.o /usr/lib/../lib/crtn.o
/usr/bin/ld: /tmp/cc-fztJm0.o: relocation R_386_GOTOFF against undefined symbol
`cos@@GLIBC_2.0' can not be used when making a shared object
/usr/bin/ld: final link failed: Bad value
clang-3: error: linker command failed with exit code 1 (use -v to see
invocation)


If either -fPIC or -O2 are removed the command succeeds.

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