From: Donald J. Becker (becker@super.org)
Date: 04/07/93


From: becker@super.org (Donald J. Becker)
Subject: Re: [Q]  When to use -N for compiling ?
Date: Wed, 7 Apr 1993 19:57:58 GMT

In article <C54o2q.4rz@news.claremont.edu> michael@jarthur.claremont.edu (Michael Elkins) writes:
>I've noticed that if you compile with -N (making the executable non demand
>paging), it makes the binary significantly smaller. There don't seem to be
>any noticeable performance effects, so I was wondering what making your binary
>demand paging does for you?

This has come up several times recently, so a posting is in order.

The '-N' flag to gcc (really to the linker -- it's passed on by gcc)
makes the executable non-demand-paged.
    pro: The sections don't have be page aligned, saving disk space.
    con: You can't demand-page or share the executable image.

For small programs (ones that fit into 4K with -N) there is no
real trade-off: you'll be dirtying (and thus copying) a page anyway, and
and you might as well save the disk space by using '-N'.

For large programs demand-paging is the only reasonable solution, and
'-N' doesn't save a significant amount of space for these anyway.

The only tough decision is when the executable takes just a little
over 4K. My approach is to either trim it down to fit in 4K, or
forget '-N'. Hmmm, I wonder if the linker could automatically do
'-N' for small executables, with a command-line override.

-- 
Donald Becker                                  becker@super.org
Supercomputing Research Center
17100 Science Drive, Bowie MD 20715                301-805-7482