[fpc-devel] Cocoa and NOT relocatable

Martin Frb lazarus at mfriebe.de
Thu Jun 8 20:33:36 CEST 2023


On 08/06/2023 19:59, Giuliano Colla via fpc-devel wrote:
> 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.

Great... Yes, it is an important security feature. But a show stopper 
for people who need to debug.

https://forum.lazarus.freepascal.org/index.php/topic,63571.0.html

1) Afaik, FPC still can't resolve addresses with -gl (the line info 
unit, that produces nice dumps on other Platforms).
2) Users can't later resolve them either.




More information about the fpc-devel mailing list