[libcxx] r192074 - Eliminate more symbols multiply defined betweenlibsupc++ and libc++.

Andy Gibbs andyg1001 at hotmail.co.uk
Tue Oct 8 03:29:39 PDT 2013


On Monday, October 07, 2013 12:13 AM, Peter Collingbourne wrote:
> Author: pcc
> Date: Sun Oct  6 17:13:16 2013
> New Revision: 192074
>
> URL: http://llvm.org/viewvc/llvm-project?rev=192074&view=rev
> Log:
> Eliminate more symbols multiply defined between libsupc++ and libc++.
>
> The remaining multiple definitions were flushed out by attempting to
> link libsupc++ and libc++ into the same executable with --whole-archive,
> e.g.
>
> clang++ -I../llvm/projects/libcxx/include -nodefaultlibs -Wl,--whole-archive 
> lib/libc++.a 
> /usr/lib/gcc/x86_64-linux-gnu/4.6/libsupc++.a -Wl,--no-whole-archive -lgcc 
>  -lgcc_s -lc -lpthread -lrt
>
> (The same technique was used to flush out multiple definitions in
> libstdc++.)
>
> Differential Revision: http://llvm-reviews.chandlerc.com/D1824
>
> Modified:
>    libcxx/trunk/src/exception.cpp
>    libcxx/trunk/src/new.cpp
>

I'm afraid this patch breaks building llvm using libc++:

Linking CXX executable ../../bin/llvm-tblgen
CMakeFiles/llvm-tblgen.dir/AsmMatcherEmitter.cpp.o: In function 
`std::__1::pair<(anonymous namespace)::MatchableInfo**, long> 
std::__1::get_temporary_buffer<(anonymous 
namespace)::MatchableInfo*>(long)':
/media/SSD/clang/build/include/c++/v1/memory:1829: undefined reference to 
`operator new(unsigned long, std::nothrow_t const&)'
CMakeFiles/llvm-tblgen.dir/CodeGenRegisters.cpp.o: In function 
`std::__1::pair<unsigned int*, long> std::__1::get_temporary_buffer<unsigned 
int>(long)':
/media/SSD/clang/build/include/c++/v1/memory:1829: undefined reference to 
`operator new(unsigned long, std::nothrow_t const&)'
../../lib/libLLVMSupport.a(MemoryBuffer.cpp.o): In function 
`llvm::MemoryBuffer::getNewUninitMemBuffer(unsigned long, llvm::StringRef)':
/media/SSD/clang/source/lib/Support/MemoryBuffer.cpp:138: undefined 
reference to `operator new(unsigned long, std::nothrow_t const&)'
clang-3.4: error: linker command failed with exit code 1 (use -v to see 
invocation)


libc++ is built using libsupc++ in release mode and llvm is built 
with -stdlib=libc++.

It is now necessary to explictly compile with -lsupc++, which surprises me 
since libc++ ought be linked against libsupc++?

Cheers,

Andy





More information about the cfe-commits mailing list