cmd/link: reserve space for dynamic section for GOOS=nacl #22129
Labels
FrozenDueToAge
OS-NaCl
GOOS=nacl, Native Client, removed in Go 1.14
Proposal
Proposal-Accepted
Suggested
Issues that may be good for new contributors looking for work to do.
Milestone
The Native Client sandbox has support for dynamic code generation and patching at runtime. This is done safely using the regular NaCl checks so it preserves the sandbox properties.
Address space for dynamic code is reserved with the NaCl
dyncode_create
system call. Go currently has access to this system call. The actual address space comes from a dynamic section created at load time by NaCl. This section is placed between the.text
and.rodata
sections.Currently the Go linker places the
.rodata
section right next to the.text
section, so the NaCl dynamic loader doesn't have any space to create the dynamic text section. I propose forGOOS=nacl
we leave a sizeable gap between.text
and.rodata
so that the NaCl dynamic loader has enough space to create the dynamic text section. This is trivial to accomplish, it's a one line-patch togo/src/cmd/link/internal/ld/data.go:/address/
, I tested it and it works.One reason to enable this functionality would be to allow creating performant interpreters that use JIT technology.
Another reason would be the fact that NaCl might stop supporting non-dynamic-text-enabled executables in the future. The file
native_client/src/trusted/service_runtime/sel_ldr.h
has the following comment in it:For people who do not wish to have access to dynamic code generation NaCl provides the
NACL_DISABLE_DYNAMIC_LOADING
environment variable, which turns off dynamic text section generation.The text was updated successfully, but these errors were encountered: