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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.13.225.66 with SMTP id k63mr10945908ywe.191.1504463035679; Sun, 03 Sep 2017 11:23:55 -0700 (PDT) X-Received: by 10.36.77.65 with SMTP id l62mr124340itb.14.1504463035637; Sun, 03 Sep 2017 11:23:55 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.am4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!u11no1559407qtu.1!news-out.google.com!c139ni1307itb.0!nntp.google.com!127no748949itw.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 3 Sep 2017 11:23:55 -0700 (PDT) In-Reply-To: <712651ae-2403-4d61-ab8e-f696c9352dc9@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=76.218.37.33; posting-account=W2gdXQoAAADxIuhBWhPFjUps3wUp4RhQ NNTP-Posting-Host: 76.218.37.33 References: <6d6e96b3-b881-43d7-a5cc-5c131ac97c03@googlegroups.com> <712651ae-2403-4d61-ab8e-f696c9352dc9@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <76eec2b1-22e9-4e44-a560-54f4fe715b0d@googlegroups.com> Subject: Re: link errors with GNAT GPL 2016 and gprof From: Stephen Leake Injection-Date: Sun, 03 Sep 2017 18:23:55 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Body-CRC: 546463888 X-Received-Bytes: 3574 Xref: news.eternal-september.org comp.lang.ada:47919 Date: 2017-09-03T11:23:55-07:00 List-Id: On Sunday, September 3, 2017 at 11:01:12 AM UTC-5, Anh Vo wrote: > On Saturday, September 2, 2017 at 3:02:48 PM UTC-7, Stephen Leake wrote: > > I'm trying to Do The Right Thing and profile my code before I start messing with it to make it faster. But GNAT is _not_ cooperating! > > > > According to the gnat user guide, to use gprof, we compile as: > > > > gnatmake -f -pg -P > > > > That fails with GNAT GPL 2016: > > > > gprbuild: illegal option "-pg" on the command line > > > > So I added "-pg" in the Builder package in the project file: > > > > package Builder is > > case Profile is > > when "Full" => > > for Default_Switches ("Ada") use ("-f", "-pg"); > > > > when "On" => > > for Default_Switches ("Ada") use ("-pg"); > > > > when "Off" => > > null; > > end case; > > > > end Builder; > > > > That gives -pg options on each 'gcc' command, but fails at link time: > > > > gcc run_ada_lite_parser.o -o run_ada_lite_parser.exe > > run_ada_lite_parser.o: In function `ada_run_ada_lite_parser': > > C:/Projects/org.wisitoken.stephe-1/wisi/test/run_ada_lite_parser.adb:12: undefined reference to `mcount' > > > > I noticed there is no '-pg' on the 'gcc' link command line, so I added it to the Linker package: > > > > package Linker is > > case Profile is > > when "Full" | "On" => > > for Default_Switches ("Ada") use ("-pg"); > > > > when "Off" => > > null; > > end case; > > > > end Linker; > > > > That did not help. Also tried adding it to the Binder package; no help there either. > > > > How do I tell gprbuild to specify "-pg" for linking? > > > > The gnat user guide has always been unhelpful about mapping command line options to project file packages. > > > > -- Stephe > > In order to pass switches to the linker thru gnatmake, use -largs opts according to gnatmake --help shown. Could you try this? > > Anh Vo As I said, gnatmake does not work with GNAT GPL 2016; it calls gprbuild. But gprbuild does support the -largs option ... and that works. Thanks for that. I'd still like to know how to put it in the project file, sigh. -- Stephe