CC name mangling confusion

While compiling QtCreator using Solaris Studio I have come across to an interesting issue with name mangling:
Class QmlDesigner::AbstractView contains method
ModelNode createModelNode(const QString&, int, int, const PropertyListType&, const PropertyListType&, const QString&, ModelNode::NodeSourceType);It is exported from the implementation file abstractview.cpp and used in qmlstate.cpp file linked to the same library
nm -C applied to the resulting shared object gives:
[10448] |   1576144|     169|FUNC |GLOB |0    |11     |QmlDesigner::ModelNode QmlDesigner::AbstractView::createModelNode(const QString&,int,int,const QList<QPair<QString,QVariant> >&,const QList<QPair<QString,QVariant> >&,const QString&,QmlDesigner::ModelNode::NodeSourceType)
                                                       [__1cLQdDmlDesignerMAbstractViewPcreateModelNode6MrknHQdDString_iirknFQdDList4nFQdDPair4n0C_nIQdDVariant_____74n0AJModelNodeONodeSourceType__8_]
                                                                                                                                                                    ^                               ^
[14294] |         0|       0|FUNC |GLOB |0    |UNDEF  |QmlDesigner::ModelNode QmlDesigner::AbstractView::createModelNode(const QString&,int,int,const QList<QPair<QString,QVariant> >&,const QList<QPair<QString,QVariant> >&,const QString&,QmlDesigner::ModelNode::NodeSourceType)
                                                       [__1cLQdDmlDesignerMAbstractViewPcreateModelNode6MrknHQdDString_iirknFQdDList4nFQdDPair4n0C_nIQdDVariant_____rk54n0AJModelNodeONodeSourceType__9B_]
                                                                                                                                                                    ^^^                               ^^I have marked characters which are different (7 replaced with rk5 and 8 with 9B)
Demangled output shows the same prototype but manglings are different (11 coming from abstractview.cpp and UNDEF from qmlstate.cpp)
I guess if the function were mangled same in both cases the linker would resolve it and the resulting shared object would not have undefined symbols
Is there any document describing mangling rules of CC compiler? I have once read an article at Oracle sites about ABI stability which mentions publishing such a document but I cannot google it anywhere.
Where does the difference come from? is it a bug in mangler or demangler?
I think mangling should be a 1-to-1 function not allowing two different codings for same prototype. Maybe the demangler does not correctly decode the small difference in the symbols above which decoded properly would indicate what the compiler "thought" of the function in while exporting and using as extern
I have noticed the same difference in mangling for Sun Studio 12 (CC: Sun C++ 5.9 SunOS_sparc Patch 124863-01 2007/07/25)
Solaris Studio 12.2 (CC: Sun C++ 5.11 SunOS_sparc/i386 2010/08/13)
and Solaris Studio 12.3 (CC: Sun C++ 5.12 SunOS_i386 2011/11/16)

You have run into a known bug in name mangling, documented here:
http://docs.oracle.com/cd/E24457_01/html/E21987/glnzd.html#gkgak
(read this short article before reading the rest of this post)
If we fix the bug, some currently working programs will fail to link, if they mix old and new binaries.
If we don't fix the bug, some valid programs will not link, as in your example.
We have chosen to leave the bug in place on older platforms, to avoid breaking working programs. Those platforms are
Sparc Solaris, 32-bit and 64-bit
x86 Solaris, 32-bit
However, on platforms introduced after the bug was discovered, there was no issue with backward compatibility. The bug does not exist on these platforms:
x86 Solaris, 64 bit
Linux, 32-bit and 64 bit
If you are on a 32-bit x86 Solaris platform, consider whether you can build in 64-bit mode. If so, the bug will not be present, and in addition, 64-bit programs are often more efficient than 32-bit programs.
Otherwise:
If the problem is due to inconsistent top-level const on function parameters, such as
int foo(const int);
int foo(int); // same function
it is best to fix the source code to use const consistently. Technically, the compiler should ignore the const, but the inconsistency can be confusing to human readers of the code.
If the problem is the more subtle one of mixing typedefs of composite types with explicit coding of the same type, modifying the source code might not be a realistic solution. The weak-declaration solution shown in the document might be a workable (if ugly) solution in that case.
Finally, the compiler has a hidden option to fix all known mangling bugs unconditionally. We don't publicize the option because
- It is unstable. Future patches or releases could change mangling if more bugs are found.
- You might need to recompile all of the C++ code, including 3rd-party libraries, using this option.
- If you create a library with this option, it might be incompatible with code compiled without the option.
- As with all hidden options, it is subject to change or removal without notice.
- We view this option as "use at your own risk".
If after all these caveats you still want to try the option, here it is:
-Qoption ccfe -abiopt=mangle6
Be sure to add it to every CC command, and recompile everything.
Fortunately, none of the C++ system libraries shipped with Solaris or Studio is affected by this bug or the hidden option, so you don't need to worry about different versions of those libraries.

