[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::decc

Title:DECC
Notice:General DEC C discussions
Moderator:TLE::D_SMITHNTE
Created:Fri Nov 13 1992
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2212
Total number of notes:11045

2187.0. "Size of executables." by CHEFS::WILLIAMSA (I wanna be Luke) Wed May 14 1997 08:39

    Now I'm sure this is a really dumm question, but I'll ask anyways!
    
    When I write a c program on VMS (just a hello world or something) the
    size is 1 block, compile/link it and it comes to 4 blocks. OK.
    
    Why when I do the same thing on Digital Unix (version doesn't seem to
    make any difference) is the size diference soo much bigger?
    
    cfacs_fm> cc -o hello hello.c
    cfacs_fm> ls -l hello* 
    
    -rwxrwxr-x   1 fm       users      24576 May 14 12:32 hello
    -rw-rw-r--   1 fm       users         57 May 14 12:32 hello.c
    cfacs_fm> cat hello.c
    #include <stdio.h>
    
    main()
    {
    printf("Hello world\n");
    }
    
    Am I missing something ragingly obvious here, or is it just how Unix
    is???
    
    Alen.
T.RTitleUserPersonal
Name
DateLines
2187.1perhaps a private copy is the default?CUJO::SAMPSONWed May 14 1997 11:073
    Just a guess, but maybe the default on Digital UNIX is to pull in all
    of the object code needed for a printf()?  That is, maybe it would help
    to specify the appropriate sharable library?
2187.2Looks like minimum exe file size is larger on D.UnixSUBPAC::FARICELLIWed May 14 1997 12:1123
  If you do a "size" of the hello executable, you will see:

uogsrv-37> size hello
text    data    bss     dec     hex
8192    8192    0       16384   4000

  Looks like the minimum size of the text and data for an executable on
  Alpha/Unix is 8192 (same as the page size, suprise suprise).
  If you use the 'strip' command to delete the symbol table and
  relocation bits in the executable, the file size decreases to 16384,
  which is exactly 2*8192.

  In other words, the minimum executable file size appears to be larger for
  Alpha/Digital Unix than for Alpha/OpenVMS.

  FWIW, one of my large programs is 1482752 bytes on Alpha/Digital Unix,
  but 1587712 bytes on Alpha/OpenVMS. So there ;-)

  FWIW, regarding reply .1, -call_shared is the default (that is,
  shared libs are used by default).

  -- John Faricelli
2187.3DECCXL::OUELLETTEmudseason into blackfly seasonWed May 14 1997 18:099
You also need to consider the difference between the image activator on VMS
and exec on Unix.  Unix more or less memory maps the file, relocates the
parts with relocations and jumps into the program.  VMS's image activation
does a bit more unpacking for you and so may not need a full page of disk
image for what will eventually be the $CODE$ section of the program...
Speculation on my part.  The 2 page minimum on Unix is pretty clear though.
One page for .text one page for .data.

R.