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=-0.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, PLING_QUERY,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,345cecbee95ca646 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.68.234.202 with SMTP id ug10mr4199054pbc.6.1363388256398; Fri, 15 Mar 2013 15:57:36 -0700 (PDT) MIME-Version: 1.0 Path: q9ni18699pba.1!nntp.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border5.newsrouter.astraweb.com!news.astraweb.com!border3.a.newsrouter.astraweb.com!newsfeed10.multikabel.net!multikabel.net!newsfeed20.multikabel.net!news.mi.ras.ru!goblin1!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: anon@att.net Newsgroups: comp.lang.ada Subject: Re: Bootstrapping a null procedure. Seriously?! Date: Wed, 13 Mar 2013 04:34:16 +0000 (UTC) Organization: Aioe.org NNTP Server Message-ID: References: <19d330ec-9b61-414e-abc3-e25a8c786b81@googlegroups.com> Reply-To: anon@att.net NNTP-Posting-Host: p4kVOII04OYXbACsefV9eg.user.speranza.aioe.org X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 X-Newsreader: IBM NewsReader/2 2.0 X-Received-Bytes: 3861 Date: 2013-03-13T04:34:16+00:00 List-Id: To compile a barebone Ada program you must not use "gnatmake" or "gnat make" because it auto execute the Ada binder "gnatbind" and the "gnat linker". Gnat's binder and linker can not be used because they creates an os bound program. And they also adds a number of simple routines that may not be required for your program. Any and all subunits and libraries that requires elaboration must be done manually first, within the main program. Normally this job is handled by the Gnat binder. The elaboration code can be in cased within a procedure or function that is called by the main program. Also, you can not use the standard "raise" statement or the standard exception handlers. For exceptions to work, Gnat compiler requires a number of System packages be load as well as "Ada.Exceptions". # -- # -- Makefile # -- gnat compile testnulmain.adb # # use -nostdinclib to remove most of gcc standard libraries # but os startup code is included from "libc". # additional libraries files, if included must be added to # the command line. # # To reduce code to the basic user created only code use the # -T command. The file defines ".text", ".data", # ".rodata", and ".bss" setions and then discard all other # sections. # # Note: use -o testnulmain.exe for all microsoft based os(s) # gcc only support ".com" files with the -T option # gcc -nostdinclib -o testnulmain testnulmain.o -- -- testnulmain.ads -- procedure testnulmain ; -- -- Required by linker -- pragma Export ( Ada, testnulmain, "main" ) ; -- -- testnulmain.adb -- -- Can include "Stand-Alone" Ada packages, like Ada.Characters, -- Ada.Interfaces, or System. Actually any Ada library that -- does not require direct or indirect OS linking can be used. -- with System ; procedure TestNulMain is -- -- In this example System.o is not needed to link file -- TestVar : System.Address := System.Null_Address ; begin -- preform elaboration here first null ; end TestNulMain ; In <19d330ec-9b61-414e-abc3-e25a8c786b81@googlegroups.com>, Diogenes writes: >I've been doing some binder experiments with this little gem.... > >procedure nullmain is > >begin > > null; > >end nullmain; > > >Been doing it to see just how many packages from the runtime have to be lin= >ked in order for the the thing to DO NOTHING! > >40 packages are pulled in. > >By most measures of good software design, this is WRONG. > >So here's the question... > >Do I need to have different a-finali.ads/.adb packages and the correspondin= >g crt1.o implementations for every possible variation on the runtime I coul= >d ever want? I mean, seriously, it's pulling in system.string_opts; does an= >yone see strings in the above code? > >Of course I realize this is partly due to package dependency issues, howeve= >r I SHOULD be able to write my own a-finali.ads that does nothing but make = >a _start symbol for the system linker, right? > >Tips? >