summaryrefslogtreecommitdiff
path: root/src/cmd/8l/asm.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2012-08-03 15:27:35 -0400
committerRuss Cox <rsc@golang.org>2012-08-03 15:27:35 -0400
commit794abc24e0983d3fc7da093aacf8960c5191e9c6 (patch)
tree0d500850b82fea6c3899af537d4a06f5ec1f4261 /src/cmd/8l/asm.c
parent45999e2dc45fb41860a9b35840c2177bbe912165 (diff)
downloadgo-794abc24e0983d3fc7da093aacf8960c5191e9c6.tar.gz
cmd/ld: add PT_PAX_FLAGS ELF header
PAX systems are Linux systems that are more paranoid about memory permissions. These flags tell them to relax when running Go binaries. Fixes issue 47. R=iant CC=golang-dev http://codereview.appspot.com/6326054
Diffstat (limited to 'src/cmd/8l/asm.c')
-rw-r--r--src/cmd/8l/asm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cmd/8l/asm.c b/src/cmd/8l/asm.c
index 6c3a76e4d..99c9b238b 100644
--- a/src/cmd/8l/asm.c
+++ b/src/cmd/8l/asm.c
@@ -1127,6 +1127,11 @@ asmb(void)
ph->flags = PF_W+PF_R;
ph->align = 4;
+ ph = newElfPhdr();
+ ph->type = PT_PAX_FLAGS;
+ ph->flags = 0x2a00; // mprotect, randexec, emutramp disabled
+ ph->align = 4;
+
sh = newElfShstrtab(elfstr[ElfStrShstrtab]);
sh->type = SHT_STRTAB;
sh->addralign = 1;