From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: How can I get this data into the .data section of the binary?
Date: Wed, 17 Jun 2020 21:55:04 -0500 [thread overview]
Message-ID: <rcel2a$4hp$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: rcaicd$ifh$1@gioia.aioe.org
"Luke A. Guest" <laguest@archeia.com> wrote in message
news:rcaicd$ifh$1@gioia.aioe.org...
...
> According to 10.2.1 it should be possible:
>
> is important that programs be able to declare data structures that
> are link-time initialized with aggregates, string_literals, and
> concatenations thereof. etc.
>
> Even adding pragma Preelaborable_Initialization (x) for each of the
> types, doesn't do anything.
The requirement in the Ada Standard is that one should preelaborate data if
the containing package is preelaborated. There's no requirement otherwise,
and since it is an annex C requirement, it is not required of all Ada
compilers. Janus/Ada, for instance, has no concept of an initialized but
modifiable data segment so it can't do precisely what you want. (It does put
aggregates into such a segment, but it will copy them if they are used to
initialize variables.) We did that to match the RAM/ROM split of many
embedded systems.
Anyway, I would expect a compiler to do it if it is possible. But it very
often isn't possible for one reason or another (for instance, static
aggregates often are *way* bigger than dynamic initialization, so for a
compiler that tries to minimize memory usage, static initialization may not
be a good idea in some cases).
The better question is why you care? One ought to be concerned about whether
performance is good enough for your application, and it's highly unlikely
that the load time would have any impact on that whatsoever. (And as
previously noted, static initialization can require more work to load a
program.) On a desktop, antivirus overhead is way more than any sort of load
cost/saving from the memory layout. (The situation can be different on a
bare machine, of course.)
Randy.
next prev parent reply other threads:[~2020-06-18 2:55 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-16 11:31 How can I get this data into the .data section of the binary? Luke A. Guest
2020-06-16 11:37 ` Luke A. Guest
2020-06-16 11:50 ` J-P. Rosen
2020-06-16 12:36 ` Luke A. Guest
2020-06-16 12:45 ` Luke A. Guest
2020-06-16 12:56 ` J-P. Rosen
2020-06-16 12:59 ` Luke A. Guest
2020-06-16 13:29 ` J-P. Rosen
2020-06-16 13:44 ` Luke A. Guest
2020-06-18 2:55 ` Randy Brukardt [this message]
2020-06-18 9:55 ` Niklas Holsti
2020-06-21 3:55 ` Randy Brukardt
2020-06-21 6:55 ` Niklas Holsti
2020-06-16 13:52 ` Mark Lorenzen
2020-06-16 14:08 ` Luke A. Guest
2020-06-16 13:03 ` Luke A. Guest
2020-06-16 14:14 ` Niklas Holsti
2020-06-16 14:25 ` Dmitry A. Kazakov
2020-06-16 14:32 ` Niklas Holsti
2020-06-16 14:42 ` Luke A. Guest
2020-06-16 15:21 ` Dmitry A. Kazakov
2020-06-16 15:43 ` Luke A. Guest
2020-06-16 16:11 ` Dmitry A. Kazakov
2020-06-16 14:40 ` Luke A. Guest
2020-06-16 18:19 ` Tero Koskinen
2020-06-17 12:37 ` Luke A. Guest
2020-06-17 14:01 ` Niklas Holsti
2020-06-17 15:17 ` Luke A. Guest
2020-09-03 10:32 ` c+
2020-09-13 13:36 ` patelchetan1111992
2020-09-19 14:08 ` erchetan33
2020-09-28 11:36 ` yhumina stir
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox