This is the mail archive of the gcc@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]

Oddities with gcc/g++ linkage


Hi guys,

I was messing with generating object files and linking them in separate
phases.

The code I was using is:
  
  #include <stdio.h>

  int main() {
      printf( "bool = %u\nshort = %u\nint = %u\nlong = %u\n",
              sizeof(bool), sizeof(short), sizeof(int), sizeof(long));
      return 0;
      }

First test:
	g++ sizeof.c -o sizeof
	strip sizeof

On my machine that gives a binary executable size of 44k!

Second test:
	g++ -c sizeof.c
	gcc sizeof.o -o sizeof -lc
	strip sizeof

On my machine this gives me a binary executable size of 3k!!

Third test:
	g++ -c sizeof.c
	g++ sizeof.o -o sizeof -lc
	strip sizeof

This gives me a larger executable size of 44k!

All three executables works fine. 

Can anyone explain such variances in binary size?

Cheers,
Alex
--
 /\_/\  Legalise cannabis now! 
( o.o ) Grow some cannabis today!
 > ^ <  Peace, Love, Unity and Respect to all.

http://www.tahallah.demon.co.uk - *new* - rewritten for text browser users!

Linux tahallah 2.1.122 #43 Sat Sep 19 10:54:36 EDT 1998 One AMD 486 DX/4 processor, 49.77 total bogomips, 32M RAM



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