Tell if a shared library was compiled with positio

2019-08-12 19:21发布

问题:

Is there a way to tell whether an OSX shared library (.dylib) was compiled as position independent code/executable?

回答1:

According to this answer you can run otool -hv <file_path> and look for a PIE flag.

Edit: I tested this and it does not work.

Edit 2: Actually it does work on executables. I'm not sure it works on shared libraries.