[fpc-devel] Cocoa and NOT relocatable

Giuliano Colla giuliano.colla at fastwebnet.it
Thu Jun 8 19:59:33 CEST 2023


Il 08/06/23 18:40, Martin Frb via fpc-devel ha scritto:

> It seems that on Cocoa an exe is by default relocatable.
> At least a basic test shows that dumping a stack at runtime for each 
> run (no new compile) gives new addresses.
>
> Fpc 3.2.2
>
> Is there a way to turn this off? (some flag to pass to the linker?) 

AFAIK there's no way. It's a feature deep in the way the OS handles 
memory. In a multiprogramming environment any executable must be by 
definition relocatable, because at each run it must fit in a free area 
of memory. So the OS has two choices. Either the executable is not 
relocatable, and you trick it by altering the Memory Management Unit 
tables to map its virtual fixed addresses to any free memory area, or 
you make it relocatable, loose a little time when loading to locate it, 
and do not tamper with MMU mapping tables. It's a system design choice.

Giuliano




More information about the fpc-devel mailing list