On Tue, Apr 16, 2019 at 12:16:16PM +0200, Jakub Jelinek wrote: > On Tue, Apr 16, 2019 at 11:33:39AM +0200, Florian Weimer wrote: > > * Segher Boessenkool: > > > > > On Mon, Apr 15, 2019 at 01:54:11PM +0200, Florian Weimer wrote: > > >> * Richard Biener: > > >> > > >> > Of course adding sth like a .robss section would be nice. > > >> > > >> I think this is strictly a link editor issue because a read-only PT_LOAD > > >> directive with a memory size larger than the file size already produces > > >> read-only zero pages, without requiring a file allocation. > > > > > > But .rodata normally is not the last thing in its segment (the .eh* > > > things are after it, and those are usually not all zero). > > > > If you don't mind the proliferation of load segments (we've add many of > > them in recent years), placement does not matter. > > That is something I really dislike, each load segment has a significant cost > and from what I remember, at least one of the 4 PT_LOADs in current setup is > completely useless: > LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x02bf60 > 0x02bf60 R 0x1000 > LOAD 0x02c000 0x000000000002c000 0x000000000002c000 0x0a74a5 > 0x0a74a5 R E 0x1000 > LOAD 0x0d4000 0x00000000000d4000 0x00000000000d4000 0x033fd0 > 0x033fd0 R 0x1000 > LOAD 0x108d50 0x0000000000109d50 0x0000000000109d50 0x00b814 > 0x0153d8 RW 0x1000 > there is no reason not to reorder at least on most targets the sections such > that there is just one R, one R E and one RW segment.
It is more painful if your segments are aligned to 64kB or anything else bigger, too. Segher