From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: How can I get this data into the .data section of the binary? Date: Thu, 18 Jun 2020 12:55:47 +0300 Organization: Tidorum Ltd Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net tHG+2rzYgsQ5mwnOx7dYzQsneTrIdrvkEyNiA/wyQcWlqStlNz Cancel-Lock: sha1:Fb74Pmsd4pbnrN8PoM+DWLYZW9c= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 In-Reply-To: Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:59118 List-Id: On 2020-06-18 5:55, Randy Brukardt wrote: > "Luke A. Guest" 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. [snip] > The better question is why you care? [snip] > (The situation can be different on a bare machine, of course.) As I've posted in this thread two cases where I have needed things like this, here are my reasons for needing them, just for the record. For background, both cases occurred in bare-machine systems in which the entire SW is stored in EEPROM and is then entirely copied to RAM for execution, _including_ the code and read-only (constant) data. For my case of the large constant array, we needed to save RAM space, and did not want to spend RAM _both_ for the elaboration code that initialized the array (larger than the array itself) and for the array. If we had not discovered the positional-association method, we would have had to define the array in assembly language, which would have required _many_ Export pragmas in the Ada source. For my case of the constant version-identifier string, the customer required the executable SW image (in EEPROM) to contain a version identifier at a fixed address. This is a very common requirement in this domain. Of course it can be implemented in many ways (directly in the linker command script, for example), but I was pleased to be able to do it in Ada with the Linker_Section pragma. -- Niklas Holsti niklas holsti tidorum fi . @ .