Symbol name character restrictions

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


Thanks for that info Marc, I can't believe I missed it!

I had a feeling that assemblers/object files were pretty permissive to
symbol names at least in principle.

This seems to contradict that comment from libgccjit source that I brought
up earlier, I wonder what other technical limitations (if any) are there in
the character set that jit's symbols can support?

Thanks,
*J.S.*



*My PGP Public Key Identity*

pub   4096R/*B7A947E4* 2016-11-16 [expires: 2017-05-15]
      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: 2017-05-15]




On Mon, 10 Apr 2023 at 15:43, Marc Nieper-Wißkirchen <marc.nieper@gmail.com>
wrote:

> According to the documentation of the GNU assembler at
> https://sourceware.org/binutils/docs/as/Symbol-Intro.html, any
> characters except for the NUL character are allowed in symbol names.
>
> Am Mo., 10. Apr. 2023 um 16:40 Uhr schrieb Joshua Saxby via Jit
> <jit@gcc.gnu.org>:
> >
> > 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