[llvm-bugs] [Bug 24794] New: GCC and Clang disagree on symbol mangling

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Sep 12 03:47:28 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24794

            Bug ID: 24794
           Summary: GCC and Clang disagree on symbol mangling
           Product: clang
           Version: 3.6
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: steven at uplinklabs.net
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 14871
  --> https://llvm.org/bugs/attachment.cgi?id=14871&action=edit
test case

Running Clang 3.6.2.

I have some C++ code that fails to link because Clang and GCC are coming up
with different symbol mangling for some specific symbols in some of the
dependent libraries. I managed to come up with a small test case that
illustrates the issue (it's probably not fully reduced). I've attached it to
this bug report.

$ g++ -c test.cpp; nm -C test.o; nm test.o
+ g++ -c test.cpp
+ nm -C test.o
0000000000000000 T bar(foo::V&, int&, int*)
                 U baz::enable_if<!baz::is_enum<int>::value, void>::type
baz::Conv<int>(int&, int*)
                 U baz::enable_if<!baz::is_enum<foo::V>::value, void>::type
baz::Conv<foo::V>(foo::V&, int*)
+ nm test.o
0000000000000000 T _Z3barRN3foo1VERiPi
                 U
_ZN3baz4ConvIiEENS_9enable_ifIXntsrNS_7is_enumIT_EE5valueEvE4typeERS3_Pi
                 U
_ZN3baz4ConvIN3foo1VEEENS_9enable_ifIXntsrNS_7is_enumIT_EE5valueEvE4typeERS5_Pi


$ clang++ -c test.cpp; nm -C test.o; nm test.o
+ clang++ -c test.cpp
test.cpp:65:1: warning: control reaches end of non-void function
[-Wreturn-type]
}
^
1 warning generated.
+ nm -C test.o
0000000000000000 T bar(foo::V&, int&, int*)
                 U
_ZN3baz4ConvIiEENS_9enable_ifIXntsr7is_enumIT_EE5valueEvE4typeERS2_Pi
                 U
_ZN3baz4ConvIN3foo1VEEENS_9enable_ifIXntsr7is_enumIT_EE5valueEvE4typeERS4_Pi
+ nm test.o
0000000000000000 T _Z3barRN3foo1VERiPi
                 U
_ZN3baz4ConvIiEENS_9enable_ifIXntsr7is_enumIT_EE5valueEvE4typeERS2_Pi
                 U
_ZN3baz4ConvIN3foo1VEEENS_9enable_ifIXntsr7is_enumIT_EE5valueEvE4typeERS4_Pi


Note that the Clang-mangled symbol cannot be demangled by c++filt or nm.

Any ideas?

-- 
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/20150912/86539fc0/attachment.html>


More information about the llvm-bugs mailing list