[gcc r16-1494] driver: Try to read spec from gcc_exec_prefix if possible
Kito Cheng
kito@gcc.gnu.org
Fri Jun 13 01:27:50 GMT 2025
https://gcc.gnu.org/g:59fbc99f8ee35fc1a7bcae4bed3e7bfaec38b538
commit r16-1494-g59fbc99f8ee35fc1a7bcae4bed3e7bfaec38b538
Author: Kito Cheng <kito.cheng@sifive.com>
Date: Tue Jun 10 11:17:45 2025 +0800
driver: Try to read spec from gcc_exec_prefix if possible
GCC will try to read the spec file from the directory where it is
installed, but it should try to read from gcc_exec_prefix rather than
standard_exec_prefix, because the latter is not the right one if
compiler has been relocated into other places other than the path
specfied at configuration time.
gcc/ChangeLog:
* gcc.cc (driver::set_up_specs): Use gcc_exec_prefix to
read the spec file rather than standard_exec_prefix.
Diff:
---
gcc/gcc.cc | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 4e61de2a47c3..235fe8019880 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -8506,11 +8506,13 @@ driver::set_up_specs () const
spec_machine_suffix = just_machine_suffix;
#endif
+ const char *exec_prefix
+ = gcc_exec_prefix ? gcc_exec_prefix : standard_exec_prefix;
/* We need to check standard_exec_prefix/spec_machine_suffix/specs
for any override of as, ld and libraries. */
- specs_file = (char *) alloca (strlen (standard_exec_prefix)
- + strlen (spec_machine_suffix) + sizeof ("specs"));
- strcpy (specs_file, standard_exec_prefix);
+ specs_file = (char *) alloca (
+ strlen (exec_prefix) + strlen (spec_machine_suffix) + sizeof ("specs"));
+ strcpy (specs_file, exec_prefix);
strcat (specs_file, spec_machine_suffix);
strcat (specs_file, "specs");
if (access (specs_file, R_OK) == 0)
More information about the Gcc-cvs
mailing list