Summary: Pure vs. Demand Paged Sparc Executables

From: Robert Fullmer (fullmer@owlnet.rice.edu)
Date: Mon Aug 24 1992 - 10:36:52 CDT


A couple days ago I asked about how to create pure dynamically linked
executables, which I had observed were significantly smaller for short
programs than statically linked or even demand paged dynamically linked
files.

Several people gave me useful answers, they are included below:
+++++
From: brendan@cygnus.com (Brendan Kehoe)

[G]ive this a shot:

        ld -e start -assert pure-text -n -Bdynamic -dc -dp /lib/crt0.o ...

--
Brendan Kehoe                                               brendan@cygnus.com
Cygnus Support, Palo Alto, CA                                  +1 415 322 3811
                       Oooh! A handsome stranger! And me, without my shoes on.
                                     --The Princess, The Emperor's New Clothes
+++++
From: Joseph Tam <tam@ocgy.ubc.ca>

The magic flags you need are in the linking step:

cc -o <program> -n -Bdynamic <object files>

I've found, though, that some programs get broken if I use these flags.

Joseph Tam <tam@ocgy.ubc.ca> \___ \___________ Department of Oceanography \___ \___________ University of British Columbia \___ \___________ Vancouver, BC, Canada \___ \___ V6T 1W5 \___ \___ \___ \___ \___ \___ Phone: (604) 822-3911 \_________ \__ \___ \__ Fax: (604) 822-6091 \______ \__ \___ \__ +++++ From: Paul Kranenburg <pk@cs.few.eur.nl>

Use `cc -n -Bdynamic'. The man page for ld says that the -n and -N options turn off the default "-Bdynamic" so you have to switch it on again manually.

I guess this only useful for small executables since you gain only about half a page on average for the text and data segments. On the other hand, you loose demand paging, meaning that your text segment has to be allocated from swap space (or better, "anonymous pages" which must be backed by swap space).

-pk +++++

I'd like to thank them all publicly for responding so quickly to my inquiry. The trick is to use "-n -Bdynamic", as they all mention. This works, and creates small binaries, that are both pure (instead of demand paged) and dynamically linked.

Rob Fullmer : celine@athena.mit.edu : fullmer@rice.edu



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:48 CDT