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.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: anon@att.net Newsgroups: comp.lang.ada Subject: Re: GLIBC_2.14 memcpy Date: Thu, 24 Apr 2014 09:56:15 +0000 (UTC) Organization: Aioe.org NNTP Server Message-ID: References: Reply-To: anon@att.net NNTP-Posting-Host: e53PIZ+2CTU6Cc2ebtn/zA.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 Xref: news.eternal-september.org comp.lang.ada:19563 Date: 2014-04-24T09:56:15+00:00 List-Id: A simple System.Memory_Copy package Compile the following package in a local directory using gnat compile -a s-memcop.adb then compile your program gnat make hello -largs s-memcop.o "-largs s-memcop.o" causes the linker to use the new version instead of the standard library version. Note: The "-largs" must be lower case. -- File: s-memcop.ads package System.Memory_Copy is pragma Preelaborate ; type Memory_Range is mod Memory_Size ; procedure Memcpy ( Target_Address : in Address ; Source_Address : in Address ; Count : in Memory_Range ) ; pragma Export ( C, Memcpy, "memcpy" ) ; end System.Memory_Copy ; -- File: s-memcop.adb pragma Style_Checks (OFF); -- removes warning about souce -- code format pragma Suppress ( All_Checks ) ; -- removes all run-time checks -- for this low-level package with Interfaces ; package body System.Memory_Copy is procedure Memcpy ( Target_Address : in Address ; Source_Address : in Address ; Count : in Memory_Range ) is use Interfaces ; type Storage_Array is array ( 0 .. Count ) of Unsigned_8 ; Target : Storage_Array ; for Target ' Address use Target_Address ; Source : Storage_Array ; for Source ' Address use Source_Address ; begin -- Memcpy for Index in 0 .. Count loop Target ( Index ) := Source ( Index ) ; end loop ; end Memcpy ; end System.Memory_Copy ; In , Ian Douglas writes: >hi All > >On Wednesday, 23 April 2014 09:53:00 UTC+2, an...@att.net wrote: >> Why not use the HI-E (high integrity version) of "System-Memory_Copy" >> >> package which routines can be written Ada. Instead of using 'libC' >> >> gnat compile s-memcop >> >> then add "-largs s-memcop.o" at the end of gnat command line >> >> gnat make hello.adb -largs s-memcop.o > >Thanks for the suggestion. Results below. > >~/1web/adatest1 $ gnat compile s-memcop >gcc -gnatpg -c -I./ -I- /usr/gnat/lib/gcc/x86_64-pc-linux-gnu/4.7.4/adainclude/s-memcop.ads >~/1web/adatest1 $ ll >total 564 >-rwxr-xr-x 1 ian ian 547443 Apr 21 22:20 Hello1 >-rw-r--r-- 1 ian ian 172 Apr 21 22:18 Hello1.adb >-rw-r--r-- 1 ian ian 1574 Apr 22 14:25 Hello1.ali >-rw-r--r-- 1 ian ian 1824 Apr 22 14:25 Hello1.o >-rw-r--r-- 1 ian ian 695 Apr 22 14:25 hello.gpr >-rw-r--r-- 1 ian ian 783 Apr 23 20:32 s-memcop.ali >-rw-r--r-- 1 ian ian 1004 Apr 23 20:32 s-memcop.o >~/1web/adatest1 $ gnat make Hello1.adb -largs s-memcop.o >gnatbind -x Hello1.ali >gnatlink Hello1.ali s-memcop.o >~/1web/adatest1 $ ll >total 564 >-rwxr-xr-x 1 ian ian 547654 Apr 23 20:32 Hello1 >-rw-r--r-- 1 ian ian 172 Apr 21 22:18 Hello1.adb >-rw-r--r-- 1 ian ian 1574 Apr 22 14:25 Hello1.ali >-rw-r--r-- 1 ian ian 1824 Apr 22 14:25 Hello1.o >-rw-r--r-- 1 ian ian 695 Apr 22 14:25 hello.gpr >-rw-r--r-- 1 ian ian 783 Apr 23 20:32 s-memcop.ali >-rw-r--r-- 1 ian ian 1004 Apr 23 20:32 s-memcop.o >~/1web/adatest1 $ ./Hello1 >Hello, cruel world! > >I am an Ada program with package use. > >=============== > >Upload to server, SSH in and make executable. > >[root@xaxint web]# ll >total 560 >-rw-r--r-- 1 web1 client1 547654 Apr 23 20:33 Hello1 >-rwxr-xr-- 1 web1 client1 7358 Apr 15 15:28 favicon.ico >-rwxr-xr-- 1 web1 client1 1861 Apr 15 15:28 index.html >-rwxr-xr-- 1 web1 client1 14 Apr 15 15:28 robots.txt >drwxr-xr-x 2 root root 4096 Apr 17 00:30 stats >[root@xaxint web]# chmod 744 Hello1 >[root@xaxint web]# ./Hello1 >../Hello1: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by ./Hello1) >[root@xaxint web]# > >============================= > >So end up with same issue.... > >thanks, Ian >