[llvm-dev] Clang 3.8 and gcc 5.2 has difference in symbol names
Nishidha Panpaliya via llvm-dev
llvm-dev at lists.llvm.org
Wed May 4 05:52:02 PDT 2016
Hi All,
I've built LLVM 3.8 on POWER with gcc 5.2.1 version for one of our
application. This application is built using -std=c++14 support.
Using this particular combination, I'm getting one error where one of the
exported symbols from our application (for a function returning std::string
which is built by gcc) is different than the one when compiled by clang
3.8.
I also tried to replicate this issue by using a small test application
which has a function named GetString() returning std::string. When I
compile this file using gcc 5.2, I see symbol name as
"_Z9GetStringB5cxx11v" and when I compile the same file using clang++, I
get symbol name as "_Z9GetStringv".
In order to resolve this difference, I tried below things -
gcc 5.2 with c++11 support has added this special behavior due to which
symbol name contains B5cxx11. Hence, I tried building LLVM/clang with
-std=c++14 support. But no luck.
Even if I provide -std=c++14 while compiling this source file using
clang++, the result remained same.
I tried setting -D_GLIBCXX_USE_CXX11_ABI=0 flag while compiling my
application using gcc. This approach atleast gave me some success.
Symbols generated for my source file after using flag were same as that
of clang++ (i.e. without B5cxx11). But later my application failed at
linking step for some undefined references - some of the references were
of the application itself and a few from dependent libraries. I wanted
to know if I would also need to build my dependent libraries using this
flag.
I need some guidance here as to how I can build LLVM/clang so that it also
generates symbols same as that of gcc5.2. I can't use any other version of
gcc as I'll need rebuild lot of other dependencies.
Kindly help me.
Thanks,
Nishidha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160504/1f6eca71/attachment.html>
More information about the llvm-dev
mailing list