mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-23 15:32:25 +00:00
ada: runtime and library support
The Ada runtime can now be set with the ADA_RTS variable. The ada library builds a (currently) minimal runtime from the gcc sources that come with Genode (to stay consistent with the used compiler) and sets the runtime path accordingly. It is build as a shared library ada.lib.so which needs to be added to the build files. I split the existing Ada test into program and library, and moved it to libports as it depends on the runtime library residing in this repository too. Fixes #2748
This commit is contained in:
parent
cb78516bf1
commit
1261c18ce9
@ -7,7 +7,7 @@
|
||||
# Collect object files and avoid duplicates (by using 'sort')
|
||||
#
|
||||
SRC_O += $(addprefix binary_,$(addsuffix .o,$(notdir $(SRC_BIN))))
|
||||
SRC = $(sort $(SRC_C) $(SRC_CC) $(SRC_ADA) $(SRC_RS) $(SRC_S) $(SRC_O))
|
||||
SRC = $(sort $(SRC_C) $(SRC_CC) $(SRC_ADB) $(SRC_ADS) $(SRC_RS) $(SRC_S) $(SRC_O))
|
||||
OBJECTS = $(addsuffix .o,$(basename $(SRC)))
|
||||
|
||||
#
|
||||
@ -72,7 +72,11 @@ endif
|
||||
#
|
||||
%.o: %.adb
|
||||
$(MSG_COMP)$@
|
||||
$(VERBOSE)$(GNATMAKE) -q -c --GCC=$(CC) --RTS=$(PRG_DIR) $< -cargs $(CC_ADA_OPT) $(INCLUDES)
|
||||
$(VERBOSE)$(GNATMAKE) -q -c --GCC=$(CC) --RTS=$(ADA_RTS) $< -cargs $(CC_ADA_OPT) $(INCLUDES)
|
||||
|
||||
%.ali %.o: %.ads
|
||||
$(MSG_COMP)$@
|
||||
$(VERBOSE)$(CC) -c -gnatg -gnatp -gnatpg -gnatn2 -I- -I$(ADA_RTS_SOURCE) $(CC_ADA_OPT) $<
|
||||
|
||||
#
|
||||
# Compiling Rust sources
|
||||
|
@ -1,13 +0,0 @@
|
||||
This directory contains a test for using freestanding Ada code with Genode.
|
||||
|
||||
The program relies on the normal startup procedure of a Genode process.
|
||||
Execution starts at the 'crt0' assembly entry provided by the startup library.
|
||||
The 'crt0' code sets up the stack of the main thread and calls the '_main'
|
||||
function implemented in the C++ portion of Genode's startup library. In turn,
|
||||
the '_main' function calls 'main' of the actual program. The main function of
|
||||
this example calls the Ada main procedure. The test further exercises the call
|
||||
of C functions from Ada code. So the integration of Ada and C code is almost
|
||||
seamless.
|
||||
|
||||
Please note that the current version of this program does not use 'gnatbind'.
|
||||
Therefore, package elaboration is not executed.
|
@ -1,2 +0,0 @@
|
||||
Package System is
|
||||
end System;
|
@ -1,4 +0,0 @@
|
||||
TARGET = test-ada
|
||||
SRC_ADA = main.adb add_package.adb
|
||||
SRC_CC = add.cc startup.cc
|
||||
LIBS = base
|
1
repos/libports/lib/import/import-ada.mk
Normal file
1
repos/libports/lib/import/import-ada.mk
Normal file
@ -0,0 +1 @@
|
||||
ADA_RTS = $(BUILD_BASE_DIR)/var/libcache/ada
|
1
repos/libports/lib/import/import-test-ada.mk
Normal file
1
repos/libports/lib/import/import-test-ada.mk
Normal file
@ -0,0 +1 @@
|
||||
INC_DIR += $(REP_DIR)/src/test/ada/lib
|
22
repos/libports/lib/mk/ada.mk
Normal file
22
repos/libports/lib/mk/ada.mk
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
include $(REP_DIR)/lib/import/import-ada.mk
|
||||
ADALIB = $(ADA_RTS)/adalib
|
||||
ADAINCLUDE = $(ADA_RTS)/adainclude
|
||||
|
||||
PACKAGES = system
|
||||
|
||||
ADA_RTS_SOURCE = $(call select_from_ports,gcc)/src/noux-pkg/gcc/gcc/ada
|
||||
SRC_ADS += $(foreach package, $(PACKAGES), $(package).ads)
|
||||
|
||||
vpath %.ads $(ADA_RTS_SOURCE)
|
||||
|
||||
SHARED_LIB = yes
|
||||
|
||||
all: ada_source_path ada_object_path
|
||||
|
||||
ada_source_path: ada_object_path
|
||||
$(VERBOSE)$(shell echo $(CONTRIB_DIR)/gcc-$(shell echo $(call _hash_of_port,gcc) | cut -d" " -f1)/src/noux-pkg/gcc/gcc/ada > $(ADA_RTS)/ada_source_path)
|
||||
|
||||
ada_object_path:
|
||||
$(VERBOSE)$(shell mkdir -p $(ADA_RTS))
|
||||
$(VERBOSE)$(shell echo $(ADA_RTS) > $(ADA_RTS)/ada_object_path)
|
6
repos/libports/lib/mk/test-ada.mk
Normal file
6
repos/libports/lib/mk/test-ada.mk
Normal file
@ -0,0 +1,6 @@
|
||||
LIBS += base ada
|
||||
SRC_ADB += add_package.adb
|
||||
|
||||
include $(REP_DIR)/lib/import/import-test-ada.mk
|
||||
|
||||
vpath %.adb $(REP_DIR)/src/test/ada/lib
|
@ -20,7 +20,7 @@ install_config {
|
||||
</config>
|
||||
}
|
||||
|
||||
build_boot_image "core ld.lib.so init test-ada"
|
||||
build_boot_image "core ld.lib.so ada.lib.so init test-ada"
|
||||
|
||||
append qemu_args "-nographic "
|
||||
|
13
repos/libports/src/test/ada/README
Normal file
13
repos/libports/src/test/ada/README
Normal file
@ -0,0 +1,13 @@
|
||||
This directory contains an example Ada program on Genode.
|
||||
|
||||
An Ada program relies on the normal startup procedure of Genode
|
||||
components, which calls 'Component::construct()' in _startup.cc_. It
|
||||
enters the Ada code by calling the Ada main procedure '_ada_main()'
|
||||
from 'Component::construct()'. Additionally, the test exercises calls
|
||||
of C functions from Ada code to demonstrate the almost seamless
|
||||
integration of Ada and C code and illustrates the implementation of
|
||||
Ada libraries in Genode. Ada programs require the _ada_ library as it
|
||||
provides the needed runtime.
|
||||
|
||||
Please note that the current version of this program does not use
|
||||
'gnatbind'. Therefore, package elaboration is not executed.
|
@ -1,5 +1,5 @@
|
||||
--
|
||||
-- \brief Ada test program that calls a external C functions
|
||||
-- \brief Ada test program
|
||||
-- \author Norman Feske
|
||||
-- \date 2009-09-23
|
||||
--
|
4
repos/libports/src/test/ada/target.mk
Normal file
4
repos/libports/src/test/ada/target.mk
Normal file
@ -0,0 +1,4 @@
|
||||
TARGET = test-ada
|
||||
SRC_ADB = main.adb
|
||||
SRC_CC = print.cc startup.cc
|
||||
LIBS = base ada test-ada
|
Loading…
Reference in New Issue
Block a user