Previously either "specs" file was read, or built-in specs were generated.
With this change, always load generated "built-in" specs, prior to discovering and loading optional "specs" file. Also relax, and allow using "%include", "%include_noerr", and "%rename" commands in the "specs" file. Then continue to load user specified `-specs` files on the command line. This makes "specs" file from startfiles locations, behave closer to user provided "-specs" files. gcc/ChangeLog: * gcc.cc (driver::set_up_specs): Always load "built-in" generated specs files, prior to loading "specs" file. Allow "%include", "%include_noerr" and "%rename" commands in "specs" file. Signed-off-by: Dimitri John Ledkov <dimitri.led...@surgut.co.uk> --- gcc/gcc.cc | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/gcc/gcc.cc b/gcc/gcc.cc index b00d93b45c4..8d208e7de00 100644 --- a/gcc/gcc.cc +++ b/gcc/gcc.cc @@ -8464,12 +8464,18 @@ driver::set_up_specs () const accel_dir_suffix, dir_separator_str, NULL); just_machine_suffix = concat (spec_machine, dir_separator_str, NULL); + /* Always init built-in specs, as all followups can then + append/remove/rename. This also makes the existing Spec documentation true + for both command-line -specs provided files, and those added to the + <startfiles>/specs location */ + init_spec (); + 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")) - read_specs (specs_file, true, false); - else - init_spec (); + + /* Read the specs file, these days empty, thus allow #include_noerr + commands */ + if (specs_file != 0) + read_specs (specs_file, false, false); #ifdef ACCEL_COMPILER spec_machine_suffix = machine_suffix; @@ -8485,7 +8491,7 @@ driver::set_up_specs () const strcat (specs_file, spec_machine_suffix); strcat (specs_file, "specs"); if (access (specs_file, R_OK) == 0) - read_specs (specs_file, true, false); + read_specs (specs_file, false, false); /* Process any configure-time defaults specified for the command line options, via OPTION_DEFAULT_SPECS. */ -- 2.43.0