[fpc-pascal] Symbols in binary

Sven Barth pascaldragon at googlemail.com
Mon Oct 19 22:28:21 CEST 2026


Am 19.10.2026 um 14:17 schrieb Adriaan van Os via fpc-pascal:
> Consider the following test program:
>
> program symbols;
> var
> stat: TFPCHeapStatus;
> begin
> stat := GetFPCHeapStatus;
>   writeln( 'FPC FPCHeapStatus.CurrHeapUsed = ', stat.CurrHeapFree)
> end.
>
> When I compile it with -XX- -Xs, there is a string "TFPCHeapStatus" in 
> a Mach-O (__TEXT, __const) section. When I compile it with -XX, the 
> string "TFPCHeapStatus" in not in that same Mach-O (__TEXT, 
> __const) section, nor anywhere else. Is that expected behaviour ? And 
> how do I get rid of unnecessary symbols like "TFPCHeapStatus" when not 
> smart-linking ?

The string "TFPCHeapStatus" is from the RTTI for the record. Considering 
that you're not using it (e.g. by using "TypeInfo(TFPCHeapStatus)"), 
smart linking will detect that and not link it in, that's the purpose of 
smart linking after all. Without smart linking all such identifiers will 
be linked in. This is by design.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20261019/0616e180/attachment.htm>


More information about the fpc-pascal mailing list