Mangled names for data blocks

The rules for mangled names for variables and typed constants are as follows:

Currently, in Free Pascal v1.0, if you declare a variable in unit name tunit, with the name _a, and you declare the same variable with name a in unit name tunit_, you will get the same mangled name. This is a limitation of the compiler which will be fixed in release v1.1.

Examples

 unit testvars;
 
 interface
 
 const
  publictypedconst : integer = 0;
 var
  publicvar : integer;
 
 implementation
 const
  privatetypedconst : integer = 1;
 var
  privatevar : integer;
 
 end.
 

Will give the following assembler output under GNU as :

 .file "testvars.pas"
 
 .text
 
 .data
 # [6] publictypedconst : integer = 0;
 .globl TC__TESTVARS$$_PUBLICTYPEDCONST
 TC__TESTVARS$$_PUBLICTYPEDCONST:
 .short 0
 # [12] privatetypedconst : integer = 1;
 TC__TESTVARS$$_PRIVATETYPEDCONST:
 .short 1
 
 .bss
 # [8] publicvar : integer;
 .comm U_TESTVARS_PUBLICVAR,2
 # [14] privatevar : integer;
 .lcomm _PRIVATEVAR,2