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
https://golang.org/cl/954041
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);
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);