From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,69431b06fe9a3239 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder.news-service.com!feeder.erje.net!news.szaf.org!news.gnuher.de!news.enyo.de!not-for-mail From: Florian Weimer Newsgroups: comp.lang.ada Subject: Re: How do I disable elaboration code on this Date: Thu, 14 Apr 2011 21:19:35 +0200 Message-ID: <87vcygtzco.fsf@mid.deneb.enyo.de> References: <58bc4fb4-5f6a-48d6-9c98-0dde7ac619df@p16g2000vbo.googlegroups.com> <4da2176e$0$6977$9b4e6d93@newsspool4.arcor-online.net> <93b20b91-03ed-48d2-87b6-a109127a5a4f@l18g2000yql.googlegroups.com> <6bca8b26-152f-482c-95c0-1abf88b6b29b@a26g2000vbo.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ruchba.enyo.de 1302808775 14009 172.17.135.6 (14 Apr 2011 19:19:35 GMT) X-Complaints-To: news@enyo.de Cancel-Lock: sha1:WLo1HVYfBOizt+47c1MTX0xsJfk= Xref: g2news2.google.com comp.lang.ada:19765 Date: 2011-04-14T21:19:35+02:00 List-Id: * Lucretia: > The problem has nothing to do with the linker, I'm using binutils and > gnat that I'e built myself. The problem is that GNAT is generating > elaboration code where it is not allowed, i.e. code that 1) > initialises the array to 0 and 2) code that the copies function > addresses into the array. I believe that this is simply a missed optimization opportunity in GNAT. There have been some changes to increase the number of cases where initialization can be preelaborated, but this particular area has not been covered so far. As for workarounds, using an .S file which allocates the object at the right address and initializes it seems to be the best way to deal with this issue at present. Or you could use a C file and a section attribute. C treats pointers to function designators as constant expressions, but there does not seem to be a C extension which allows one to specify the address of an object.