From bfa3bbcf33a43bffb0a2d3287b1de97898a57c02 Mon Sep 17 00:00:00 2001 From: Tamar Christina Date: Wed, 5 Jul 2017 13:00:23 +0100 Subject: [PATCH] Adds the needed build system changes in order to compile and create the new libraries for Semihosting v2. This uses the new recursive build target in multi-build.in For AArch64 no new spec files are needed but the makefiles are modified to keep them in sync with the ARM ones. Signed-off-by: Tamar Christina --- libgloss/aarch64/Makefile.in | 54 +++++++++++++++++------ libgloss/aarch64/elf-aem-validation.specs | 2 +- libgloss/aarch64/elf-aem-ve.specs | 4 +- libgloss/aarch64/elf-rdimon.specs | 5 +++ 4 files changed, 49 insertions(+), 16 deletions(-) diff --git a/libgloss/aarch64/Makefile.in b/libgloss/aarch64/Makefile.in index 3c8a9fd10..546557e3c 100644 --- a/libgloss/aarch64/Makefile.in +++ b/libgloss/aarch64/Makefile.in @@ -52,8 +52,11 @@ MULTISRCTOP = MULTIBUILDTOP = MULTIDIRS = MULTISUBDIR = +MULTILIBNAME = MULTIDO = true MULTICLEAN = true +MULTI_FLAGS_FOR_TARGET = MULTI_DEFAULT_FLAGS +MULTI_DEFAULT_FLAGS = -DSEMIHOST_V2 SHELL = /bin/sh @@ -77,11 +80,12 @@ OBJS = ftruncate.o libcfunc.o syscalls.o truncate.o _exit.o _kill.o CRT0 = crt0.o CRT0_INSTALL = install-crt0 -CRT0_INSTALL = install-crt0 -RDIMON_CRT0 = rdimon-crt0.o -RDIMON_BSP = librdimon.a +RDIMON_CRT0 = rdimon-crt0${${MULTILIBNAME}}.o +RDIMON_BSP = librdimon${${MULTILIBNAME}}.a RDIMON_OBJS = $(patsubst %,rdimon-%,$(OBJS)) -RDIMON_SCRIPTS = rdimon.specs aem-ve.specs aem-validation.specs +RDIMON_SCRIPTS = rdimon${${MULTILIBNAME}}.specs \ + aem-ve${${MULTILIBNAME}}.specs \ + aem-validation${${MULTILIBNAME}}.specs RDIMON_INSTALL = install-rdimon CFLAGS = -g @@ -93,6 +97,7 @@ CFLAGS = -g # build a test program for each target board. Just trying to get # it to link is a good test, so we ignore all the errors for now. # + all: ${CRT0} ${RDIMON_CRT0} ${RDIMON_BSP} ${RDIMON_SCRIPTS} @rootpre=`pwd`/; export rootpre; \ srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \ @@ -103,6 +108,7 @@ all: ${CRT0} ${RDIMON_CRT0} ${RDIMON_BSP} ${RDIMON_SCRIPTS} else true; fi; \ else true; fi; \ done + $(MAKE) $(AM_MAKEFLAGS) all-recursive # # here's where we build the test programs for each target @@ -112,35 +118,53 @@ test: # crt0.o: crt0.S + $(CC) $(CFLAGS_FOR_TARGET) $($(MULTI_FLAGS_FOR_TARGET)) $(CFLAGS) $(INCLUDES) -o $@ -c $< -rdimon-crt0.o: crt0.S - $(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< +rdimon-crt0${${MULTILIBNAME}}.o: crt0.S + $(CC) $(CFLAGS_FOR_TARGET) $($(MULTI_FLAGS_FOR_TARGET)) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< #rdimon-trap.o: trap.S -# $(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< +# $(CC) $(CFLAGS_FOR_TARGET) $($(MULTI_FLAGS_FOR_TARGET)) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< rdimon-_exit.o: _exit.c - $(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< + $(CC) $(CFLAGS_FOR_TARGET) $($(MULTI_FLAGS_FOR_TARGET)) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< rdimon-ftruncate.o: ftruncate.c - $(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< + $(CC) $(CFLAGS_FOR_TARGET) $($(MULTI_FLAGS_FOR_TARGET)) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< rdimon-_kill.o: _kill.c - $(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< + $(CC) $(CFLAGS_FOR_TARGET) $($(MULTI_FLAGS_FOR_TARGET)) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< rdimon-libcfunc.o: libcfunc.c - $(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< + $(CC) $(CFLAGS_FOR_TARGET) $($(MULTI_FLAGS_FOR_TARGET)) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< rdimon-syscalls.o: syscalls.c - $(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< + $(CC) $(CFLAGS_FOR_TARGET) $($(MULTI_FLAGS_FOR_TARGET)) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< rdimon-truncate.o: truncate.c - $(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< + $(CC) $(CFLAGS_FOR_TARGET) $($(MULTI_FLAGS_FOR_TARGET)) $(CFLAGS) $(INCLUDES) -DARM_RDI_MONITOR -o $@ -c $< $(RDIMON_BSP): $(RDIMON_OBJS) ${AR} ${ARFLAGS} $@ $^ ${RANLIB} $@ +# Multilib support. +.PHONY: multi-do all-multi clean-multi install-multi + +all-recursive: all-multi +clean-recursive: clean-multi +install-recursive: install-multi + +# The $(MAKE) comments below are to enable parallel building. +all-multi: + $(MAKE) $(AM_MAKEFLAGS) DO=all multi-do + +clean-multi: + $(MAKE) $(AM_MAKEFLAGS) DO=clean multi-do + +install-multi: + $(MAKE) $(AM_MAKEFLAGS) DO=install multi-do + clean mostlyclean: rm -f a.out core *.i *.o *-test *.srec *.dis *.x $(SIM_BSP) ${RDIMON_SCRIPTS} @rootpre=`pwd`/; export rootpre; \ @@ -152,6 +176,7 @@ clean mostlyclean: else true; fi; \ else true; fi; \ done + $(MAKE) $(AM_MAKEFLAGS) clean-recursive distclean maintainer-clean realclean: clean rm -f Makefile config.status *~ @@ -167,6 +192,7 @@ install: ${CRT0_INSTALL} ${RDIMON_INSTALL} else true; fi; \ else true; fi; \ done + $(MAKE) $(AM_MAKEFLAGS) install-recursive install-crt0: ${INSTALL_DATA} ${CRT0} $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$x @@ -189,3 +215,5 @@ Makefile: Makefile.in config.status @host_makefile_frag_path@ config.status: configure $(SHELL) config.status --recheck + +include $(srcdir)/../multi-build.in \ No newline at end of file diff --git a/libgloss/aarch64/elf-aem-validation.specs b/libgloss/aarch64/elf-aem-validation.specs index ca0c92d58..800791ac1 100644 --- a/libgloss/aarch64/elf-aem-validation.specs +++ b/libgloss/aarch64/elf-aem-validation.specs @@ -1,7 +1,7 @@ # aem-ve.specs # # Spec file for AArch64 baremetal newlib, libgloss on the validation platform -# with AngelAPI semi-hosting. +# with version 2 of AngelAPI semi-hosting. %rename lib libc diff --git a/libgloss/aarch64/elf-aem-ve.specs b/libgloss/aarch64/elf-aem-ve.specs index 671d3c14f..8d86de1be 100644 --- a/libgloss/aarch64/elf-aem-ve.specs +++ b/libgloss/aarch64/elf-aem-ve.specs @@ -1,7 +1,7 @@ # aem-ve.specs # -# Spec file for AArch64 baremetal newlib, libgloss on VE platform with AngelAPI -# semi-hosting. +# Spec file for AArch64 baremetal newlib, libgloss on VE platform with version 2 +# of AngelAPI semi-hosting. # # This Spec file is also appropriate for the foundation model. diff --git a/libgloss/aarch64/elf-rdimon.specs b/libgloss/aarch64/elf-rdimon.specs index cb964db5b..a1d84c2bb 100644 --- a/libgloss/aarch64/elf-rdimon.specs +++ b/libgloss/aarch64/elf-rdimon.specs @@ -1,3 +1,8 @@ +# rdimon.specs +# +# Spec file for AArch64 baremetal newlib with version 2 of the +# AngelAPI semi-hosting. + %rename lib libc *libgloss: