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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.135.15 with SMTP id j15mr2451527iod.28.1442477628052; Thu, 17 Sep 2015 01:13:48 -0700 (PDT) X-Received: by 10.182.49.225 with SMTP id x1mr141221obn.16.1442477628032; Thu, 17 Sep 2015 01:13:48 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!kq10no5467328igb.0!news-out.google.com!n2ni3541igy.0!nntp.google.com!kq10no3983248igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 17 Sep 2015 01:13:47 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=89.255.88.101; posting-account=0EXciQoAAABnszktho592qzTsx_OoajA NNTP-Posting-Host: 89.255.88.101 References: <0dd03a38-391b-45bc-859c-4ed2c42452e3@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Can I get rid of C libraries dependencies? From: Leff Ivanov Injection-Date: Thu, 17 Sep 2015 08:13:48 +0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:27782 Date: 2015-09-17T01:13:47-07:00 List-Id: =D1=81=D1=80=D0=B5=D0=B4=D0=B0, 16 =D1=81=D0=B5=D0=BD=D1=82=D1=8F=D0=B1=D1= =80=D1=8F 2015 =D0=B3., 19:13:11 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE= =D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Simon Wright =D0=BD=D0=B0=D0=BF=D0=B8= =D1=81=D0=B0=D0=BB: > Leff Ivanov writes: >=20 > > What I want to achive is a tiny 2kb binary executable=20 >=20 > Can you tell us a little more about why you need to do this, what OS > you're using ... I'm using windows and want to write tiny tools in Ada like I can=20 write one in C/C++ using -nostdlib flag and directly linking to OS specific libraries. The same can be applied to Linux and Mac OSX as well, but currently I'm focusing on Windows. If I do "gnatmake -a -f -nostdlib main.adb" I can see that GNAT actually recompiles a lot of stuff from RTS, like a-except.adb, s-secsta.abd and etc. So the No_Run_Time pragma cuts off only a part of Ada RTS, but leaves the rest. Gnatlink tool with -nostdlib returns a lot of undefined references to C code, which I want to get rid off. It seems that mostly it is functions that implements exceptions, like _Unwind_SjLj_Register, __gnat_personality_sj0 and etc.=20 Undefined references to stuff like memmove and memcmp I can simply fix by linking directly with libmsvcrt.a, so theese functions would be taked from standard windows msvcrt.dll library. But there's also=20 undefined reference to __chkstk_ms, this function seem to check if=20 the stack is full. This function is MinGW specific and there is no implemen= tation in standard windows libraries.