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.uzoreto.com!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: Wed, 17 Jun 2020 17:01:25 +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 MfKks4YzBG/JG4DBYFmfbQi8zvb0esw99XwoW83PIjl/DuahCT Cancel-Lock: sha1:AEPH8M0CoU5pkMdyg+5bF/ZiOQs= 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:59108 List-Id: On 2020-06-17 15:37, Luke A. Guest wrote: > On 16/06/2020 19:19, Tero Koskinen wrote: >> Hi, >> >> I haven't tried with your example, but is GNAT specific pragma >> Linker_Section acceptable? > > I can't really see how it would be as it would still require the > compiler to actually generate the correct value in .data or .rodata > space rather than a 0x0 which gets filled in later by elaboration. > > Interesting though. > > I wrote the above before trying. Trying to place it in ".rodata..." > caused a compiler error, placing it in .data worked, but there is still > elaboration code. The compiler error probably resulted from the compiler generating elaboration code to write something into the read-only ".rodata", right? I once tried to put a static constant (a program-version string) into ".rodata" with pragma Linker_Section, and had no success -- it seemed to me that (the version I had of) the GNU linker was doing some magic with ".rodata" that was not expressed in the linker command script. I changed to use another section name (something of my own invention, perhaps ".version" or whatever) and it worked right away. Of course I also had to update the linker command script to place that section somewhere. (My object in that case was just a static string, so GNAT produced no elaboration code, so no help for the original problem.) -- Niklas Holsti niklas holsti tidorum fi . @ .