comp.lang.ada
 help / color / mirror / Atom feed
* Building GNAT
@ 2010-05-03 15:04 Tom
  2010-05-03 17:03 ` Simon Wright
  0 siblings, 1 reply; 8+ messages in thread
From: Tom @ 2010-05-03 15:04 UTC (permalink / raw)


Is this an appropriate forum for discussing GNAT build problems?  I am
attempting to build a GNAT cross compiler targeting bare metal PowerPC
platforms.  After successfully getting past binutils, the first pass
of GCC, and Newlib, I'm getting stuck on the final pass of GCC and
GNAT.  When linking gnatmake, the linker is throwing a bunch of
undefined references from osint.adb  (such as
__gnat_is_writable_file_attr).  See log below.

Many of the challenges I've had to this point have been around this
use of <derint.h> and sockets, neither of which are needed on my
target platform.  Is there any way to configure GNAT not to build all
this OS related stuff?

Recent discussions I've have with some of the issues encountered so
far:

http://comments.gmane.org/gmane.comp.lib.newlib/6132
http://comments.gmane.org/gmane.comp.gcc.help/32672

Thanks for any help!

-Tom


gcc -c -I./ -I/usr/lib/gcc/i486-linux-gnu/4.4.3/adalib/../adainclude -
I/usr/lib/gcc/i486-linux-gnu/4.4.3/adalib/ -I. -I/home/e0082888/build-
powerpc-eabi/gcc-4.5.0/gcc/ada -g -O2 -W -Wall -Wwrite-strings -
Wstrict-prototypes -Wmissing-prototypes -gnatpg -gnata -I- /home/
e0082888/build-powerpc-eabi/gcc-4.5.0/gcc/ada/prj-strt.adb
gnatbind -I/usr/lib/gcc/i486-linux-gnu/4.4.3/adalib/../adainclude -I/
usr/lib/gcc/i486-linux-gnu/4.4.3/adalib/ -I. -I/home/e0082888/build-
powerpc-eabi/gcc-4.5.0/gcc/ada -static -x gnatmake
gnatlink -v gnatmake -o ../../gnatmake \
		--GCC="gcc -static-libgcc -I/usr/lib/gcc/i486-linux-gnu/4.4.3/
adalib/../adainclude -I/usr/lib/gcc/i486-linux-gnu/4.4.3/adalib/ -I. -
I/home/e0082888/build-powerpc-eabi/gcc-4.5.0/gcc/ada" ../../
prefix.o ../../version.o targext.o link.o  ../../../libiberty/
libiberty.a

GNATLINK 4.4.3
Copyright (C) 1995-2008, Free Software Foundation, Inc.
gcc -c -gnatA -gnatWb -gnatiw -static-libgcc -I/usr/lib/gcc/i486-linux-
gnu/4.4.3/adalib/../adainclude -I/usr/lib/gcc/i486-linux-gnu/4.4.3/
adalib/ -I. -I/home/e0082888/build-powerpc-eabi/gcc-4.5.0/gcc/ada -
gnatws /home/e0082888/build-powerpc-eabi/build-gcc/gcc/ada/tools/
b~gnatmake.adb
/usr/bin/gcc b~gnatmake.o ../../prefix.o ../../version.o targext.o
link.o ./alloc.o ./debug.o ./gnatvsn.o ./gnatmake.o ./rident.o ./
sfn_scan.o ./types.o ./hostparm.o ./krunch.o ./csets.o ./output.o ./
stylesw.o ./tree_io.o ./stand.o ./opt.o ./table.o ./stringt.o ./
binderr.o ./fname.o ./fname-sf.o ./fmap.o ./ali.o ./switch.o ./
sdefault.o ./sinput-c.o ./snames.o ./targparm.o ./osint.o ./butil.o ./
tempdir.o ./uintp.o ./err_vars.o ./erroutc.o ./urealp.o ./scans.o ./
mlib-utl.o ./mlib-fil.o ./mlib-tgt-specific.o ./prj-attr-pm.o ./prj-
com.o ./prj-attr.o ./mlib-tgt.o ./mlib.o ./prj-env.o ./prj-ext.o ./prj-
pp.o ./prj-util.o ./makeutl.o ./atree.o ./sinfo.o ./einfo.o ./
uname.o ./lib.o ./styleg.o ./nlists.o ./mlib-prj.o ./switch-m.o ./
usage.o ./makeusg.o ./widechar.o ./sinput.o ./fname-uf.o ./namet.o ./
osint-m.o ./scng.o ./casing.o ./ali-util.o ./errutil.o ./make.o ./prj-
err.o ./sinput-p.o ./prj-strt.o ./prj-proc.o ./prj-part.o ./prj-
pars.o ./prj-dect.o ./prj-conf.o ./prj-tree.o ./prj-nmsc.o ./prj.o -
o ../../gnatmake ../../../libiberty/libiberty.a -L./ -L/usr/lib/gcc/
i486-linux-gnu/4.4.3/adalib/../adainclude/ -L/usr/lib/gcc/i486-linux-
gnu/4.4.3/adalib/ -L./ -L/home/e0082888/build-powerpc-eabi/gcc-4.5.0/
gcc/ada/ -L/usr/lib/gcc/i486-linux-gnu/4.4.3/adalib/ /usr/lib/gcc/i486-
linux-gnu/4.4.3/adalib/libgnat.a -static-libgcc -static-libgcc -I/usr/
lib/gcc/i486-linux-gnu/4.4.3/adalib/../adainclude -I/usr/lib/gcc/i486-
linux-gnu/4.4.3/adalib/ -I. -I/home/e0082888/build-powerpc-eabi/
gcc-4.5.0/gcc/ada
./osint.o: In function `osint__is_writable_file':
/home/e0082888/build-powerpc-eabi/gcc-4.5.0/gcc/ada/osint.adb:1767:
undefined reference to `__gnat_is_writable_file_attr'
./osint.o: In function `osint__is_symbolic_link':
/home/e0082888/build-powerpc-eabi/gcc-4.5.0/gcc/ada/osint.adb:1754:
undefined reference to `__gnat_is_symbolic_link_attr'
./osint.o: In function `osint__is_regular_file':
/home/e0082888/build-powerpc-eabi/gcc-4.5.0/gcc/ada/osint.adb:1741:
undefined reference to `__gnat_is_regular_file_attr'
/home/e0082888/build-powerpc-eabi/gcc-4.5.0/gcc/ada/osint.adb:1741:
undefined reference to `__gnat_is_regular_file_attr'



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Building GNAT
  2010-05-03 15:04 Building GNAT Tom
