On gcc target machines, when one wanted to compile a shared library, one would need to specify -fpic or -fPIC to get things to work correcly. This is because by default absolute
It depends on the target. Some targets (like x86_64) are position independent by default, sp -fpic
is a noop and has no effect on the generated code. So in those cases you can omit it and nothing changes. Other targets (like x86 32-bit) are not position independent by default, so on those machines, if you omit -fpic
for the executable, it will disable ASLR for that image file (but not for shared libraries it uses).