diff options
-rw-r--r-- | rts/linker/elf_got.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/rts/linker/elf_got.c b/rts/linker/elf_got.c index ee73a4a4da..9be2490a17 100644 --- a/rts/linker/elf_got.c +++ b/rts/linker/elf_got.c @@ -64,8 +64,6 @@ makeGot(ObjectCode * oc) { symTab->symbols[i].got_addr = (uint8_t *)oc->info->got_start + (slot++ * sizeof(void*)); - if(mprotect(mem, oc->info->got_size, PROT_READ) != 0) { - sysErrorBelch("unable to protect memory"); } } return EXIT_SUCCESS; @@ -115,6 +113,11 @@ fillGot(ObjectCode * oc) { } } } + + // We are done initializing the GOT; freeze it. + if(mprotect(oc->info->got_start, oc->info->got_size, PROT_READ) != 0) { + sysErrorBelch("unable to protect memory"); + } return EXIT_SUCCESS; } |