[1/2] specs: load specs.overlay with all commands enabled

Message ID 20240920121919.65112-2-dimitri.ledkov@surgut.co.uk
State New
Headers
Series Enable supplementing built-in specs without command-line arguments |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gcc_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 success Test passed

Commit Message

Dimitri John Ledkov Sept. 20, 2024, 12:19 p.m. UTC
  After automatically discovered "specs" file is loaded, or in its
absence "built-in" specs are generated; attempt to discover
"specs.overlay" and load it.

Unlike "specs", "specs.overlay" allows using "%include",
"%include_noerr" and "%rename" commands, similar to user provided
`-specs` on the command line.

Then continue to parse and load any user provided `-specs` on the
command line.

gcc/ChangeLog:

	* gcc.cc (driver::set_up_specs): Parse and load specs.overlay
	by default, with all commands allowed.

Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@surgut.co.uk>
---
 gcc/gcc.cc | 5 +++++
 1 file changed, 5 insertions(+)
  

Patch

diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 16fed46fb35..b00d93b45c4 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -8601,6 +8601,11 @@  driver::set_up_specs () const
 			      PREFIX_PRIORITY_LAST, 0, 1);
     }
 
+  /* Process any built-in specs overlay, allow include_noerr */
+  specs_file = find_a_file (&startfile_prefixes, "specs.overlay", R_OK, true);
+  if (specs_file != 0 && access (specs_file, R_OK) == 0)
+    read_specs (specs_file, false, false);
+
   /* Process any user specified specs in the order given on the command
      line.  */
   for (struct user_specs *uptr = user_specs_head; uptr; uptr = uptr->next)