|
-
February 24th, 2003, 08:56 PM
#1
Object file size different for same source code?
I have 2 directories having the same set of C source codes.
I ran the same makefile to compile the source to object files in both directories. However the two copies of .obj file generated have different sizes!
Since the .obj are subseqently linked into library files, it made the two libraries to differ in size too.
Just want to confirm that both libraries have identical functionality even though they have different size. Any idea?
-
March 11th, 2003, 05:53 PM
#2
Are these directories in different partitions with differing file systems?
If file systems are not identical, that would account for differences in size.
Another thing could be that some options for liking are different in the makefiles, unless these makefiles are identical, of course.
Also, you might have a global variable responsible for setting up build area with debug information (in addition to your compiler options). Even that variable might make a difference.
Or, it could be as simple as that one of your builds was not entirely succesfull.
<|>
-
March 12th, 2003, 01:13 AM
#3
Thanks for the reply.
I tried compiling the same source codes on a few different directories in the SunOS 5.8 machine.
The files I have are located as follows:
$HOME/csrc/test.c
$HOME/csrc/test.h
$HOME/csrc/include/test.h
$HOME/include/test.h
Note that the test.h header files are identical.
Next I run following gcc command successfully noting down the generated obj file test.o each time. The result was all 3 obj differs by a few bytes.
gcc -g2 -DDEBUG -c -o test.o test.c
gcc -g2 -DDEBUG -c -I./include -o test.o test.c
gcc -g2 -DDEBUG -c -I../include -o test.o test.c
Doing the little experiment, I guess the file size is not an issue. I have even created copies of shared library .so from the different .o and used it without running into errors.
-
March 12th, 2003, 05:50 PM
#4
This is, indeed, strange. Since I don't know how different the sizes are for your test.o files, the only thing I could think of is that the include option for test.h for gcc is the one responsible here.
Basically, -I option is translated into object code, which may slightly differ in size, as a result. I have seen that happening, but it is more of an issue in Windows than in Unix; at least, I thought so...
<|>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|