delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/07/16/10:47:18

From: "Michel Chassey" <michelc AT primus DOT ca>
Newsgroups: comp.os.msdos.djgpp
References: <El5c5.624$r3 DOT 5370 AT news2 DOT tor DOT primus DOT ca> <iuc2nscp20s7ju0ib6k4v7bfkl9n2de9br AT 4ax DOT com>
Subject: Re: Globals and binary size
Lines: 46
X-Newsreader: Microsoft Outlook Express 4.72.3155.0
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0
Message-ID: <jHjc5.753$r3.5818@news2.tor.primus.ca>
Date: Sun, 16 Jul 2000 10:26:22 -0500
NNTP-Posting-Host: 209.167.12.130
X-Complaints-To: news AT primus DOT ca
X-Trace: news2.tor.primus.ca 963757903 209.167.12.130 (Sun, 16 Jul 2000 10:31:43 EDT)
NNTP-Posting-Date: Sun, 16 Jul 2000 10:31:43 EDT
Organization: Primus Canada
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

My program is myprog.cpp so I guess (was a bug).
I have to say I never heard of BSS, I only knew about the DATA segment.
So if I have : unsigned long long    BITMAPa [ 64 ];
and another BITMAPb (initialized) my program prints this
(in French) :

Adresse de _BITMAPa = 60968       /*   (uninitialized  in Data segment ?) */
sizeof de _BITMAPa = 512
Adresse de _BITMAPb = 57056        /*  (initialized in BSS segment ?) */
sizeof de _BITMAPb = 512

A program snippet with 2 arrays produces a 143k binary which gets strip'ped
down to 60k. Can UPX do better ?


Damian Yerrick a écrit dans le message ...
>On Sat, 15 Jul 2000 18:06:38 -0500, "Michel Chassey"
><michelc AT primus DOT ca> wrote:
>
>>I use many global arrays in my program and I am puzzled because the
>>binary size increase does not reflect sizeof ( _new_array).
>>As an example, adding : unsigned long long    _BITMAP [ 64 ];
>>(sizeof is 512), produces a binary size increase of only  about 53
>>bytes. This last number varies from 49 to 53.
>>
>>Could you point me to some reference on how globals are stored
>
>Ever heard of BSS?  Many systems' binaries have three segments, called
>TEXT (program code), DATA (pre-initialized global and static data),
>and BSS (uninitialized global and static data that will be allocated
>and zero-filled on run).  DJGPP probably has something similar.
>
>There is (was?) a bug in GCC that put C++ programs' uninitialized
>global data in DATA instead of BSS; however, it's zeroes, and zeroes
>are easily compressible (see also UPX).
>  http://upx.tsx.org/
>
>--
>Damian Yerrick
>"I refuse to listen to those who refuse to listen to reason."
>See the whole sig: http://www.rose-hulman.edu/~yerricde/sig.html
>
>This is McAfee VirusScan. Add these two lines to your signature to
>prevent the spread of signature viruses.  http://www.mcafee.com/


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019