This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC 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: gcc and small command line tasks


Thank you Dr. Beebe, got it in one.

I did not think so much  as 400K would be needed for a printf (laughing at
myself again).

Thanks all,

Jay

At 06:45 AM 8/12/05 -0600, Nelson H. F. Beebe wrote:
>James Nickson <jaynicks@earthlink.net> asks why a hello-world test
>produced a 471K executable program.
>
>I suspect that what Jack was seeing in the simple hello.c test is the
>difference between static and dynamic linking.  
>
>For example, on Sun Solaris 8:
>
>	% gcc -o hello hello.c
>	% ls -l hello
>	-rwxrwxr-x  1 beebe staff 6196 Aug 12 06:38 hello
>
>	% gcc -static -o hello hello.c
>	% ls -l hello
>	-rwxrwxr-x  1 beebe staff 363296 Aug 12 06:39 hello
>
>While dynamic linking is the default on all modern operating systems,
>there are cases (e.g., CD-ROM distribution of software and standalone
>boot and rescue disks) where static linking is required to avoid
>dependencies on shared libraries that might be in different locations
>on some remote system than on the system where the executable was
>built, or might be corrupted (consider what happens to your Unix
>system if /lib/libc.so.1 develops a bad disk block: virtually nothing
>can run).
>
>
>---------------------------------------------------------------------------
----
>- Nelson H. F. Beebe                    Tel: +1 801 581 5254
   -
>- University of Utah                    FAX: +1 801 581 4148
   -
>- Department of Mathematics, 110 LCB    Internet e-mail:
beebe@math.utah.edu  -
>- 155 S 1400 E RM 233                       beebe@acm.org
beebe@computer.org -
>- Salt Lake City, UT 84112-0090, USA    URL:
http://www.math.utah.edu/~beebe  -
>---------------------------------------------------------------------------
----
>
=============================================
James Nickson                                  jaynicks@lccdigital.com
19 O.Cheq.Nk.Rd., Wellfleet, MA                      508.349.2422


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