[LLVMbugs] [Bug 15726] New: clang emits wrong symbol on PPC32 for std::ostream::write

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Apr 11 13:55:40 PDT 2013


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

            Bug ID: 15726
           Summary: clang emits wrong symbol on PPC32 for
                    std::ostream::write
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: fang at csl.cornell.edu
                CC: dgregor at apple.com, hfinkel at anl.gov,
                    llvmbugs at cs.uiuc.edu
    Classification: Unclassified

I have a stage1 clang built from gcc-4.0+cmake+shared on powerpc-darwin8 that
I'm using to build stage 2.
The flags I use for stage 2 are: -fno-common -no-integrated-as
(no optimization/debug)

I'm able to compile all translation units for libLLVMSupport, but at link time,
I get:
ld: Undefined symbols:
__ZNSo5writeEPKcl
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/libtool: internal link edit
command failed

This symbol is:
% echo __ZNSo5writeEPKcl | c++filt
std::basic_ostream<char, std::char_traits<char> >::write(char const*, long)

However, libstdc++ on my system (PPC, 32b) provides only
std::basic_ostream<char, std::char_traits<char> >::write(char const*, int)

This undefined symbol (stage-2) is being referenced from:
% nm lib/Support/CMakeFiles/LLVMSupport.dir/raw_os_ostream.cpp.o
...
         U __ZNSo5writeEPKcl
...

% file lib/Support/CMakeFiles/LLVMSupport.dir/raw_os_ostream.cpp.o
lib/Support/CMakeFiles/LLVMSupport.dir/raw_os_ostream.cpp.o: Mach-O object ppc
(That's 32b.)

Support/raw_os_ostream.cpp has:
void raw_os_ostream::write_impl(const char *Ptr, size_t Size) {
  OS.write(Ptr, Size);
}


For comparison, during stage 1 (built by system compiler gcc-4.0.1):
% nm lib/Support/CMakeFiles/LLVMSupport.dir/raw_os_ostream.cpp.o 
...
         U __ZNSo5writeEPKci
...

>From libstdc++ (gcc-4.0.1) <ostream>:
      __ostream_type&
      write(const char_type* __s, streamsize __n);

So clang is mistakenly treating the streamsize/size_t argument of
std::ostream::write as long instead of int on a 32b powerpc triple.
size_t should map to int on powerpc 32b, right?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130411/055be927/attachment.html>


More information about the llvm-bugs mailing list