@ 2010-05-03 17:03 ` Simon Wright
  2010-05-04  5:03   ` Using GNAT in a C and assembly toolchain Tom
  0 siblings, 1 reply; 8+ messages in thread
From: Simon Wright @ 2010-05-03 17:03 UTC (permalink / raw)


I think your problem may be that your host compiler is an older version
(4.4.3) than the source tree you're using to build the cross compiler
(4.5.0). The recommendation is to build the host compiler first, then
use that to build the cross.

The symbols you're missing are (in 4.5.0 but not in 4.3.4, the only
handy version I have for comparison) defined in adaint.c, and it looks
as though adaint.o is being picked up from the pre-built host libraries
(not surprising, the cross-compiler has to run on the host so needs to
use host file attributes etc).



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Using GNAT in a C and assembly toolchain
  2010-05-03 17:03 ` Simon Wright
@ 2010-05-04  5:03   ` Tom
  2010-05-04 19:50     ` Simon Wright
  0 siblings, 1 reply; 8+ messages in thread
From: Tom @ 2010-05-04  5:03 UTC (permalink / raw)


On May 3, 12:03 pm, Simon Wright <si...@pushface.org> wrote:
> I think your problem may be that your host compiler is an older version
> (4.4.3) than the source tree you're using to build the cross compiler
> (4.5.0). The recommendation is to build the host compiler first, then
> use that to build the cross.
>
> The symbols you're missing are (in 4.5.0 but not in 4.3.4, the only
> handy version I have for comparison) defined in adaint.c, and it looks
> as though adaint.o is being picked up from the pre-built host libraries
> (not surprising, the cross-compiler has to run on the host so needs to
> use host file attributes etc).

Thanks Simon.  That did the trick.  I now have a functioning Ada cross
compiler; I just need to learn how to use it.  I could use a few
pointers to get me started...

On our particular application -- an automotive ECU -- we're locked
into a proprietary C-based flow.  The operating system and hardware
abstraction layer come precompiled and the application code must be
compiled and linked with the established tool chain (GHS C, not Ada).
The application programmer defines a procedure, which is invoked by
the OS as a periodic rate.  This procedure references global C
variables to access the hardware abstraction layer.

The question is how can I best use Ada and GNAT in such an
environment?  One method that comes to mind is to compile Ada to
assembly code, which is then passed to GHS for assembling and linking
with the closed source OS and HAL.  I don't see an assembly switch,
like GCC's -S.  Would this mean I would need the compile Ada modules
individually with GCC instead of using gnatmake?  Are there any
options to compile Ada down to C by chance?

And how does gnatbind fit into this picture?  It appears to create
initialization code.  Would I just need to insert this code such that
it is invoked at power up?

-Tom



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Using GNAT in a C and assembly toolchain
  2010-05-04  5:03   ` Using GNAT in a C and assembly toolchain Tom
