From: Richard Biener <richard.guenther@gmail.com>
To: Gaius Mulley <gaiusmod2@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Modula-2: merge proposal/review: 1/9 01.patch-set-01
Date: Fri, 20 May 2022 13:45:32 +0200 [thread overview]
Message-ID: <CAFiYyc2r2jdbaXQotFF_M=ZFz=hx30-nqTX5dntXyeUz4irVzQ@mail.gmail.com> (raw)
In-Reply-To: <E1nrJzu-00FH4F-Uc@lancelot>
On Wed, May 18, 2022 at 3:47 PM Gaius Mulley via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> hello,
>
> this file is part-01 of the patch set for the gm2 review.
I think you did a better job last time splitting the patches. This
one contains the
driver changes for which I have a hard time remembering the reason they exist
and whether we already discussed it to death or not.
So - with the chance to re-open and old discussion - what's special about
modula-2 so it needs so many changes here? Are all of them necessary
or are most of them merely "cleanups" that could be done as followup?
Thanks,
Richard.
>
> 1. all GCC files which have been patched.
> ==========================================
>
> The 'Only in' diff output was:
>
> Only in gcc-git-devel-modula2/gcc: m2
> Only in gcc-git-devel-modula2/gcc/testsuite: gm2
> Only in gcc-git-devel-modula2/gcc/testsuite/lib: gm2-dg.exp
> Only in gcc-git-devel-modula2/gcc/testsuite/lib: gm2.exp
> Only in gcc-git-devel-modula2/gcc/testsuite/lib: gm2-simple.exp
> Only in gcc-git-devel-modula2/gcc/testsuite/lib: gm2-torture.exp
> Only in gcc-git-devel-modula2/gcc/doc: gm2.texi
> Only in gcc-git-devel-modula2: libgm2
> Only in gcc-git-devel-modula2: gm2tools
>
> and the recursive diffs:
>
>
> diff -x '*autom4te*' -rwu gcc/configure.ac gcc-git-devel-modula2/configure.ac
> --- gcc/configure.ac 2022-05-17 11:20:57.487964366 +0100
> +++ gcc-git-devel-modula2/configure.ac 2022-05-17 14:41:05.480881101 +0100
> @@ -140,7 +140,7 @@
> # 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-libffi \
> target-libobjc \
> target-libada \
> + target-libgm2 \
> target-libgo \
> target-libphobos \
> target-zlib"
> @@ -459,6 +460,14 @@
> 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,
> @@ -3617,6 +3626,7 @@
> 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)
> @@ -3655,6 +3665,8 @@
> [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])
> @@ -3781,6 +3793,9 @@
> # 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" ;;
> diff -x '*autom4te*' -rwu gcc/gcc/c/gccspec.cc gcc-git-devel-modula2/gcc/c/gccspec.cc
> --- gcc/gcc/c/gccspec.cc 2022-05-17 11:20:57.919969752 +0100
> +++ gcc-git-devel-modula2/gcc/c/gccspec.cc 2022-05-17 14:41:05.552881117 +0100
> @@ -105,3 +105,9 @@
>
> /* Number of extra output files that lang_specific_pre_link may generate. */
> int lang_specific_extra_outfiles = 0; /* Not used for C. */
> +
> +/* lang_register_spec_functions. Not used for C. */
> +void
> +lang_register_spec_functions (void)
> +{
> +}
> diff -x '*autom4te*' -rwu gcc/gcc/c-family/cppspec.cc gcc-git-devel-modula2/gcc/c-family/cppspec.cc
> --- gcc/gcc/c-family/cppspec.cc 2022-05-17 11:20:57.911969653 +0100
> +++ gcc-git-devel-modula2/gcc/c-family/cppspec.cc 2022-05-17 14:41:05.548881115 +0100
> @@ -198,3 +198,9 @@
>
> /* Number of extra output files that lang_specific_pre_link may generate. */
> int lang_specific_extra_outfiles = 0; /* Not used for cpp. */
> +
> +/* lang_register_spec_functions. Not used for cpp. */
> +void
> +lang_register_spec_functions (void)
> +{
> +}
> diff -x '*autom4te*' -rwu gcc/gcc/cp/g++spec.cc gcc-git-devel-modula2/gcc/cp/g++spec.cc
> --- gcc/gcc/cp/g++spec.cc 2022-05-17 11:20:58.163972794 +0100
> +++ gcc-git-devel-modula2/gcc/cp/g++spec.cc 2022-05-17 14:41:05.564881118 +0100
> @@ -434,3 +434,9 @@
>
> /* Number of extra output files that lang_specific_pre_link may generate. */
> int lang_specific_extra_outfiles = 0; /* Not used for C++. */
> +
> +/* lang_register_spec_functions. Not used for C++. */
> +void
> +lang_register_spec_functions (void)
> +{
> +}
> diff -x '*autom4te*' -rwu gcc/gcc/d/d-spec.cc gcc-git-devel-modula2/gcc/d/d-spec.cc
> --- gcc/gcc/d/d-spec.cc 2022-05-17 11:20:58.183973043 +0100
> +++ gcc-git-devel-modula2/gcc/d/d-spec.cc 2022-05-17 14:41:05.580881121 +0100
> @@ -525,3 +525,10 @@
>
> int lang_specific_extra_outfiles = 0; /* Not used for D. */
>
> +/* lang_register_spec_functions register the D associated spec
> + functions. Not used for D. */
> +
> +void
> +lang_register_spec_functions (void)
> +{
> +}
> diff -x '*autom4te*' -rwu gcc/gcc/doc/install.texi gcc-git-devel-modula2/gcc/doc/install.texi
> --- gcc/gcc/doc/install.texi 2022-05-17 11:20:58.223973542 +0100
> +++ gcc-git-devel-modula2/gcc/doc/install.texi 2022-05-17 14:41:05.600881126 +0100
> @@ -1832,18 +1832,19 @@
> @smallexample
> grep ^language= */config-lang.in
> @end smallexample
> -Currently, you can use any of the following:
> -@code{all}, @code{default}, @code{ada}, @code{c}, @code{c++}, @code{d},
> -@code{fortran}, @code{go}, @code{jit}, @code{lto}, @code{objc}, @code{obj-c++}.
> -Building the Ada compiler has special requirements, see below.
> -If you do not pass this flag, or specify the option @code{default}, then the
> -default languages available in the @file{gcc} sub-tree will be configured.
> -Ada, D, Go, Jit, and Objective-C++ are not default languages. LTO is not a
> -default language, but is built by default because @option{--enable-lto} is
> -enabled by default. The other languages are default languages. If
> -@code{all} is specified, then all available languages are built. An
> -exception is @code{jit} language, which requires
> -@option{--enable-host-shared} to be included with @code{all}.
> +Currently, you can use any of the following: @code{all},
> +@code{default}, @code{ada}, @code{c}, @code{c++}, @code{d},
> +@code{fortran}, @code{go}, @code{jit}, @code{lto}, @code{m2},
> +@code{objc}, @code{obj-c++}. Building the Ada compiler has special
> +requirements, see below. If you do not pass this flag, or specify the
> +option @code{default}, then the default languages available in the
> +@file{gcc} sub-tree will be configured. Ada, D, Go, Jit,
> +Objective-C++ and Modula-2 are not default languages. LTO is not a
> +default language, but is built by default because
> +@option{--enable-lto} is enabled by default. The other languages are
> +default languages. If @code{all} is specified, then all available
> +languages are built. An exception is @code{jit} language, which
> +requires @option{--enable-host-shared} to be included with @code{all}.
>
> @item --enable-stage1-languages=@var{lang1},@var{lang2},@dots{}
> Specify that a particular subset of compilers and their runtime
> @@ -1866,6 +1867,10 @@
> previous Ada build procedures, when it was required to explicitly
> do a @samp{make -C gcc gnatlib_and_tools}.
>
> +@item --disable-libgm2
> +Specify that the run-time libraries and tools used by Modula-2 should not
> +be built. This can be useful for debugging.
> +
> @item --disable-libsanitizer
> Specify that the run-time libraries for the various sanitizers should
> not be built.
> @@ -3116,10 +3121,10 @@
> In order to run sets of tests selectively, there are targets
> @samp{make check-gcc} and language specific @samp{make check-c},
> @samp{make check-c++}, @samp{make check-d} @samp{make check-fortran},
> -@samp{make check-ada}, @samp{make check-objc}, @samp{make check-obj-c++},
> -@samp{make check-lto}
> -in the @file{gcc} subdirectory of the object directory. You can also
> -just run @samp{make check} in a subdirectory of the object directory.
> +@samp{make check-ada}, @samp{make check-m2}, @samp{make check-objc},
> +@samp{make check-obj-c++}, @samp{make check-lto} in the @file{gcc}
> +subdirectory of the object directory. You can also just run
> +@samp{make check} in a subdirectory of the object directory.
>
>
> A more selective way to just run all @command{gcc} execute tests in the
> diff -x '*autom4te*' -rwu gcc/gcc/doc/sourcebuild.texi gcc-git-devel-modula2/gcc/doc/sourcebuild.texi
> --- gcc/gcc/doc/sourcebuild.texi 2022-05-17 11:20:58.231973641 +0100
> +++ gcc-git-devel-modula2/gcc/doc/sourcebuild.texi 2022-05-17 14:41:05.604881127 +0100
> @@ -52,6 +52,9 @@
> language front ends, and testsuites. @xref{gcc Directory, , The
> @file{gcc} Subdirectory}, for details.
>
> +@item gm2tools
> +Support tools for Modula-2.
> +
> @item gnattools
> Support tools for GNAT.
>
> @@ -84,6 +87,9 @@
> @item libgfortran
> The Fortran runtime library.
>
> +@item libgm2
> +The Modula-2 runtime library.
> +
> @item libgo
> The Go runtime library. The bulk of this library is mirrored from the
> @uref{https://github.com/@/golang/go, master Go repository}.
> @@ -163,13 +169,12 @@
> @item @var{language}
> Subdirectories for various languages. Directories containing a file
> @file{config-lang.in} are language subdirectories. The contents of
> -the subdirectories @file{c} (for C), @file{cp} (for C++),
> -@file{objc} (for Objective-C), @file{objcp} (for Objective-C++),
> -and @file{lto} (for LTO) are documented in this
> -manual (@pxref{Passes, , Passes and Files of the Compiler});
> -those for other languages are not. @xref{Front End, ,
> -Anatomy of a Language Front End}, for details of the files in these
> -directories.
> +the subdirectories @file{c} (for C), @file{cp} (for C++), @file{m2}
> +(for Modula-2), @file{objc} (for Objective-C), @file{objcp} (for
> +Objective-C++), and @file{lto} (for LTO) are documented in this manual
> +(@pxref{Passes, , Passes and Files of the Compiler}); those for other
> +languages are not. @xref{Front End, , Anatomy of a Language Front
> +End}, for details of the files in these directories.
>
> @item common
> Source files shared between the compiler drivers (such as
> diff -x '*autom4te*' -rwu gcc/gcc/fortran/gfortranspec.cc gcc-git-devel-modula2/gcc/fortran/gfortranspec.cc
> --- gcc/gcc/fortran/gfortranspec.cc 2022-05-17 11:20:58.263974041 +0100
> +++ gcc-git-devel-modula2/gcc/fortran/gfortranspec.cc 2022-05-17 14:41:05.608881127 +0100
> @@ -447,4 +447,12 @@
> }
>
> /* Number of extra output files that lang_specific_pre_link may generate. */
> -int lang_specific_extra_outfiles = 0; /* Not used for F77. */
> +int lang_specific_extra_outfiles = 0; /* Not used for Fortran. */
> +
> +/* lang_register_spec_functions register the Fortran associated spec
> + functions. */
> +
> +void
> +lang_register_spec_functions (void)
> +{
> +}
> diff -x '*autom4te*' -rwu gcc/gcc/gcc.cc gcc-git-devel-modula2/gcc/gcc.cc
> --- gcc/gcc/gcc.cc 2022-05-17 11:20:58.283974290 +0100
> +++ gcc-git-devel-modula2/gcc/gcc.cc 2022-05-17 14:41:05.616881129 +0100
> @@ -334,6 +334,10 @@
> static const char *cross_compile = "0";
> #endif
>
> +/* The lang specs might wish to override the default linker.
> + */
> +int allow_linker = 1;
> +
> /* Greatest exit code of sub-processes that has been encountered up to
> now. */
> static int greatest_status = 1;
> @@ -1782,6 +1786,10 @@
> { 0, 0 }
> };
>
> +/* Front end registered spec functions */
> +static struct spec_function *lang_spec_functions = NULL;
> +static unsigned int lang_spec_functions_length = 0;
> +
> static int processing_spec_function;
>
> /* Add appropriate libgcc specs to OBSTACK, taking into account
> @@ -2950,6 +2958,30 @@
> env.xput (string);
> }
>
> +/* Get the environment variable through the managed env. */
> +
> +static const char *
> +xgetenv (const char *key)
> +{
> + return env.get (key);
> +}
> +
> +/* Allow front end access to xputenv. */
> +
> +void
> +fe_putenv (const char *string)
> +{
> + xputenv (string);
> +}
> +
> +/* Allow front end access to xgetenv. */
> +
> +const char *
> +fe_getenv (const char *key)
> +{
> + return xgetenv (key);
> +}
> +
> /* Build a list of search directories from PATHS.
> PREFIX is a string to prepend to the list.
> If CHECK_DIR_P is true we ensure the directory exists.
> @@ -3916,6 +3948,15 @@
> n_switches++;
> }
>
> +/* Allow front ends to save switches. */
> +
> +void
> +fe_save_switch (const char *opt, size_t n_args, const char *const *args,
> + bool validated, bool known)
> +{
> + save_switch (opt, n_args, args, validated, known);
> +}
> +
> /* Set the SOURCE_DATE_EPOCH environment variable to the current time if it is
> not set already. */
>
> @@ -3939,6 +3980,76 @@
> setenv ("SOURCE_DATE_EPOCH", source_date_epoch, 0);
> }
>
> +/* Wrapper providing front end access to link options. */
> +
> +void
> +fe_add_linker_option (const char *option)
> +{
> + add_linker_option (option, strlen (option));
> +}
> +
> +/* Handle the -B option by adding the prefix to exec, startfile and
> + include search paths. */
> +
> +static void
> +handle_opt_b (const char *arg)
> +{
> + size_t len = strlen (arg);
> +
> + /* Catch the case where the user has forgotten to append a
> + directory separator to the path. Note, they may be using
> + -B to add an executable name prefix, eg "i386-elf-", in
> + order to distinguish between multiple installations of
> + GCC in the same directory. Hence we must check to see
> + if appending a directory separator actually makes a
> + valid directory name. */
> + if (!IS_DIR_SEPARATOR (arg[len - 1])
> + && is_directory (arg, false))
> + {
> + char *tmp = XNEWVEC (char, len + 2);
> + strcpy (tmp, arg);
> + tmp[len] = DIR_SEPARATOR;
> + tmp[++len] = 0;
> + arg = tmp;
> + }
> +
> + add_prefix (&exec_prefixes, arg, NULL,
> + PREFIX_PRIORITY_B_OPT, 0, 0);
> + add_prefix (&startfile_prefixes, arg, NULL,
> + PREFIX_PRIORITY_B_OPT, 0, 0);
> + add_prefix (&include_prefixes, arg, NULL,
> + PREFIX_PRIORITY_B_OPT, 0, 0);
> +}
> +
> +/* Wrapper allowing the front end to create a -B option. */
> +
> +void
> +fe_handle_opt_b (const char *arg)
> +{
> + handle_opt_b (arg);
> +}
> +
> +/* Save the infile. */
> +
> +void
> +fe_add_infile (const char *infile, const char *lang)
> +{
> + add_infile (infile, lang);
> +}
> +
> +/* Mark a file as compiled. */
> +
> +void
> +fe_mark_compiled (const char *name)
> +{
> + int max = n_infiles + lang_specific_extra_outfiles;
> + int i;
> +
> + for (i = 0; i < max; i++)
> + if (filename_cmp (name, infiles[i].name) == 0)
> + infiles[i].compiled = true;
> +}
> +
> /* Handle an option DECODED that is unknown to the option-processing
> machinery. */
>
> @@ -4518,33 +4629,7 @@
> break;
>
> case OPT_B:
> - {
> - size_t len = strlen (arg);
> -
> - /* Catch the case where the user has forgotten to append a
> - directory separator to the path. Note, they may be using
> - -B to add an executable name prefix, eg "i386-elf-", in
> - order to distinguish between multiple installations of
> - GCC in the same directory. Hence we must check to see
> - if appending a directory separator actually makes a
> - valid directory name. */
> - if (!IS_DIR_SEPARATOR (arg[len - 1])
> - && is_directory (arg, false))
> - {
> - char *tmp = XNEWVEC (char, len + 2);
> - strcpy (tmp, arg);
> - tmp[len] = DIR_SEPARATOR;
> - tmp[++len] = 0;
> - arg = tmp;
> - }
> -
> - add_prefix (&exec_prefixes, arg, NULL,
> - PREFIX_PRIORITY_B_OPT, 0, 0);
> - add_prefix (&startfile_prefixes, arg, NULL,
> - PREFIX_PRIORITY_B_OPT, 0, 0);
> - add_prefix (&include_prefixes, arg, NULL,
> - PREFIX_PRIORITY_B_OPT, 0, 0);
> - }
> + handle_opt_b (arg);
> validated = true;
> break;
>
> @@ -4677,6 +4762,69 @@
> return ret;
> }
>
> +/* print_option a debugging routine to display option i with a leading desc
> + string. */
> +
> +void
> +print_option (const char *desc, unsigned int i,
> + struct cl_decoded_option *in_decoded_options)
> +{
> + printf (desc);
> + printf (" [%d]", i);
> + switch (in_decoded_options[i].opt_index)
> + {
> +
> + case N_OPTS:
> + break;
> + case OPT_SPECIAL_unknown:
> + printf (" flag <unknown>");
> + break;
> + case OPT_SPECIAL_ignore:
> + printf (" flag <ignore>");
> + break;
> + case OPT_SPECIAL_program_name:
> + printf (" flag <program name>");
> + break;
> + case OPT_SPECIAL_input_file:
> + printf (" flag <input file name>");
> + break;
> + default:
> + printf (" flag [%s]",
> + cl_options[in_decoded_options[i].opt_index].opt_text);
> + }
> +
> + if (in_decoded_options[i].arg == NULL)
> + printf (" no arg");
> + else
> + printf (" arg [%s]", in_decoded_options[i].arg);
> + printf (" orig text [%s]",
> + in_decoded_options[i].orig_option_with_args_text);
> + /* On some hosts value is declared as a long long int. */
> + printf (" value [%ld]", (long int)in_decoded_options[i].value);
> + printf (" error [%d]\n", in_decoded_options[i].errors);
> +}
> +
> +/* print_options display all options with a leading string desc. */
> +
> +void
> +print_options (const char *desc,
> + unsigned int in_decoded_options_count,
> + struct cl_decoded_option *in_decoded_options)
> +{
> + for (unsigned int i = 0; i < in_decoded_options_count; i++)
> + print_option (desc, i, in_decoded_options);
> +}
> +
> +/* dbg_options display all options. */
> +
> +void
> +dbg_options (unsigned int in_decoded_options_count,
> + struct cl_decoded_option *in_decoded_options)
> +{
> + print_options ("dbg_options", in_decoded_options_count,
> + in_decoded_options);
> +}
> +
> /* Create the vector `switches' and its contents.
> Store its length in `n_switches'. */
>
> @@ -6842,6 +6990,35 @@
> return 0;
> }
>
> +/* Allow the front end to register a spec function. */
> +
> +void fe_add_spec_function (const char *name,
> + const char *(*func) (int, const char **))
> +{
> + const struct spec_function *f = lookup_spec_function (name);
> + struct spec_function *fl;
> + unsigned int i;
> +
> + if (f != NULL)
> + fatal_error (input_location, "spec function (%s) already registered", name);
> +
> + if (lang_spec_functions == NULL)
> + lang_spec_functions_length = 1;
> +
> + lang_spec_functions_length++;
> + fl = (struct spec_function *) xmalloc (sizeof (const struct spec_function)
> + *lang_spec_functions_length);
> + for (i=0; i<lang_spec_functions_length-2; i++)
> + fl[i] = lang_spec_functions[i];
> + free (lang_spec_functions);
> + lang_spec_functions = fl;
> +
> + lang_spec_functions[lang_spec_functions_length-2].name = name;
> + lang_spec_functions[lang_spec_functions_length-2].func = func;
> + lang_spec_functions[lang_spec_functions_length-1].name = NULL;
> + lang_spec_functions[lang_spec_functions_length-1].func = NULL;
> +}
> +
> /* Look up a spec function. */
>
> static const struct spec_function *
> @@ -6853,6 +7030,11 @@
> if (strcmp (sf->name, name) == 0)
> return sf;
>
> + if (lang_spec_functions != NULL)
> + for (sf = lang_spec_functions; sf->name != NULL; sf++)
> + if (strcmp (sf->name, name) == 0)
> + return sf;
> +
> return NULL;
> }
>
> @@ -8339,6 +8521,8 @@
> accel_dir_suffix, dir_separator_str, NULL);
> just_machine_suffix = concat (spec_machine, dir_separator_str, NULL);
>
> + lang_register_spec_functions ();
> +
> specs_file = find_a_file (&startfile_prefixes, "specs", R_OK, true);
> /* Read the specs file unless it is a default one. */
> if (specs_file != 0 && strcmp (specs_file, "specs"))
> @@ -9070,7 +9254,8 @@
>
> /* Run ld to link all the compiler output files. */
>
> - if (num_linker_inputs > 0 && !seen_error () && print_subprocess_help < 2)
> + if (num_linker_inputs > 0 && !seen_error () && print_subprocess_help < 2
> + && allow_linker)
> {
> int tmp = execution_count;
>
> @@ -9139,7 +9324,7 @@
> /* If options said don't run linker,
> complain about input files to be given to the linker. */
>
> - if (! linker_was_run && !seen_error ())
> + if (! linker_was_run && !seen_error () && allow_linker)
> for (i = 0; (int) i < n_infiles; i++)
> if (explicit_link_files[i]
> && !(infiles[i].language && infiles[i].language[0] == '*'))
> diff -x '*autom4te*' -rwu gcc/gcc/gcc.h gcc-git-devel-modula2/gcc/gcc.h
> --- gcc/gcc/gcc.h 2022-05-17 11:20:58.283974290 +0100
> +++ gcc-git-devel-modula2/gcc/gcc.h 2022-05-17 14:41:05.616881129 +0100
> @@ -73,9 +73,28 @@
> extern int do_spec (const char *);
> extern void record_temp_file (const char *, int, int);
> extern void set_input (const char *);
> +extern void fe_save_switch (const char *opt, size_t n_args,
> + const char *const *args,
> + bool validated, bool known);
> +extern void fe_handle_op_b (const char *arg);
> +extern void fe_add_infile (const char *infile, const char *lang);
> +extern void fe_add_linker_option (const char *option);
> +extern void fe_add_spec_function (const char *name, const char *(*func) (int, const char **));
> +extern void fe_putenv (const char *value);
> +extern const char *fe_getenv (const char *key);
> +extern void print_options (const char *desc,
> + unsigned int in_decoded_options_count,
> + struct cl_decoded_option *in_decoded_options);
> +extern void print_option (const char *desc, unsigned int i,
> + struct cl_decoded_option *in_decoded_options);
> +extern void dbg_options (unsigned int in_decoded_options_count,
> + struct cl_decoded_option *in_decoded_options);
> +
>
> /* Spec files linked with gcc.cc must provide definitions for these. */
>
> +extern void lang_register_spec_functions (void);
> +
> /* Called before processing to change/add/remove arguments. */
> extern void lang_specific_driver (struct cl_decoded_option **,
> unsigned int *, int *);
> @@ -97,4 +116,8 @@
> void *user_data),
> void *user_data);
>
> +/* Default setting is true, but can be overridden by the language
> + front end to prohibit the linker from being invoked. */
> +extern int allow_linker;
> +
> #endif /* ! GCC_GCC_H */
> diff -x '*autom4te*' -rwu gcc/gcc/go/gospec.cc gcc-git-devel-modula2/gcc/go/gospec.cc
> --- gcc/gcc/go/gospec.cc 2022-05-17 11:20:58.323974789 +0100
> +++ gcc-git-devel-modula2/gcc/go/gospec.cc 2022-05-17 14:41:05.616881129 +0100
> @@ -464,3 +464,9 @@
>
> /* Number of extra output files that lang_specific_pre_link may generate. */
> int lang_specific_extra_outfiles = 0; /* Not used for Go. */
> +
> +/* lang_register_spec_functions. Not used for Go. */
> +void
> +lang_register_spec_functions (void)
> +{
> +}
> diff -x '*autom4te*' -rwu gcc/gcc/jit/jit-spec.cc gcc-git-devel-modula2/gcc/jit/jit-spec.cc
> --- gcc/gcc/jit/jit-spec.cc 2022-05-17 11:20:58.355975188 +0100
> +++ gcc-git-devel-modula2/gcc/jit/jit-spec.cc 2022-05-17 14:41:05.620881130 +0100
> @@ -39,3 +39,9 @@
>
> /* Number of extra output files that lang_specific_pre_link may generate. */
> int lang_specific_extra_outfiles = 0; /* Not used for jit. */
> +
> +/* lang_register_spec_functions. Not used for jit. */
> +void
> +lang_register_spec_functions (void)
> +{
> +}
> diff -x '*autom4te*' -rwu gcc/Makefile.def gcc-git-devel-modula2/Makefile.def
> --- gcc/Makefile.def 2022-05-17 11:20:57.467964117 +0100
> +++ gcc-git-devel-modula2/Makefile.def 2022-05-17 14:41:05.468881099 +0100
> @@ -146,6 +146,7 @@
> extra_configure_flags='--enable-shared @extra_linker_plugin_flags@ @extra_linker_plugin_configure_flags@';
> extra_make_flags='@extra_linker_plugin_flags@'; };
> host_modules= { module= libcc1; extra_configure_flags=--enable-shared; };
> +host_modules= { module= gm2tools; };
> host_modules= { module= gotools; };
> host_modules= { module= libctf; bootstrap=true; };
>
> @@ -189,6 +190,7 @@
> target_modules = { module= zlib; bootstrap=true; };
> 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; bootstrap=true; lib_path=.libs; };
> @@ -311,6 +313,8 @@
> 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 ; };
> @@ -407,6 +411,8 @@
> // we want version.o from gcc, and implicitly depend on libcody
> dependencies = { module=all-c++tools; on=all-gcc; };
> dependencies = { module=all-gotools; on=all-target-libgo; };
> +dependencies = { module=all-gm2tools; on=all-target-libgm2; };
> +dependencies = { module=all-gm2tools; on=all-target-libstdc++-v3; };
>
> dependencies = { module=all-utils; on=all-libiberty; };
>
> @@ -623,6 +629,8 @@
> 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; };
> @@ -681,6 +689,9 @@
> 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;
> + lib-check-target=check-gm2tools; };
> languages = { language=d; gcc-check-target=check-d;
> lib-check-target=check-target-libphobos; };
> languages = { language=jit; gcc-check-target=check-jit; };
> diff -x '*autom4te*' -rwu gcc/Makefile.tpl gcc-git-devel-modula2/Makefile.tpl
> --- gcc/Makefile.tpl 2022-05-17 11:20:57.475964217 +0100
> +++ gcc-git-devel-modula2/Makefile.tpl 2022-05-17 14:41:05.472881100 +0100
> @@ -166,6 +166,7 @@
> GOCFLAGS="$(GOCFLAGS_FOR_BUILD)"; export GOCFLAGS; \
> GDC="$(GDC_FOR_BUILD)"; export GDC; \
> GDCFLAGS="$(GDCFLAGS_FOR_BUILD)"; export GDCFLAGS; \
> + GM2="$(GM2_FOR_BUILD)"; export GM2; \
> DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
> DSYMUTIL="$(DSYMUTIL_FOR_BUILD)"; export DSYMUTIL; \
> LD="$(LD_FOR_BUILD)"; export LD; \
> @@ -204,6 +205,7 @@
> 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; \
> @@ -309,6 +311,7 @@
> 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; \
> @@ -379,6 +382,7 @@
> 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@
> @@ -449,6 +453,7 @@
> LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
> GOCFLAGS = $(CFLAGS)
> GDCFLAGS = $(CFLAGS)
> +GM2FLAGS = $(CFLAGS)
>
> # Pass additional PGO and LTO compiler options to the PGO build.
> BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS)
> @@ -584,6 +589,7 @@
> 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@
> @@ -609,6 +615,7 @@
> 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
>
> @@ -715,6 +722,7 @@
> 'GFORTRAN=$(GFORTRAN)' \
> 'GOC=$(GOC)' \
> 'GDC=$(GDC)' \
> + 'GM2=$(GM2)' \
> 'LD=$(LD)' \
> 'LIPO=$(LIPO)' \
> 'NM=$(NM)' \
> @@ -741,6 +749,7 @@
> 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}" \
> @@ -776,6 +785,8 @@
> '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)' \
> @@ -802,6 +813,7 @@
> # cross-building scheme.
> EXTRA_GCC_FLAGS = \
> "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
> + "GM2_FOR_TARGET=$(GM2_FOR_TARGET)" \
> "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
> "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
>
> @@ -951,7 +963,7 @@
> -rm -f texinfo/doc/Makefile texinfo/po/POTFILES
> -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
> -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
> - -rmdir c++tools fastjar gcc gnattools gotools 2>/dev/null
> + -rmdir c++tools fastjar gcc gnattools gm2tools gotools 2>/dev/null
> -rmdir libcc1 libiberty texinfo zlib 2>/dev/null
> -find . -name config.cache -exec rm -f {} \; \; 2>/dev/null
next prev parent reply other threads:[~2022-05-20 11:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-18 13:45 Gaius Mulley
2022-05-20 11:45 ` Richard Biener [this message]
2022-05-20 18:53 ` Gaius Mulley
2022-05-21 1:11 ` Gaius Mulley
2022-05-24 10:26 ` Richard Biener
2022-05-24 15:45 ` Gaius Mulley
2022-05-25 9:10 ` Richard Biener
2022-05-25 19:50 ` Gaius Mulley
2022-05-27 7:40 ` Richard Biener
2022-05-28 15:34 ` Gaius Mulley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFiYyc2r2jdbaXQotFF_M=ZFz=hx30-nqTX5dntXyeUz4irVzQ@mail.gmail.com' \
--to=richard.guenther@gmail.com \
--cc=gaiusmod2@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).