From 917f20be837fde9435e4297f16f2fbb448a0c650 Mon Sep 17 00:00:00 2001 From: Gaius Mulley Date: Mon, 7 Aug 2023 13:07:19 +0200 Subject: [PATCH] Merge modula-2 front end onto gcc. This commit merges the devel/modula2 into master. The libraries reside in libgm2, the compiler in gcc/m2 and the testsuite in gcc/testsuite/gm2. * configure.ac (target_libraries): Add target-libgm2. Add NCN_STRICT_CHECK_TARGET_TOOLS entry for gm2. Add GCC_TARGET_TOOL entry for gm2. (compare_exclusions) add gcc/m2/gm2-compiler/M2Version, gcc/m2/gm2-compiler-boot/SYSTEM and gcc/m2/gm2version. * Makefile.def (target_modules): Add libgm2. (flags_to_pass) Add GM2_FOR_TARGET, GM2FLAGS_FOR_TARGET. (dependencies) Add all-target-libgm2 and on=all-target-libatomic. (languages) Add entry for language=m2 with gcc-check-target=check-m2 and lib-check-target=check-target-libgm2. * Makefile.tpl (BUILD_EXPORTS): Add definition for GM2 and GM2FLAGS. (HOST_EXPORTS) Add definition for GM2. (BASE_TARGET_EXPORTS) Add definition for GM2. (GM2_FOR_BUILD) Defined. (GM2FLAGS) Defined. (GM2_FOR_TARGET) Defined. (GM2FLAGS_FOR_TARGET) Defined. (EXTRA_HOST_FLAGS) Defined. (POSTSTAGE1_FLAGS_TO_PASS) Add GM2 and GM2_FOR_BUILD. (EXTRA_TARGET_FLAGS) Add GM2 and GM2FLAGS. (EXTRA_GCC_FLAGS) Add GM2_FOR_TARGET. Signed-off-by: Gaius Mulley --- Makefile.def | 7 +++++++ Makefile.tpl | 13 +++++++++++++ configure.ac | 17 ++++++++++++++++- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/Makefile.def b/Makefile.def index fc6219a2514..b43fccbaf7a 100644 --- a/Makefile.def +++ b/Makefile.def @@ -191,6 +191,7 @@ target_modules = { module= libffi; no_install=true; target_modules = { module= zlib; }; target_modules = { module= rda; }; target_modules = { module= libada; }; +target_modules = { module= libgm2; lib_path=.libs; }; target_modules = { module= libgomp; bootstrap= true; lib_path=.libs; }; target_modules = { module= libitm; lib_path=.libs; }; target_modules = { module= libatomic; lib_path=.libs; }; @@ -313,6 +314,8 @@ flags_to_pass = { flag= GOC_FOR_TARGET ; }; flags_to_pass = { flag= GOCFLAGS_FOR_TARGET ; }; flags_to_pass = { flag= GDC_FOR_TARGET ; }; flags_to_pass = { flag= GDCFLAGS_FOR_TARGET ; }; +flags_to_pass = { flag= GM2_FOR_TARGET ; }; +flags_to_pass = { flag= GM2FLAGS_FOR_TARGET ; }; flags_to_pass = { flag= LD_FOR_TARGET ; }; flags_to_pass = { flag= LIPO_FOR_TARGET ; }; flags_to_pass = { flag= LDFLAGS_FOR_TARGET ; }; @@ -645,6 +648,8 @@ dependencies = { module=configure-target-libffi; on=all-target-libstdc++-v3; }; dependencies = { module=all-target-libgo; on=all-target-libbacktrace; }; dependencies = { module=all-target-libgo; on=all-target-libffi; }; dependencies = { module=all-target-libgo; on=all-target-libatomic; }; +dependencies = { module=configure-target-libgm2; on=all-target-libstdc++-v3; }; +dependencies = { module=all-target-libgm2; on=all-target-libatomic; }; dependencies = { module=configure-target-libphobos; on=configure-target-libbacktrace; }; dependencies = { module=configure-target-libphobos; on=configure-target-zlib; }; dependencies = { module=all-target-libphobos; on=all-target-libbacktrace; }; @@ -699,6 +704,8 @@ languages = { language=obj-c++; gcc-check-target=check-obj-c++; }; languages = { language=go; gcc-check-target=check-go; lib-check-target=check-target-libgo; lib-check-target=check-gotools; }; +languages = { language=m2; gcc-check-target=check-m2; + lib-check-target=check-target-libgm2; }; languages = { language=d; gcc-check-target=check-d; lib-check-target=check-target-libphobos; }; languages = { language=jit; gcc-check-target=check-jit; }; diff --git a/Makefile.tpl b/Makefile.tpl index 54faca6fbac..82c795e8053 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -166,6 +166,8 @@ BUILD_EXPORTS = \ GOCFLAGS="$(GOCFLAGS_FOR_BUILD)"; export GOCFLAGS; \ GDC="$(GDC_FOR_BUILD)"; export GDC; \ GDCFLAGS="$(GDCFLAGS_FOR_BUILD)"; export GDCFLAGS; \ + GM2="$(GM2_FOR_BUILD)"; export GM2; \ + GM2FLAGS="$(GM2FLAGS_FOR_BUILD)"; export GM2FLAGS; \ DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \ DSYMUTIL="$(DSYMUTIL_FOR_BUILD)"; export DSYMUTIL; \ LD="$(LD_FOR_BUILD)"; export LD; \ @@ -204,6 +206,7 @@ HOST_EXPORTS = \ GFORTRAN="$(GFORTRAN)"; export GFORTRAN; \ GOC="$(GOC)"; export GOC; \ GDC="$(GDC)"; export GDC; \ + GM2="$(GM2)"; export GM2; \ AR="$(AR)"; export AR; \ AS="$(AS)"; export AS; \ CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ @@ -307,6 +310,7 @@ BASE_TARGET_EXPORTS = \ GFORTRAN="$(GFORTRAN_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GFORTRAN; \ GOC="$(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GOC; \ GDC="$(GDC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GDC; \ + GM2="$(GM2_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GM2; \ DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ DSYMUTIL="$(DSYMUTIL_FOR_TARGET)"; export DSYMUTIL; \ LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \ @@ -377,6 +381,7 @@ DSYMUTIL_FOR_BUILD = @DSYMUTIL_FOR_BUILD@ GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@ GOC_FOR_BUILD = @GOC_FOR_BUILD@ GDC_FOR_BUILD = @GDC_FOR_BUILD@ +GM2_FOR_BUILD = @GM2_FOR_BUILD@ LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ LD_FOR_BUILD = @LD_FOR_BUILD@ NM_FOR_BUILD = @NM_FOR_BUILD@ @@ -447,6 +452,7 @@ CXXFLAGS = @CXXFLAGS@ LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates GOCFLAGS = $(CFLAGS) GDCFLAGS = $(CFLAGS) +GM2FLAGS = $(CFLAGS) PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ @@ -579,6 +585,7 @@ RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@ GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ GOC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GOC_FOR_TARGET@ GDC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GDC_FOR_TARGET@ +GM2_FOR_TARGET=$(STAGE_CC_WRAPPER) @GM2_FOR_TARGET@ DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@ DSYMUTIL_FOR_TARGET=@DSYMUTIL_FOR_TARGET@ LD_FOR_TARGET=@LD_FOR_TARGET@ @@ -604,6 +611,7 @@ CXXFLAGS_FOR_TARGET = @CXXFLAGS_FOR_TARGET@ LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET) LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates LDFLAGS_FOR_TARGET = @LDFLAGS_FOR_TARGET@ +GM2FLAGS_FOR_TARGET = -O2 -g GOCFLAGS_FOR_TARGET = -O2 -g GDCFLAGS_FOR_TARGET = -O2 -g @@ -710,6 +718,7 @@ EXTRA_HOST_FLAGS = \ 'GFORTRAN=$(GFORTRAN)' \ 'GOC=$(GOC)' \ 'GDC=$(GDC)' \ + 'GM2=$(GM2)' \ 'LD=$(LD)' \ 'LIPO=$(LIPO)' \ 'NM=$(NM)' \ @@ -736,6 +745,7 @@ POSTSTAGE1_FLAGS_TO_PASS = \ CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \ CXX="$${CXX}" CXX_FOR_BUILD="$${CXX_FOR_BUILD}" \ GDC="$${GDC}" GDC_FOR_BUILD="$${GDC_FOR_BUILD}" \ + GM2="$${GM2}" GM2_FOR_BUILD="$${GM2_FOR_BUILD}" \ GNATBIND="$${GNATBIND}" \ LDFLAGS="$${LDFLAGS}" \ HOST_LIBS="$${HOST_LIBS}" \ @@ -771,6 +781,8 @@ EXTRA_TARGET_FLAGS = \ 'GOCFLAGS=$$(GOCFLAGS_FOR_TARGET)' \ 'GDC=$$(GDC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ 'GDCFLAGS=$$(GDCFLAGS_FOR_TARGET)' \ + 'GM2=$$(GM2_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ + 'GM2FLAGS=$$(GM2FLAGS_FOR_TARGET)' \ 'LD=$(COMPILER_LD_FOR_TARGET)' \ 'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \ 'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \ @@ -797,6 +809,7 @@ TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS) # cross-building scheme. EXTRA_GCC_FLAGS = \ "GCC_FOR_TARGET=$(GCC_FOR_TARGET) $$TFLAGS" \ + "GM2_FOR_TARGET=$(GM2_FOR_TARGET) $$TFLAGS" \ "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" diff --git a/configure.ac b/configure.ac index 1f7877c8f4a..81a521e4ddb 100644 --- a/configure.ac +++ b/configure.ac @@ -141,7 +141,7 @@ host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktr # binutils, gas and ld appear in that order because it makes sense to run # "make check" in that particular order. # If --enable-gold is used, "gold" may replace "ld". -host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gdbserver gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gotools c++tools" +host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gdbserver gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gm2tools gotools c++tools" # these libraries are built for the target environment, and are built after # the host libraries and the host tools (which may be a cross compiler) @@ -162,6 +162,7 @@ target_libraries="target-libgcc \ target-libffi \ target-libobjc \ target-libada \ + target-libgm2 \ target-libgo \ target-libphobos \ target-zlib" @@ -500,6 +501,14 @@ if test "${ENABLE_LIBADA}" != "yes" ; then noconfigdirs="$noconfigdirs gnattools" fi +AC_ARG_ENABLE(libgm2, +[AS_HELP_STRING([--enable-libgm2], [build libgm2 directory])], +ENABLE_LIBGM2=$enableval, +ENABLE_LIBGM2=no) +if test "${ENABLE_LIBGM2}" != "yes" ; then + noconfigdirs="$noconfigdirs gm2tools" +fi + AC_ARG_ENABLE(libssp, [AS_HELP_STRING([--enable-libssp], [build libssp directory])], ENABLE_LIBSSP=$enableval, @@ -3746,6 +3755,7 @@ NCN_STRICT_CHECK_TARGET_TOOLS(GCC_FOR_TARGET, gcc, ${CC_FOR_TARGET}) NCN_STRICT_CHECK_TARGET_TOOLS(GFORTRAN_FOR_TARGET, gfortran) NCN_STRICT_CHECK_TARGET_TOOLS(GOC_FOR_TARGET, gccgo) NCN_STRICT_CHECK_TARGET_TOOLS(GDC_FOR_TARGET, gdc) +NCN_STRICT_CHECK_TARGET_TOOLS(GM2_FOR_TARGET, gm2) ACX_CHECK_INSTALLED_TARGET_TOOL(AR_FOR_TARGET, ar) ACX_CHECK_INSTALLED_TARGET_TOOL(AS_FOR_TARGET, as) @@ -3784,6 +3794,8 @@ GCC_TARGET_TOOL(gccgo, GOC_FOR_TARGET, GOC, [gcc/gccgo -B$$r/$(HOST_SUBDIR)/gcc/], go) GCC_TARGET_TOOL(gdc, GDC_FOR_TARGET, GDC, [gcc/gdc -B$$r/$(HOST_SUBDIR)/gcc/], d) +GCC_TARGET_TOOL(gm2, GM2_FOR_TARGET, GM2, + [gcc/gm2 -B$$r/$(HOST_SUBDIR)/gcc/], m2) GCC_TARGET_TOOL(ld, LD_FOR_TARGET, LD, [ld/ld-new]) GCC_TARGET_TOOL(lipo, LIPO_FOR_TARGET, LIPO) GCC_TARGET_TOOL(nm, NM_FOR_TARGET, NM, [binutils/nm-new]) @@ -3910,6 +3922,9 @@ AC_SUBST(stage2_werror_flag) # Specify what files to not compare during bootstrap. compare_exclusions="gcc/cc*-checksum\$(objext) | gcc/ada/*tools/*" +compare_exclusions="$compare_exclusions | gcc/m2/gm2-compiler-boot/M2Version*" +compare_exclusions="$compare_exclusions | gcc/m2/gm2-compiler-boot/SYSTEM*" +compare_exclusions="$compare_exclusions | gcc/m2/gm2version*" case "$target" in hppa*64*-*-hpux*) ;; hppa*-*-hpux*) compare_exclusions="$compare_exclusions | */libgcc/lib2funcs* | gcc/function-tests.o" ;; -- 2.30.2