Search code examples
iosxamarin.iosaslrpie-chart

How can I enable PIE/ASLR in my monotouch application?


There is an option in XCode Build Settings called "Don't Create Position Independent Executables". This is straight-forward to enable here.

However, I'm using MonoDevelop and MonoTouch to develop my application, and I cannot find the equivalent setting there. I've tried passing the -fpie flag to the compiler, but doesn't seem to work. When I examine the compiled binary using otool, it does not have the PIE flag set.

Please help.


Solution

  • MonoTouch doesn't currently support position independent code, when we AOT the managed code we generate position dependent code.

    We may fix this in the future, but right now it's not a priority.

    Update

    Apple has just started warning about non-PIE enabled executables when publishing to the App Store. This will obviously shift our priorities.

    Update 2

    We have a potential fix which is going through testing / QA (but no firm release date yet).

    Update 3 (2015/03/21)

    This was fixed a long time ago.