[fpc-devel] Cocoa and NOT relocatable

Jonas Maebe jonas at freepascal.org
Thu Jun 8 20:59:03 CEST 2023

On 08/06/2023 18:40, Martin Frb via fpc-devel wrote:
> 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?)

It's not called relocation, but address space layout randomization 
(ASLR). You can disable it by compiling/linking your binary with -k-no_pie

Alternatively, you can launch a program via posix_spawnp using a custom 
attribute to disable ASLR for just that invocation. See e.g. main.c at 


More information about the fpc-devel mailing list