RFC: ELF: Add a "-z readonly" option to ld
Alan Modra
amodra@gmail.com
Wed Nov 8 03:44:00 GMT 2017
On Tue, Nov 07, 2017 at 04:25:22PM -0800, H.J. Lu wrote:
> To reduce the file size, I changed the default max page size to the
> common page size when -z readonly is used.
So what happens if the executable is run on a system using
maxpagesize? I suspect it dies, which isn't OK. The executable must
still run, but it would be reasonable to not provide the expected
non-exec protection in that case.
To do this correctly, and reduce file and memory size when running on
a system using commonpagesize, I think you're going to need a new
script. The transitions between the first read-only segment and the
text segment and then to the next read-only segment ought to use
alignments like we do currently for the transition to the read/write
segment when not relro. Which if I'm remembering correctly is to
leave a maxpagesize gap then conditionally align to commonpagesize.
(For a first pass at the support, you might like to try always
aligning to commonpagesize.)
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list