From: "Rego, P." <pvrego@gmail.com>
Subject: Re: Size optimization for objects
Date: Thu, 18 Jul 2013 08:16:12 -0700 (PDT)
Date: 2013-07-18T08:16:12-07:00 [thread overview]
Message-ID: <682e0154-06ed-47a9-8cd8-f7d71bd31f6a@googlegroups.com> (raw)
In-Reply-To: <krnj0b$sea$1@loke.gir.dk>
On Thursday, July 11, 2013 9:35:23 PM UTC-3, Randy Brukardt wrote:
> To provide a bit more background: the size of an .o file is correlated to
> the associated code size, but it (probably) has no relation to the data size
> at all.
>
> (I'm going to explain how Janus/Ada and some ancient C compilers handled
> these files; I would expect GCC and GNAT to be similar, but I don't know for
> certain.)
> .o files have a bunch headers and typcially three segments: .text (which
> contains code), .data (which contains *initialized* data), and .bss (which
> contains *uninitialized* data). There is also some relocation information
> for the code, so the .o file is generally quite a bit larger than contained
> code alone.
> For Janus/Ada, we put values of *constants* (string literals, float
> literals, static aggregates, etc.) into the .data segment, but not any
> variables. Those all go into the .bss segment. (We did that to support
> putting the code and constants into EEPROM; the data (in the .bss) is the
> only part that has to be mapped to RAM.)
> The .data segment is also present in its entirety in the .o file (it has to
> be, in order to have those initial values). But the .bss segment is just a
> header specifying it's size; it has no contents at all and thus contributes
> almost nothing to the size of the .o file.
> So for Janus/Ada, an .o file is code size + constants size + headers. The
> data size doesn't have any impact on the .o file size at all. It's possible
> that GNAT might put some initialized things into the ".data", but I highly
> doubt it would do that for anything that is really uninitialized.
> Hope this clarifies things.
Certaintly it clarifies, thanks Randy.
next prev parent reply other threads:[~2013-07-18 15:16 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-28 19:49 Size optimization for objects Rego, P.
2013-06-29 7:10 ` Georg Bauhaus
2013-07-01 13:56 ` Rego, P.
2013-07-01 16:49 ` G.B.
2013-06-29 9:48 ` Jack Daniels
2013-07-01 13:58 ` Rego, P.
2013-06-30 11:34 ` rrr.eee.27
2013-07-01 14:35 ` Rego, P.
2013-07-01 15:28 ` Niklas Holsti
2013-07-01 16:35 ` Rego, P.
2013-07-01 18:21 ` Niklas Holsti
2013-07-02 20:32 ` Rego, P.
2013-07-06 16:06 ` Niklas Holsti
2013-07-10 11:57 ` Rego, P.
2013-07-10 11:58 ` Rego, P.
2013-07-11 9:10 ` Niklas Holsti
2013-07-18 14:09 ` Rego, P.
2013-07-18 14:10 ` Rego, P.
2013-07-11 8:35 ` Niklas Holsti
2013-07-12 0:35 ` Randy Brukardt
2013-07-18 15:16 ` Rego, P. [this message]
2013-07-18 15:12 ` Rego, P.
2013-07-18 17:57 ` Niklas Holsti
2013-07-19 5:02 ` Randy Brukardt
2013-07-19 13:20 ` Eryndlia Mavourneen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox