[cfe-dev] Use of '\01' prefix' in symbols ?
Saleem Abdulrasool via cfe-dev
cfe-dev at lists.llvm.org
Fri Jul 15 17:02:11 PDT 2016
On Thu, Jul 14, 2016 at 3:59 AM, Nat! via cfe-dev <cfe-dev at lists.llvm.org>
wrote:
> Some of the linker strings are apparently prefixed with \01. I assume this
> is some sort of escaping mechanism to prevent mangling or demangling.
>
Correct, \01 is used as an indicator to the backend that the name is not to
be touched for decoration purposes.
>
> ```
> void CGDebugInfo::EmitFunctionDecl(GlobalDecl GD, SourceLocation Loc,
> QualType FnType) {
> ...
> // the mangled name of the enclosing function.
> if (!name.empty() && name[0] == '\01')
> name = name.substr(1);
> ```
>
>
> So is it harmless to prefix everything (non C++) with '\01' or are there
> reasons not to ? For example in CGObjCMac.cpp everything starting with
> "l_OBJC_" is prefixed with '\01' where as symbols prefixed with 'OBJC_' are
> not.
>
You should not prefix everything with '\01' as that can potentially give
you the wrong label name. Consider the case of user label prefix being
non-empty (e.g. Windows m68k). The result would be that the label would be
named incorrectly.
> Ciao
> Nat!
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
--
Saleem Abdulrasool
compnerd (at) compnerd (dot) org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160715/e026f51e/attachment.html>
More information about the cfe-dev
mailing list