How can i fix MinGW -Wl, --dynamicbase not working properly?

803 views Asked by At

I just read about ASLR, and i found gcc have related flag for ASLR from here. The flag is -Wl,--dynamicbase, so i try it with this command gcc test.c -Wl,--dynamicbase -o test.exe. I try run it and everything runs well, but when i check for ASLR with ProcessExplorer, it looks like ASLR for my program is turned off. I continue reading and find this flag -pie -fPIE, then i try again with this command gcc test.c -Wl,--dynamicbase -o test.exe -pie -fPIE, but after i run, the program receive SIGSEGV. I don't know for sure what is the problem. So could you give me the right flag or what i miss? My computer support for ASLR, i know it because ProcessExplorer show some process with ASLR turned on. Thanks for your attention.

test.c

#include <stdio.h>

int main(){
    puts("lol");
}
0

There are 0 answers