[cfe-dev] Link error in clang but not g++

Holger Brandsmeier holger.brandsmeier at sam.math.ethz.ch
Thu Sep 15 11:26:39 PDT 2011


Marc,

this is precisely what is going on, without -C the symbols are:

000014c0 W _ZN6parfem15QuadratureRulesIdLi0EEC2Ej
         U _ZN6parfem15QuadratureRulesIdLi0EEC1Ej

and they are both demangled to the same:

c++filt _ZN6parfem15QuadratureRulesIdLi0EEC2Ej
parfem::QuadratureRules<double, 0>::QuadratureRules(unsigned int)

c++filt _ZN6parfem15QuadratureRulesIdLi0EEC1Ej
parfem::QuadratureRules<double, 0>::QuadratureRules(unsigned int)

Out of curiosity, what does the `C1Ej` and `C2Ej` part that decodes a
different symbol, but does not appear in the demangling stand for?

-Holger


On Thu, Sep 15, 2011 at 19:15, Marc Glisse <marc.glisse at inria.fr> wrote:
> On Wed, 14 Sep 2011, Eli Friedman wrote:
>
>> On Wed, Sep 14, 2011 at 9:55 AM, Holger Brandsmeier
>> <holger.brandsmeier at sam.math.ethz.ch> wrote:
>>>
>>> Dear clang list,
>>>
>>> first thank you a lot for providing clang, clang is really so much
>>> better for error messages (especially templates) than gcc!
>>>
>>> I build a shared library essentialy with the CMake part
>>>
>>> add_library(integration quadraturePy.cpp quadratureRulesPy.cpp)
>>>
>>> In the file `quadratureRulesPy.cpp` the constructor for the template
>>> QuadratureRules<double, 0> is define. It is also part of the object
>>> file:
>>>
>>>> nm -C CMakeFiles/integration.dir/quadratureRulesPy.cpp.o | grep
>>>> "parfem::QuadratureRules<double, 0>::QuadratureRules"
>>>
>>> 00000000 W parfem::QuadratureRules<double, 0>::QuadratureRules(unsigned
>>> int)
>>>
>>> In the file `quadraturePy.cpp` this symbol is not defined, and thus
>>> also not part of the object file:
>>>
>>>> nm -C CMakeFiles/integration.dir/quadraturePy.cpp.o | grep
>>>> "parfem::QuadratureRules<double, 0>::QuadratureRules"
>>>
>>>         U parfem::QuadratureRules<double, 0>::QuadratureRules(unsigned
>>> int)
>>>
>>> In the final library both object files are combined and the symbol
>>> appears twice:
>>>
>>>> nm -C libintegration.so | grep "parfem::QuadratureRules<double,
>>>> 0>::QuadratureRules"
>>>
>>>         U parfem::QuadratureRules<double, 0>::QuadratureRules(unsigned
>>> int)
>>> 000ad400 W parfem::QuadratureRules<double, 0>::QuadratureRules(unsigned
>>> int)
>>
>> Something very strange is happening in your link step; if I'm reading
>> this right, it should not be possible...
>
> Have you tried without -C? Demangling is not an injective operation, and
> _ZN6parfem15QuadratureRulesIdLi0EEC1Ej,
> _ZN6parfem15QuadratureRulesIdLi0EEC2Ej,
> _ZN6parfem15QuadratureRulesIdLi0EEC3Ej all print the same
> parfem::QuadratureRules<double, 0>::QuadratureRules(unsigned int)
>
> Other interesting tests include testing with a recent gcc (default
> visibility changed, more privatization, etc) to make sure the bug doesn't
> also appear there.
>
> --
> Marc Glisse
>



-- 
Holger Brandsmeier, SAM, ETH Zürich
http://www.sam.math.ethz.ch/people/bholger




More information about the cfe-dev mailing list