C++ demangling of 64-bit symbols on ppc64

Maynard Johnson maynardj@us.ibm.com
Thu Apr 5 19:16:00 GMT 2007


Ian Lance Taylor wrote:

>Maynard Johnson <maynardj@us.ibm.com> writes:
>
>  
>
>>6513     93.7392  test                     ._Z4doitPc
>>    
>>
>
>So the problem is the leading dot (which was probably clear to you but
>not to me).  Historically the demangler has not handled leading dots.
>Instead, historically, the caller has removed them when appropriate.
>
>The linker, rather than do anything clever, simply removes all leading
>dots.  See the demangle() function in ld/ldmisc.c.
>
>  /* This is a hack for better error reporting on XCOFF, PowerPC64-ELF
>     or the MS PE format.  These formats have a number of leading '.'s
>     on at least some symbols, so we remove all dots to avoid
>     confusing the demangler.  */
>  p = name;
>  while (*p == '.')
>    ++p;
>
>It seems to me that opreport should do the same.
>
>Or, we could change the interface to the demangler.  I don't think it
>would be appropriate for the demangler to unconditionally remove
>  
>
Why?  Are there some circumstances where the correct answer is returned, 
even if the symbol has leading dots?

>leading dots, but I think it would be reasonable to add a DMGL_XX flag
>for it if that seems like a better approach.
>  
>
If default removal of leading dots is not possible or practical, then 
I'd agree that something like DMGL_HANDLE_LEADING_DOTS would be an OK 
approach -- in order to centralize the knowledge of what should be done 
with leading dots.  Of course, no matter what the decision, adding a 
hack (similar to above) to opreport will be necessary for now.

Thanks.
-Maynard

>Ian
>  
>




More information about the Binutils mailing list