@ 2010-05-04 19:50     ` Simon Wright
  2010-05-04 22:04       ` Randy Brukardt
                         ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Simon Wright @ 2010-05-04 19:50 UTC (permalink / raw)


Tom <tomahawkins@gmail.com> writes:

> On our particular application -- an automotive ECU -- we're locked
> into a proprietary C-based flow.  The operating system and hardware
> abstraction layer come precompiled and the application code must be
> compiled and linked with the established tool chain (GHS C, not Ada).
> The application programmer defines a procedure, which is invoked by
> the OS as a periodic rate.  This procedure references global C
> variables to access the hardware abstraction layer.

I would have expected engine control software to require a pretty high
degree of certification, if not for safety-related reasons then because
fixing problems in deployed firmware is going to be expensive and
possibly embarrassing, see Toyota, and part of that involves the tool
chain. OK, I work on military systems, but my Software Design Authority
would need A Whole Lot Of Convincing to change the tool chain in a way
not supported by the tool vendor.

> The question is how can I best use Ada and GNAT in such an
> environment?  One method that comes to mind is to compile Ada to
> assembly code, which is then passed to GHS for assembling and linking
> with the closed source OS and HAL.  I don't see an assembly switch,
> like GCC's -S.  Would this mean I would need the compile Ada modules
> individually with GCC instead of using gnatmake?  Are there any
> options to compile Ada down to C by chance?

"gnatmake -c -S foo.adb" compiles the closure of foo to assembler (.s)
files. Of course these are going to be in GNU assembler, which may or
may not be that used by GHS.

There is a tool created by Sofcheck called AdaMagic which generates
C. GCC does not. (I'm not sure that Sofcheck is still in business? there
was a discussion here recently).

> And how does gnatbind fit into this picture?  It appears to create
> initialization code.  Would I just need to insert this code such that
> it is invoked at power up?

I think you'd call gnatbind with -C (to generate C binder code rather
than Ada) and -n (no Ada main program).

The generated code includes an adainit() to be called to initialize the
Ada runtime and an adafinal() to finalize it (not that I've ever had to
call adafinal()).



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Using GNAT in a C and assembly toolchain
  2010-05-04 19:50     ` Simon Wright
@ 2010-05-04 22:04       ` Randy Brukardt
  2010-05-05  2:10       ` Robert A Duff
  2010-05-05  5:52       ` Tom
  2 siblings, 0 replies; 8+ messages in thread
