Reputation: 3682
I need to know if using -s in GCC (g++) will have any effects on the PIE. I also want to know its effects on a position-dependent executable. As far as I know, not using any linking option (like -pie and -fpie) results in a non-PIE just like when using -no-pie. Now I have an executable and that's probably non-PIE since I have not specified -pie in the link command. Can -s
cause any problems? Will it improve the performance (since the exe will be smaller)?
I also checked this question and in the answer it says:
It seems pretty clear that removing relocation information would interfere with ASLR.
But ASLR only deals with position-independent executables, right? Could removing relocation data from a position-dependent executable interfere with ASLR?
Upvotes: 0
Views: 215
Reputation: 3682
After doing a bit of research, I found some info that might be correct.
From GCC Options for Linking:
-pie
Produce a dynamically linked position independent executable on targets that support it.
-no-pie
Don’t produce a dynamically linked position independent executable.
Looking at this, my guess is that both options produce position-independent executable and the only difference is that the former is dynamically linked but the latter is not dynamically linked (statically linked??). Therefore in both cases, the executable contains relocation data. However, it is still unclear to me whether the generated executable (using -s
) interferes with ASLR or not.
Upvotes: 0