Symbol name character restrictions

Joshua Saxby joshua.a.saxby@gmail.com
Mon Apr 10 14:39:45 GMT 2023


Dear All,

I noticed that currently libgccjit restricts symbol names for generated
functions (and I assume all other symbols) to match the rules for C symbol
names, that is, alphanumeric and underscores.

>From the source for gcc_jit_context_new_function() (
https://github.com/gcc-mirror/gcc/blob/725bcdeec60771cb9ee387978716028b64ea1b7f/gcc/jit/libgccjit.cc#L1173-L1177
):

  /* The assembler can only handle certain names, so for now, enforce
     C's rules for identifiers upon the name, using ISALPHA and ISALNUM
     from safe-ctype.h to ignore the current locale.
     Eventually we'll need some way to interact with e.g. C++ name
     mangling.  */

I've seen some suggestions elsewhere that some assemblers can handle
symbols with wider varieties of symbols than these, I have struggled to
find any documentation of the exact restrictions on symbol-naming in the
assembler itself (I could assume it's identical to C symbol naming rules,
but I like to be sure), any pointers to where I could find such a
specification? Also, any plans to follow up on the hinted extension toward
the end of that comment, RE C++ name mangling?

Best Regards,

*J.S.*



*My PGP Public Key Identity*

pub   4096R/*B7A947E4* 2016-11-16 [expires: 2025-12-31]
      Key fingerprint = *E2C4 514F F0FA 52D1 896A  B1D6 3D42 BFD9 B7A9 47E4*
uid       Joshua Saxby <joshua.a.saxby+UMvLnvbsOxBHaeiCHvbdunpz@gmail.com>
uid                   Joshua Saxby (saxbophone) <joshua.a.saxby@gmail.com>
sub   4096R/0A445946 2016-11-16 [expires: 2025-12-31]


More information about the Jit mailing list