This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Help text for ld magic number options


On Mon, 24 Feb 2020, Andreas Schwab wrote:

> On Feb 22 2020, Stephen Casner wrote:
>
> > I propose that the help text be changed as follows:
> >
> >   -n, --nmagic     Make text readonly, page align data, no demand paging
> >   -N, --omagic     Do not make text readonly, do not page align data
> >   --no-omagic      Make text readonly, page align data, do demand paging
> >
> > Is that acceptable?  This would have implications for the ld
> > documentation as well.
>
> I think there is some confusion about what "alignment" means in this
> context.  Here is what the manpage says:
>
> 	       OMAGIC  The text	and data segments immediately follow the
> 		       header and are contiguous.  The kernel loads both text
> 		       and data	segments into writable memory.
>
> 	       NMAGIC  As with OMAGIC, text and	data segments immediately fol-
> 		       low the header and are contiguous.  However, the	kernel
> 		       loads the text into read-only memory and	loads the data
> 		       into writable memory at the next	page boundary after
> 		       the text.
>
> 	       ZMAGIC  The kernel loads	individual pages on demand from	the
> 		       binary.	The header, text segment and data segment are
> 		       all padded by the link editor to	a multiple of the page
> 		       size.  Pages that the kernel loads from the text	seg-
> 		       ment are	read-only, while pages from the	data segment
> 		       are writable.
>
> The alignment appears to refer to the padding added by the link editor
> in the ZMAGIC format.

Thanks for that clarification.  I think "padding" would be the more
operative word than "alignment" here, noting that the latter word does
not appear in the cited paragraphs.

How about:

   -n, --nmagic     Text in readonly pages, not padded for demand paging
   -N, --omagic     Do not make text readonly, do not page align data
   --no-omagic      Make text readonly, align and pad for demand paging

In both my original proposal and this one, the --no-omagic description
is inaccurate for the pdp11-aout format because padding to page
boundaries is never done, but there isn't a way to omit the common
options for some emulations.

                                                        -- Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]