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!news2.google.com!news.glorb.com!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: How do I disable elaboration code on this Date: Mon, 11 Apr 2011 11:10:41 +0100 Organization: A noiseless patient Spider Message-ID: 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 Injection-Info: mx02.eternal-september.org; posting-host="dFCm8HWntFqmDIilBLqEJQ"; logging-data="19248"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+CT2jhcIKSwzdNsfX/aQxHO1Epn21BR64=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (darwin) Cancel-Lock: sha1:9+6DTHBDfpjXn3Uwk+4y24FY8aY= sha1:2iLbKNBjPLyT9aY6XPs6y+qnS2s= Xref: g2news2.google.com comp.lang.ada:19723 Date: 2011-04-11T11:10:41+01:00 List-Id: Lucretia writes: > 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. > > If this cannot work then I'm surprised and I'll be forced to use > separate constants as noted by Rolf. It just seems like overkill > having to specify each element separately when an array is the right > structure ffor the job. > > And in other languages like C it doesn't do the same thing. You can > specify a static constant array and it'll initialise it with the right > data. And can you also specify the load address? I happen to have a cross-compiler for VxWorks here (handy now, but I ought to delete it) so I tried the following. First, add markers so I can see what's what (note, the syntax for a linker section name is different for VxWorks): Start : constant Integer := 16#1234_5678#; pragma Linker_Section (Start, "initial_isv#0"); Vector : constant Vectors := (Dummy'Access, Dummy'Access, Dummy'Access, Dummy'Access); pragma Convention (C, Vector); pragma Linker_Section (Vector, "initial_isv#0"); -- for Vector'Address use Addr; Finish : constant Integer := 16#1234_4321#; pragma Linker_Section (Finish, "initial_isv#0"); Build: $ powerpc-wrs-vxworks-gnatmake test.adb \ -f -largs -Wl,--section-start -Wl,initial_isv=0x0 which generates an ELF file: $ powerpc-wrs-vxworks-objdump -h -r test test: file format elf32-powerpc-vxworks Sections: Idx Name Size VMA LMA File off Algn 0 initial_isv 00000018 00000000 00000000 00000034 2**2 CONTENTS, RELOC, READONLY [....] RELOCATION RECORDS FOR [initial_isv]: OFFSET TYPE VALUE 00000004 R_PPC_ADDR32 isr__dummy 00000008 R_PPC_ADDR32 isr__dummy 0000000c R_PPC_ADDR32 isr__dummy 00000010 R_PPC_ADDR32 isr__dummy [...] Disassembly of section initial_isv: 00000000 : 0: 12 34 56 78 .long 0x12345678 00000004 : ... 00000014 : 14: 12 34 43 21 vmhraddshs v17,v20,v8,v12 I don't know whether this achieves what you are after, but it looks pretty hopeful. You've built binutils for your target (you said "my own binutils" or something like that - if they really are yours rather than GNU, (a) hats off, (b) I'm barking up the wrong tree and will shut up) so I would expect --section_start to work the same.