Similar Messages

  • Compiler can't make up its mind on proper name mangling

    Here is another bug that has bothered me for a long time.
    AFAICT, Workshop6.2 through Studio 11 are all affected.
    $ cat foo.cc
    struct Foo {
        struct Filter;
        struct Bug;
    typedef Foo::Bug Bug;
    typedef Foo::Filter Filter;
    struct Foo::Filter {
        Bug *filterBug(Bug * bug);
    #ifdef MAIN
    int main()
        Filter f;
        f.filterBug(0);
        return 0;
    #else
    Bug *Filter::filterBug(Bug *bug) {  return bug ; }
    #endif
    $ CC -c foo.cc && nm foo.o | grep filterBug
    00000010 T __1cDFooGFilterJfilterBug6Mpn0ADBug__p2_
    $ CC -c -DMAIN foo.cc && nm foo.o | grep filterBug
             U __1cDFooGFilterJfilterBug6Mpn0ADBug__3_Note that the symbols are different (and the program can't be linked) even though the first compilation provides method definition, and the second uses that same method :-(

    As explained in the compiler docs, this problem is not a feature, it is a documented bug. The bug affects the C++ ABI, and fixing the bug would prevent some programs from linking that work correctly now.
    The "use typdefs consistently" advice is oversimplfied. In the examples in the documentation, consistent use of typedefs avoids the bug. In your example it does not.
    The best way to get this code working with Sun C++ is not to use the typedefs in the function declaration or definition. I realize that workaround is not convenient, but it's what I recommend.
    We have an undocument compiler option that fixes all known name-mangling bugs. But using the option can change the mangled names of existing symbols that are not currently causing problems. If you use this option, you must use it in compiling every C++ module in the entire program, including C++ libraries that you link.
    Fortunately, none of the C++ system libraries are affected by the bug, so they will link correctly with or without the name-mangling fix.
    The option is
    CC -Qoption ccfe -abiopt=mangle6 ...
    You need to use it on every compilation command. It has no effect on linking. By definition, undocumented "Qoptions" are not supported, and their effects can change without notice. A Qoption can also be dropped in a future release.
    I recommend against using this option unless you control all of the source code that goes into your program, and do not share object files with any other project. If you update the compiler, it might be necessary to recompile all of your code.

  • Computers on small office network - names getting confused on iChat

    We are using bonjour and iChat on the computers on a small airport network in our office as an instant messaging solution in our office - however, 2 of the computers (which are named differently) keep getting confused and both being called the same name.
    I have done the fix where you go to System Prefs, Users & Groups and then set the address book card to that particular computer owner, restart the computer and then open iChat (using bonjour) - it saves the name but then my colleague becomes the same name as me on iChat - so we do the same thing to her computer (set address book card etc) and it changes her iChat name, but then also seems to override what I had set for mine previously.
    Help!! What can I do to stop these 2 computers seemingly overriding each other? It doesn't happen with the other 4 computers sharing our network...

    Hi,
    In System Preferences > Sharing is the Name the Computer has.
    This does play a part in any Bonjour Connection.
    It is this name that appears in Shares in the Finders's Side bar.
    Separate for that iChat and Messages that have the Bonjour Account Enabled broadcast the details from the My Card in the Address Book.
    Issues can arise with some Server based Logins that create a Global Address book that changes the My Card.
    You get similar difficulties on some DiskImage roll outs of updates and the like if the details of the Address Book are copied as well.
    I am not sure what you mean by the "fix" in System Preferences > Users and Groups to change the My Card or the Computer's Name.
    Yes you can click the Contact Card for that account and it will show you it in the Address Book and it should be th My Card.
    Changing the My Card then does not alter which Card is associated with the Mac User Account.
    There is no access to the Computer's Name
    7:53 PM      Wednesday; August 1, 2012
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
      iMac 2.5Ghz 5i 2011 (Lion 10.7.2)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • Three different albums with the same name is confusing iPod?

    I have three albums which go by the name Greatest Hits. There are three artists on my iPod who both have an album called this. If I am listening to Artist #1 and I switch to Cover Flow, then the album artwork for that album will appear, however the name of Arist #2 or Artist #3 will appear underneath with the song and album title of Artist #1.
    Similarly, I searched through the albums to find the Greatest Hits album and it automatically assigned the artwork of Artist #2 to it, but the song by Artist #1 was listed in there along with the songs from Artist #2 and Artist #3.
    I hope that all makes sense. I was wondering if this is a bug or simply iTunes/iPod becoming confused and merging the albums together because it thinks it is the same album even though there are different artists.
    If this isn't a bug, does anyone know a way I can resolve this issue?
    Thanks.

    1) Select (in iTunes) one album at a time.
    2) Get info on all the songs an make sure the Artist name is the same - and unique from the other two albums.
    3) Change as needed.
    4) Do the same for all albums.
    5) Make sure the artwork is correct for each album.
    6) Sync Touch.
    Scott

  • New page names- file confusion?

    Hi, I'm reorganising my site and would like to change some page names in iWeb. Is this OK, or will it mean that all the files on that page will not be 'found' any more since they have the original name ?
    Thanks, Kay.

    but can I then simply change the names of the pages in the Navigation bar?
    Only if you're using a Text Based Navbar and not the standard navbar.
    With the standard navbar the page name is what appears in the navbar. To change what's in the navbar you have to change the page name. With a text based navbar you can put any name in the text box navbar you want and point it to the existing page your want.
    OT

  • Help!!  CC mangling works confusing!!

    I have confusion about how CC mangling works for C code. Could you please give me a rule about when the mangling will be effect on the funcion?
    In the following scenario, all three functions have been declared by extern "C" in queue.h, queue and queue2 have the same defination, but the queue2 has been declared again in queue.C.
    Scenario:
    bash-3.00$ more queue.h
    extern "C" {
    int queue(char q, void (*df)(void * object));
    int queue1(char q, char *df);
    int queue2(char q, void (*df)(void * object));
    bash-3.00$ more queue.C
    #include <stdio.h>
    #include "queue.h"
    int queue(char q, void (*df)(void * object))
    printf("Test\n");
    return 0;
    int queue1(char q, char *df)
    printf("Test1\n");
    return 0;
    extern "C" {
    int queue2(char q, void (*df)(void * object))
    printf("Test\n");
    return 0;
    queue.C
    int queue(queue_str q, void (*df)(void * object))
         print "Test\n";
    On Solaris10 on x86, Sun Studio 11:
    I compiled it by: C -w -c queue.C
    Then
    bash-3.00$ nm queue.o
    queue.o:
    [Index] Value Size Type Bind Other Shndx Name
    [6] | 0| 0|SECT |LOCL |0 |6 |
    [2] | 0| 0|SECT |LOCL |0 |2 |
    [3] | 0| 0|SECT |LOCL |0 |3 |
    [4] | 0| 0|SECT |LOCL |0 |4 |
    [5] | 0| 0|SECT |LOCL |0 |5 |
    [7] | 0| 54|FUNC |GLOB |0 |2 |__1cFqueue6FpcpFpv_v_pi_
    [8] | 0| 0|FUNC |GLOB |0 |UNDEF |printf
    [1] | 0| 0|FILE |LOCL |0 |ABS |queue.C
    [9] | 64| 54|FUNC |GLOB |0 |2 |queue1
    [10] | 128| 54|FUNC |GLOB |0 |2 |queue2
    My question is why the function queue was mangled, but the queue1 and queue2 did not? I am appreciated for your response. Thanks!

    For a discussion of name mangling, see my paper "The stability of the C++ ABI"
    http://developers.sun.com/sunstudio/articles/CC_abi/CC_abi_content.html
    In a C++ program, any function not declared extern "C" winds up with a mangled name. The reason is that the compiler must allow for the possibility that a different function with the same name might be defined in another part of the program and not seen by this compilation.
    When you declare a function extern "C", you specify that the function follows the C rules for linkage (the external name seen by the linker, parameter passing conventions, etc). In particular, C does not allow more than one global function with the same name, and names are not mangled. Only one function with a given name can therefore be declared extern "C".
    As Simon already explained, you generally need to be consistent about declaring and defining a function as extern "C".

  • How to get mangled names?

    I have a need to use one of Sun Studio C++ features, i.e.,  #pragma align.
    But I noted that if I use "#pragma align" in a namespace, I must name variables with their mangled names.
    See the link below:  
    http://dsc.sun.com/sunstudio/documentation/ss12u1/mr/READMEs/c++.html#cpragma
    I do know there is a tool (c++filt) to demangling names, but I have no idea what kind of tools can help me
    to get mangled names.
    Regards.

    To find the mangled name of a symbol, run "nm -C" on an object file (.o, .so, or a.out) that contains a definition of or reference to the symbol. To reduce the amount of output, grep for the unmangled name. Here is an example:
    % cat foo.cc
    int bar(int);
    int foo(int i) {  return bar(i); }
    double foo(double d) { return d; }
    % CC -c foo.cc
    % nm -C foo.o | grep foo
    foo.o:
    [8]     |        80|      60|FUNC |GLOB |0    |2      |double foo(double)
                                                           [__1cDfoo6Fd_d_]
    [1]     |         0|       0|FILE |LOCL |0    |ABS    |foo.cc
    [10]    |        16|      44|FUNC |GLOB |0    |2      |int foo(int)
                                                           [__1cDfoo6Fi_i_]
    % nm -C foo.o | grep bar
    [9]     |         0|       0|FUNC |GLOB |0    |UNDEF  |int bar(int)
                                                           [__1cDbar6Fi_i_]The -C option fo nm shows both the mangled and demangled names of symbols. This example has 2 functions called foo. You can tell which one you want by matching the demangled name to the mangled name.
    There is no "name mangler" that takes a symbol and mangles it, because the mangling in general depends on the context where the symbol is declared. You need almost all of a C++ compiler front end to create the mangled name.

  • Changing image file names

    hi all.
    can anyone help me find a thread (can i run a search somehow in ("Your Stuff"?) where folks were kind enough to help me understand how to change file names?
    i am reading through some help documentation on Batch Change but i am trying to remember what i should be doing to most efficiently solve my problem.
    basically i have images in aperture which have non-sensical names related to their originally existing in a pc folder organization originally and i would like to both rename them in aperture but also be able to have them EXPORTED to my desktop so i can upload them to the web with some reasonable sounding title such as "client1-town1-HousingType-FirmName-photographer.png" or something similar. right now the images i want to publish are ORGANIZED IN ALBUMS and have names like "folio_construction_other_turtle_134543.png"
    i think i WOULD LIKE to change the name of the master but i am not totally sure about this and when i run a Metadata > Batch Change and pull down version name i get selections that i do not fully understand.
    https://www.dropbox.com/s/yvu1u7eskbmhcik/Screen%20Shot%202012-12-03%20at%201.58 .46%20PM.png
    i /am/ familiar with a handle little tool called Name Mangler which basically allows me to easily delete all the PREFIX information (such as "folio_construction_other_turtle" and then to pre-pend something like "client1-town1-HousingType-FirmName-photographer" in front of the image number which would be ideal...
    apologies for asking this again but until i get through it once i am finding it all a bit tricky.
    THANKS

    Hi Leonie.
    Thank you so much. I am going to be doing a lot of this and just so i understand:
    Delete the images you exported and renamed from your Aperture library before reimporting, to avoid creating duplicates. When deleting from the album that you used to export, use the command "delete version", not "delete from album". Do not delete the projects that the images came from, only the images.
    Can you help me understand which images i am deleting? I mean, is there a way to delete just the images in the ALBUM because if i have to go in and delete the images from a Project there are going to be a lot more images in the Project and it is going to be very hard to tell which images have been renamed and which have not been renamed. If i have to do this by deleting the images in the Project, i suppose i could use one of your suggestions to color all the images in an ALBUM, say yellow, and then see where the images show up in Projects but even then i think it will be a bit tricky. Are you saying i can just delete the images in the ALBUM by doing "Delete Version"?
    Use "File > import" to reimport your image files. I'd put all images that shall be imported into the same project into one folder, and then import each folder on its own.
    OK. So - well - so now i am importing all of the images that i originally had in the Database and they are /basically/ (i moved the folder organization around a little bit while the images were on my desktop in this first attempt...) - they are basically getting IMPORTED into Aperture now with the "new" images coming into the database into a new Project that is named according to the Album that they were in?
    This is a little tricky for me. Will the old Albums still exist? What if i had more than one Album with an image in it. Also, this "new" image will be in a /new/ Project but will it still be in the OLD PROJECT with the old name? Or, i guess i am getting a little confused as to how this will work.
    Select the project in the Library Inspector, that you want to import the folder of images into, then set the "Destination" in   "Import settings > Aperture Library" brick to this project  and set "Store Files" to "In the Aperture Library".
    OK. I can try this here soon. What does Store Files in the Aperture Library do? I guess these images are getting imported as if they are new and they are getting imported with no external references?
    Set "Rename files" to "None" or "version name". Both will keep the name you edited.
    OK. Not sure i totally understand but i can try this as well. I guess this is making sure Aperture will keep the original names.
    THANKS

  • Query View name not saved in "Analysis Grid Properties" under Data Provider

    Hi BW World;)
    We are on BI 7.0
    I have created a BI workbook which contains a query view.
    However when we go into design mode and then "analysis grid properties" for this query view then "change data provider" it does not show the query view name but the query name. (we have saved the workbook)
    Is this the normal scenario?
    Surely should show the "query view name " and not the "query name" as confuses what data provider is being used?
    Is this a bug?
    Best
    Stevo.... Points of course... Thanks in advance.;)
    Edited by: bw4eva999 on Sep 10, 2009 4:40 PM     spelling

    Hi,
    You have created a workbook on top of a Query View which is again depends on a Query.Now the base for Query View is a Query.So the underlying Data Provider for a workbook is a Query.
    Hence when you go to Properties of grid->Change Data Provider,it shows the Query and the InfoCube,but not the Query View.
    So this is not a bug and this how its been designed.
    If you click for the Information of that workbook,it will show the Query and Info Provider,but not the query View.
    Though it looks like wierd,it is not a bug.
    Rgds,
    Murali

  • What is the best way to name a file?

    What is the best way to name a file? Use "_" so that the characters make one, long name? Why do that?

    Another take on naming files, particularly image files, is like this:
    I use a file remaning application like Name Mangler to back, sequentially rename the photos.  I put them in a folder with a similar name.  Using the format I do, YYYY-MM-DD- Description-001.jpg, they are easy to sort by date by sorting alphanumerically.
    OT

  • Same file name when downloading new pics

    The prev camera I had (Sony Cyber shot/Steady Shot?)always kept dynamic file numbers/names however now have Nikon D90 and now if do search on a file number now get numerous pics under same file name as new camera restarts at same number all the time.
    Is there an easy way to deal with this. I would really not want to have to rename all files as soon as I download them. That can be over 300 pics at a time.
    Any help would be greatly appreciated! Thanks!

    When I say file name I mean the name/number that appears under the pic in iphoto.
    Yes that is the file name
    Do most people leave these numbers or change them, do you know?
    Most people leave it - some preprocess all photos and assign meaningful file names and then import
    I know you can assign words to them and then retrieve them by calling up all pics associated with that word(s).
    You can assign a title (which can optionally be used as the file name when you export photos), a description, keywords, and a rating
    Do you have any other hints for me? Do you use the Mangler software you referred to in the prev post?
    Normally I do not modify the file names - if I get photos from someone else I usually use name mangler to identify the source (which I could do with keywords but for photos that are not mine I prefer having the file name show the source) - once in a while I will change some but normally I just import directly from the camera and ignore the file name
    LN

  • ORA-00957: duplicate column name for multi-form page

    I have read numerous threads on this but I think I am missing something. I have two forms on one page, each based on a separate table. They each have one column in common which is why I believe I am getting this error. However, I do not understand why since each form has its own Automatic Row Processing, it is tripping over the column name. I have changed the name of the page item to be different, but I still get this error. TIA.

    Hi,
    Technically you can not use two forms in one page. Both table have the same column name which confuses the DML process. Try change the column name in one table and see if it works.
    Cheers,
    Tajuddin

  • Control over the Additional Names

    The setting of Additional Names is confusing.  Where does Logic pull the information from when Automatic is selected
    The only way that I have found to get rid of the name in the setting box, for example in the screen shot above, was to Click and choose Reset Channel Strip, which erases everything, then choose undo to bring everything back without the a name.  Is there some other way to do this??? or is this the logic of Logic.  I find the Additional Names useful when looking for the source of a side chain on an effects preset.  Are there other uses???

    Hi,
    You can write a validation
    thnks

  • JNI function name length exceeds linker support size?

    hi,
    JNI function names are Java_Package_classname_functionname. But i have a package+classname itself crossing 32 characters. i need to have more than one native function in the same class. so linker cannot distinguish these names. any workarounds?
    thanx in advance

    Hi,
    I don't know of any way around JNI's name mangling rules, but pardon me for asking, the linker of what platform supports symbols with length <= 32 only these days?
    Kind Regards,
    Tobias

  • Technical names of infoobjects in infosets

    Hi,
    I have create an Infoset through several ODS and cubes. System automatically generates technical names starting with F, at design screen for each infoobject in ODS or cubes. But i want to see and use original tech. names of objects especialy on the BEX design screen. F names are confusing me.
    Is that possible ?
    best regards,
    Yigit

    Technical names are assigned sequentialy.
    You can enter in Infosets definition and push the button of technical names (the most right one)
    In BEX i think is not possible.

Maybe you are looking for

  • Sent messages do not appear in Sent Mailbox IOS 7

    I upgraded my iPad to IOS 7 using WiFi, but did not first check to see if iTunes was current.  (I don't think this is relevant to this particular problem, but perhaps it is).  I then upgraded one iPhone (4) to IOS 7 on my Mac (10.7.5) after updating

  • What is multi threading?

    Hi all, What is multi threading? How to implement multi threading in ABAP? Regards, Bryan

  • HT201363 How do I set a rescue email ??

    Anyone know how to set a rescue email !! :)

  • Adding Picture in PLD .....

    Hello Experts,                    After inserting the picture box, when i click to Browse button, shows the error message " The Picture folder has not been define [Message 131-99]".       How to add the picture in the Picture Box, while designing the

  • Firefox Bookmarks fail to transfer completely from IE10.

    Firefox does not get ALL of the IE10 Bookmarks (only 40-50%) despite trying ALL of the Mozilla recommended fixes (eg., transferring direct from IE10 or exporting as an HTML file from IE10 and then importing the HTM file into Firefox) which in Dec 201