Re: Same code but different objects layout = different output object size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 23 Feb 2008 16:46:54 -0800
Christopher Layne <clayne@xxxxxxxxxxxx> wrote:

> On Fri, Feb 22, 2008 at 10:31:38AM -0300, Felipe Astroza wrote:
> > On Wed, 20 Feb 2008 14:35:56 -0600
> > John Love-Jensen <eljay@xxxxxxxxx> wrote:
> > 
> > We have next files:
> > cat << EOF > full.c
> > #include <stdio.h>
> > 
> > void imprime(const char *m)
> > {
> >         printf("%s\n", m);
> > }
> > 
> > int main()
> > {
> >         imprime("Beautiful day");
> >         return 0;
> > }
> > EOF
> > cat << EOF > a.c
> > void imprime(const char *m);
> > int main()
> > {
> >         imprime("Beautiful day");
> >         return 0;
> > }
> > EOF
> > cat << EOF > b.c
> > #include <stdio.h>
> > void imprime(const char *m)
> > {
> >         printf("%s\n", m);
> > }
> > EOF
> > 
> > Now,
> > gcc a.c b.c -o ab
> > "a.c" and "b.c" built "ab"
> > 
> > gcc full.c -o full
> > "full.c" built "full"
> > 
> > In comparing files sizes (Target:amd64):
> > du -b full
> > 8396
> > du -b ab
> > 8453
> 
> btw: you do know the unix command "size" is specifically
> designed for object code, right?
> 
> -cl
Christopher,

   Thank you, I dont know about "size".
text, data, bss have same size. but objdump tell me that .comment is bigger in
"ab" than "full". This is due because "ld" combines ".comment" setions of every object file. My "ld -s" don't remove .comment, however I found a solution, "strip --remove-section=.comment", from this mail list: http://gcc.gnu.org/ml/gcc-prs/2001-04/msg00762.html

FA

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux