summaryrefslogtreecommitdiff
path: root/src/cmd/6l/asm.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-04-20 20:39:55 -0700
committerRuss Cox <rsc@golang.org>2010-04-20 20:39:55 -0700
commit35c183cd73760f82f534b657a8a87c520abd4b28 (patch)
tree418f8b65da3bd38bb9943f969c923546ac198188 /src/cmd/6l/asm.c
parent46914854ff711a1dd6f46ab7c62f78acade05a72 (diff)
downloadgolang-35c183cd73760f82f534b657a8a87c520abd4b28.tar.gz
6l, 8l: include ELF header in PT_LOAD mapping for text segment
Due to page boundary rounding, the header would have been loaded as part of the text segment already, but this change placates the "paxctl" tool on so-called hardened Linux distributions (as if normal distributions weren't already hard enough to use). R=r CC=golang-dev http://codereview.appspot.com/954041
Diffstat (limited to 'src/cmd/6l/asm.c')
-rw-r--r--src/cmd/6l/asm.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/cmd/6l/asm.c b/src/cmd/6l/asm.c
index af00f5594..b83cec68f 100644
--- a/src/cmd/6l/asm.c
+++ b/src/cmd/6l/asm.c
@@ -713,11 +713,11 @@ asmb(void)
ph = newElfPhdr();
ph->type = PT_LOAD;
ph->flags = PF_X+PF_R;
- ph->vaddr = va;
- ph->paddr = va;
- ph->off = fo;
- ph->filesz = w;
- ph->memsz = w;
+ ph->vaddr = va - fo;
+ ph->paddr = va - fo;
+ ph->off = 0;
+ ph->filesz = w + fo;
+ ph->memsz = w + fo;
ph->align = INITRND;
fo = rnd(fo+w, INITRND);