From: Randy Brukardt @ 2010-05-04 22:04 UTC (permalink / raw)


"Simon Wright" <simon@pushface.org> wrote in message 
news:m2sk67jvjw.fsf@pushface.org...
> Tom <tomahawkins@gmail.com> writes:
...
> There is a tool created by Sofcheck called AdaMagic which generates
> C. GCC does not. (I'm not sure that Sofcheck is still in business? there
> was a discussion here recently).

Sofcheck still exists (www.sofcheck.com); they're behind the new AdaCore 
CodePeer tool.

                      Randy.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Using GNAT in a C and assembly toolchain
  2010-05-04 19:50     ` Simon Wright
  2010-05-04 22:04       ` Randy Brukardt
@ 2010-05-05  2:10       ` Robert A Duff
  2010-05-05  7:54         ` sjw
  2010-05-05  5:52       ` Tom
  2 siblings, 1 reply; 8+ messages in thread
From: Robert A Duff @ 2010-05-05  2:10 UTC (permalink / raw)


Simon Wright <simon@pushface.org> writes:

> I'm not sure that Sofcheck is still in business?

SofCheck is certainly still in business.

- Bob



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Using GNAT in a C and assembly toolchain
  2010-05-04 19:50     ` Simon Wright
  2010-05-04 22:04       ` Randy Brukardt
  2010-05-05  2:10       ` Robert A Duff
@ 2010-05-05  5:52       ` Tom
  2 siblings, 0 replies; 8+ messages in thread
From: Tom @ 2010-05-05  5:52 UTC (permalink / raw)


On May 4, 2:50 pm, Simon Wright <si...@pushface.org> wrote:

> OK, I work on military systems, but my Software Design Authority
> would need A Whole Lot Of Convincing to change the tool chain in a way
> not supported by the tool vendor.

This is strictly prototyping.

>
> > The question is how can I best use Ada and GNAT in such an
> > environment?  One method that comes to mind is to compile Ada to
> > assembly code, which is then passed to GHS for assembling and linking
> > with the closed source OS and HAL.  I don't see an assembly switch,
> > like GCC's -S.  Would this mean I would need the compile Ada modules
> > individually with GCC instead of using gnatmake?  Are there any
> > options to compile Ada down to C by chance?
>
> "gnatmake -c -S foo.adb" compiles the closure of foo to assembler (.s)
> files. Of course these are going to be in GNU assembler, which may or
> may not be that used by GHS.

This will work.  And GHS does indeed read GNU assembly, with minor
post processing.

BTW, I've moved the scripts and patch files used to build the powerpc-
eabi cross compiler to github if anyone's interested:

http://github.com/tomahawkins/powerpc-eabi



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Using GNAT in a C and assembly toolchain
  2010-05-05  2:10       ` Robert A Duff
@ 2010-05-05  7:54         ` sjw
  0 siblings, 0 replies; 8+ messages in thread
From: sjw @ 2010-05-05  7:54 UTC (permalink / raw)


On May 5, 3:10 am, Robert A Duff <bobd...@shell01.TheWorld.com> wrote:
> Simon Wright <si...@pushface.org> writes:
> > I'm not sure that Sofcheck is still in business?
>
> SofCheck is certainly still in business.
>
> - Bob

Thanks for that, Bob, Randy: my apologies to Sofcheck.



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-05-05  7:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-03 15:04 Building GNAT Tom
2010-05-03 17:03 ` Simon Wright
2010-05-04  5:03   ` Using GNAT in a C and assembly toolchain Tom
2010-05-04 19:50     ` Simon Wright
2010-05-04 22:04       ` Randy Brukardt
2010-05-05  2:10       ` Robert A Duff
2010-05-05  7:54         ` sjw
2010-05-05  5:52       ` Tom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox