Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
689 views
in Technique[技术] by (71.8m points)

c++ - Two mangled names demangling to the same function signature

I have a spidermonkey library that exports the following mangled symbol fora function JS_DefineProperty:

_Z17JS_DefinePropertyP9JSContextP8JSObjectPKcN2JS5ValueEPFiS0_NS5_6HandleIS2_EENS7_I4jsidEENS5_13MutableHandleIS6_EEEPFiS0_S8_SA_iSC_Ej

When I try to compile a file that uses this function, the external reference is compiled as:

_Z17JS_DefinePropertyP9JSContextP8JSObjectPKcN2JS5ValueEPFiS0_NS5_6HandleIS2_EENS7_IlEENS5_13MutableHandleIS6_EEEPFiS0_S8_S9_iSB_Ej

The end of the name is slightly different between the two. I ran both through a name demangler and they both come out to the same signature:

JS_DefineProperty(JSContext*, JSObject*, char const*, JS::Value, int (*)(JSContext*, JS::Handle, JS::Handle, JS::MutableHandle), int (*)(JSContext*, JS::Handle, JS::Handle, int, JS::MutableHandle), unsigned int)

So I'm a little stumped as to what the difference is. I believe both versions were compiled using g++ 4.7. Can anyone decode the extra difference in the name, so I can investigate further?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

There is in fact a difference between the two.

_Z17JS_DefinePropertyP9JSContextP8JSObjectPKcN2JS5ValueEPFiS0_NS5_6HandleIS2_EENS7_I4jsidEENS5_13MutableHandleIS6_EEEPFiS0_S8_SA_iSC_Ej demangles to :

JS_DefineProperty(JSContext*, JSObject*, char const*, JS::Value, int (*)(JSContext*, JS::Handle<JSObject*>, JS::Handle<jsid>, JS::MutableHandle<JS::Value>), int (*)(JSContext*, JS::Handle<JSObject*>, JS::Handle<jsid>, int, JS::MutableHandle<JS::Value>), unsigned int)

_Z17JS_DefinePropertyP9JSContextP8JSObjectPKcN2JS5ValueEPFiS0_NS5_6HandleIS2_EENS7_IlEENS5_13MutableHandleIS6_EEEPFiS0_S8_S9_iSB_Ej demangles to :

JS_DefineProperty(JSContext*, JSObject*, char const*, JS::Value, int (*)(JSContext*, JS::Handle<JSObject*>, JS::Handle<long>, JS::MutableHandle<JS::Value>), int (*)(JSContext*, JS::Handle<JSObject*>, JS::Handle<long>, int, JS::MutableHandle<JS::Value>), unsigned int)

Where the former is using JS::Handle<jsid>, the latter is using JS::Handle<long>.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...