[fpc-devel] Maximum symbol length -- answer needed

Blaise at blaise.ru Blaise at blaise.ru
Fri Jun 22 17:19:21 CEST 2018

On 15.06.2018 11:54, Blaise wrote:

> What is the official maximum symbol length? If it is 255, as the definition "TSymStr = ShortString" suggests, then FPC does not always take proper care of it.
> In particular, TGNUAssembler.WriteTree has plenty of concatenations similar to this one
>      writer.AsmWriteLn(tai_symbol(hp).sym.name + ':')
> which result in corrupt asm files.
> (I am bumping into this bug in practice, with closures.)
> I presume, those concatenations should be converted into chains of invocations. This should also make things faster for "symansistr" case.
> Side question: I see that the define "symansistr" is used for JVM and LLVM. What was the rationale?


In case I was not clear enough: when I asked should "those concatenations be converted into chains of invocations", I meant "will a patch with such fixes be accepted", or is there a recommended solution for these bugs?

If such concatenations are somehow dear to someone, I could imagine a solution where the actual limit is defined to be, say, 250. But then, still, care would need to be taken not to overconcatenate in lines like
	writer.AsmWriteLn('.quad .' + tai_symbol(hp).sym.name + ', .TOC. at tocbase, 0');

Also, I need the definitive answer on the limit to properly shorten symbols. Right now, it seems there are places where some heuristics are applied that do not guarantee proper results (i.e. symbols may be cut, not shortened -- even before they reach the above buggy output code).


More information about the fpc-devel mailing list