aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog.meissner103
-rw-r--r--gcc/config.in23
-rw-r--r--gcc/config/rs6000/driver-rs6000.c30
-rw-r--r--gcc/config/rs6000/linux64.h34
-rw-r--r--gcc/config/rs6000/rs6000.h8
-rw-r--r--gcc/config/rs6000/sysv4.h43
-rw-r--r--gcc/config/rs6000/x-rs60002
-rwxr-xr-xgcc/configure117
-rw-r--r--gcc/configure.ac66
-rw-r--r--gcc/doc/install.texi45
-rw-r--r--gcc/gcc.c412
-rw-r--r--gcc/gcc.h1
12 files changed, 789 insertions, 95 deletions
diff --git a/gcc/ChangeLog.meissner b/gcc/ChangeLog.meissner
new file mode 100644
index 00000000000..ce28c53dbca
--- /dev/null
+++ b/gcc/ChangeLog.meissner
@@ -0,0 +1,103 @@
+2014-03-04 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ Merge up to subversion id 208322.
+
+2014-02-21 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ Merge up to subversion id 208009.
+
+2013-08-16 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ Merge up to subversion id 201796.
+
+2013-07-19 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ Merge up to subversion id 201068.
+
+2013-06-28 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ Merge up to subversion id 200539.
+
+2013-06-11 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ Apply power8 patch #6, subversion id 199965.
+
+2013-06-06 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ * configure.ac (--with-extra-prefix=): Add configure time switches
+ to add additional prefix directories for the compiler to search for
+ extra executables, startfiles, and directories to add to the list
+ of shared library locations.
+ (--with-extra-exec-prefix=): Likewise.
+ (--with-extra-include-prefix=): Likewise.
+ (--with-extra-startfile-prefix=): Likewise.
+ (--with-extra-rpath-prefix=): Likewise.
+ * configure: Regenerate.
+
+ * doc/install.texi (--with-extra-prefix=): Document new configure
+ switches.
+ (--with-extra-exec-prefix=): Likewise.
+ (--with-extra-include-prefix=): Likewise.
+ (--with-extra-startfile-prefix=): Likewise.
+ (--with-extra-rpath-prefix=): Likewise.
+
+ * gcc.c (LINK_RPATH_DIRS_SPEC): Add support for configuration time
+ additional executable, startfile, include, and shared library
+ location prefixes. Add %find-dynamic-linker(), %extra-rpath-dirs(),
+ %extra-cpu-dirs() as spec functions.
+ (LINK_COMMAND_SPEC): Likewise.
+ (CONFIGURE_INCLUDE_PREFIX): Likewise.
+ (CONFIGURE_STARTFILE_PREFIX): Likewise.
+ (configure_include_prefix): Likewise.
+ (configure_startfile_prefix): Likewise.
+ (configure_exec_prefix): Likewise.
+ (static_spec_functions): Likewise.
+ (IS_STD_DIR): Likewise.
+ (config_rpath): Likewise.
+ (build_rpath_or_cpu_dirs): Likewise.
+ (get_rpath_dirs): Likewise.
+ (extra_rpath_dirs_spec_function): Likewsie.
+ (extra_cpu_dirs_spec_function): Likewise.
+ (find_dynamic_linker_spec_function): Likewise.
+ (add_multiple_prefix): New function that is like add_prefix, but
+ splits the prefix at PATH_SEPARATOR.
+ (process_command): Simplify processing COMPILER_PATH, LPATH, and
+ LIBRARY_PATH_ENV environment variables by using the function
+ add_multiple_prefix to do the splitting of the separate prefixes.
+ Add support for the configuration switch to add new executable,
+ startfile, include, and shared library prefixes.
+
+ * gcc.h (extra_cpu_dirs_spec_function): Add declaration.
+
+ * config.in (CONFIGURE_EXEC_PREFIX): Add defines for the configure
+ switches to add executable, startfile, include, and shared library
+ configuration directories.
+ (CONFIGURE_INCLUDE_PREFIX): Likewise.
+ (CONFIGURE_STARTFILE_PREFIX): Likewise.
+ (CONFIGURE_RPATH_PREFIX): Likewise.
+
+ * config/rs6000/x-rs6000 (driver-rs6000.o): Add $(GCC_H)
+ dependency.
+
+ * config/rs6000/linux64.h (GLIBC_DYNAMIC_LINKER32): If
+ --with-extra-startfile-prefix or --with-extra-prefix was used, use
+ %find-dynamic-linker() to find the dynamic linker in the startfile
+ prefixes.
+ (GLIBC_DYNAMIC_LINKER64): Likewise.
+ (LINUX_EXTRA_STATIC_LIBDIRS64): Likewise.
+ (LINK_OS_LINUX_SPEC32): Likewise.
+ (LINK_OS_LINUX_SPEC64): Likewise.
+ * config/rs6000/rs6000.h (EXTRA_SPEC_FUNCTIONS): Likewise.
+ (LOCAL_CPU_EXTR_SPEC_FUNCTIONS): Likewise.
+ * config/rs6000/sysv4.h (GLIBC_DYNAMIC_LINKER): Likewise.
+ (LINUX_EXTRA_STATIC_LIBDIRS32): Likewise.
+ (LINK_OS_LINUX_SPEC): Likewise.
+ (rs6000_extra_static_libdirs): Likewise.
+ (SUBTARGET_EXTRA_SPEC_FUNCTIONS): Likewise.
+
+ * config/rs6000/driver-rs6000.c (toplevel): Include gcc.h.
+ (rs6000_extra_static_libdirs): If we have extra configure
+ startfile prefixes, look for a machine specific file as a
+ subdirectory in the startfile prefixes if the user used
+ -mcpu=<xxx>.
+
diff --git a/gcc/config.in b/gcc/config.in
index 27497d4194b..e78e11bdc2f 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -2053,3 +2053,26 @@
#undef vfork
#endif
+
+/* Define extra executable prefixes at configure time. */
+#ifndef USED_FOR_TARGET
+#undef CONFIGURE_EXEC_PREFIX
+#endif
+
+
+/* Define extra rpath prefixes at configure time. */
+#ifndef USED_FOR_TARGET
+#undef CONFIGURE_INCLUDE_PREFIX
+#endif
+
+
+/* Define extra startfile prefixes at configure time. */
+#ifndef USED_FOR_TARGET
+#undef CONFIGURE_STARTFILE_PREFIX
+#endif
+
+
+/* Define extra rpath prefixes at configure time. */
+#ifndef USED_FOR_TARGET
+#undef CONFIGURE_RPATH_PREFIX
+#endif
diff --git a/gcc/config/rs6000/driver-rs6000.c b/gcc/config/rs6000/driver-rs6000.c
index 1bc8ace2a5f..a780fc95deb 100644
--- a/gcc/config/rs6000/driver-rs6000.c
+++ b/gcc/config/rs6000/driver-rs6000.c
@@ -22,6 +22,7 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "tm.h"
#include <stdlib.h>
+#include "gcc.h"
#ifdef _AIX
# include <sys/systemcfg.h>
@@ -526,3 +527,32 @@ host_detect_local_cpu (int argc, const char **argv)
#endif /* GCC_VERSION */
+
+#ifdef CONFIGURE_STARTFILE_PREFIX
+/* Add -L for all of the machine dependent directories found in the extra rpath
+ directories. We don't need to do this for dynamic links, since the dynamic
+ linker will pick up the right library based on the machine that is currently
+ running. */
+
+const char *
+rs6000_extra_static_libdirs (int argc, const char **argv)
+{
+ const char *new_argv[2];
+ const char *cpu;
+
+ if (argc == 1 && strncmp (argv[0], "mcpu=", sizeof ("-mcpu=")-1) == 0)
+ cpu = argv[0] + sizeof ("-mcpu=") - 1;
+
+ else if (argc == 2 && strcmp (argv[0], "-") == 0
+ && strncmp (argv[1], "mcpu=", sizeof ("mcpu=")-1) == 0)
+ cpu = argv[1] + sizeof ("mcpu=") - 1;
+
+ else
+ abort ();
+
+ new_argv[0] = cpu;
+ new_argv[1] = NULL;
+ return extra_cpu_dirs_spec_function (1, new_argv);
+}
+
+#endif /* !CONFIGURE_STARTFILE_PREFIX */
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
index 5e7ae86279b..19a33a1a358 100644
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -363,12 +363,18 @@ extern int dot_symbols;
#undef LINK_OS_DEFAULT_SPEC
#define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
+#ifdef CONFIGURE_STARTFILE_PREFIX
+#define GLIBC_DYNAMIC_LINKER32 "%:find-dynamic-linker(/lib/ld.so.1)"
+#define GLIBC_DYNAMIC_LINKER64 "%:find-dynamic-linker(/lib64/ld64.so.1)"
+#else
#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
#ifdef LINUX64_DEFAULT_ABI_ELFv2
#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:/lib64/ld64.so.1;:/lib64/ld64.so.2}"
#else
#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:/lib64/ld64.so.2;:/lib64/ld64.so.1}"
#endif
+#endif
+
#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
#if DEFAULT_LIBC == LIBC_UCLIBC
@@ -378,6 +384,7 @@ extern int dot_symbols;
#else
#error "Unsupported DEFAULT_LIBC"
#endif
+
#define GNU_USER_DYNAMIC_LINKER32 \
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
#define GNU_USER_DYNAMIC_LINKER64 \
@@ -402,11 +409,34 @@ extern int dot_symbols;
" -m elf64ppc")
#endif
-#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \
+#ifdef CONFIGURE_STARTFILE_PREFIX
+#ifdef HAVE_LOCAL_CPU_DETECT
+#define LINUX_EXTRA_STATIC_LIBDIRS64 \
+"%{static: \
+%{mcpu=native: %:linux_extra_static_libdirs(%:local_cpu_detect(cpu))} \
+%{!mcpu=native: %{mcpu=*: %:linux_extra_static_libdirs(%{mcpu=*}) }}} "
+
+#else
+#define LINUX_EXTRA_STATIC_LIBDIRS64 \
+"%{static: \
+%{mcpu=: %:linux_extra_static_libdirs(%{mcpu=*}) }} "
+#endif
+
+#else
+#define LINUX_EXTRA_STATIC_LIBDIRS64
+#endif
+
+#define LINK_OS_LINUX_SPEC32 \
+LINK_OS_LINUX_EMUL32 \
+LINUX_EXTRA_STATIC_LIBDIRS32 \
+"%{!shared: %{!static: \
%{rdynamic:-export-dynamic} \
-dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}}"
-#define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " %{!shared: %{!static: \
+#define LINK_OS_LINUX_SPEC64 \
+LINK_OS_LINUX_EMUL64 \
+LINUX_EXTRA_STATIC_LIBDIRS64 \
+"%{!shared: %{!static: \
%{rdynamic:-export-dynamic} \
-dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}"
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index 0a15fadae70..208480280a7 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -202,15 +202,21 @@
#if defined(__powerpc__) || defined(__POWERPC__) || defined(_AIX)
/* In driver-rs6000.c. */
extern const char *host_detect_local_cpu (int argc, const char **argv);
-#define EXTRA_SPEC_FUNCTIONS \
+#define LOCAL_CPU_EXTRA_SPEC_FUNCTIONS \
{ "local_cpu_detect", host_detect_local_cpu },
#define HAVE_LOCAL_CPU_DETECT
#define ASM_CPU_NATIVE_SPEC "%:local_cpu_detect(asm)"
#else
#define ASM_CPU_NATIVE_SPEC "%(asm_default)"
+#define LOCAL_CPU_EXTRA_SPEC_FUNCTIONS
#endif
+#define SUBTARGET_EXTRA_SPEC_FUNCTIONS
+#define EXTRA_SPEC_FUNCTIONS \
+ SUBTARGET_EXTRA_SPEC_FUNCTIONS \
+ LOCAL_CPU_EXTRA_SPEC_FUNCTIONS
+
#ifndef CC1_CPU_SPEC
#ifdef HAVE_LOCAL_CPU_DETECT
#define CC1_CPU_SPEC \
diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
index f6795b0a158..b663c2ea013 100644
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
@@ -761,7 +761,12 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
#define LINK_START_LINUX_SPEC ""
+#ifdef CONFIGURE_STARTFILE_PREFIX
+#define GLIBC_DYNAMIC_LINKER "%:find-dynamic-linker(/lib/ld.so.1)"
+#else
#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
+#endif
+
#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
#if DEFAULT_LIBC == LIBC_UCLIBC
#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
@@ -770,10 +775,30 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
#else
#error "Unsupported DEFAULT_LIBC"
#endif
+
#define GNU_USER_DYNAMIC_LINKER \
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
-#define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
+#ifdef CONFIGURE_STARTFILE_PREFIX
+#ifdef HAVE_LOCAL_CPU_DETECT
+#define LINUX_EXTRA_STATIC_LIBDIRS32 \
+"%{static: \
+%{mcpu=native: %:linux_extra_static_libdirs(%:local_cpu_detect(cpu))} \
+%{!mcpu=native: %{mcpu=*: %:linux_extra_static_libdirs(%{mcpu=*}) }}} "
+
+#else
+#define LINUX_EXTRA_STATIC_LIBDIRS32 \
+"%{static: \
+%{mcpu=: %:linux_extra_static_libdirs(%{mcpu=*}) }} "
+#endif
+
+#else
+#define LINUX_EXTRA_STATIC_LIBDIRS32 ""
+#endif
+
+#define LINK_OS_LINUX_SPEC "-m elf32ppclinux " \
+LINUX_EXTRA_STATIC_LIBDIRS32 \
+"%{!shared: %{!static: \
%{rdynamic:-export-dynamic} \
-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
@@ -839,6 +864,22 @@ ncrtn.o%s"
#define CPP_OS_OPENBSD_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}"
#endif
+/* If we have additional startfiles, we want to use the dynamic linker from the
+ directories those startfiles are in. We also want to set the -rpath for
+ those directories.
+
+ Also if this is a static link, see if we have any processor specific
+ directories in the extra startfiles directories. We don't have to worry
+ about dynamic libraries, since the dynamic linker will include them
+ automatically. */
+#ifdef CONFIGURE_STARTFILE_PREFIX
+extern const char *rs6000_extra_static_libdirs (int argc, const char **argv);
+
+#undef SUBTARGET_EXTRA_SPEC_FUNCTIONS
+#define SUBTARGET_EXTRA_SPEC_FUNCTIONS \
+ { "linux_extra_static_libdirs", rs6000_extra_static_libdirs },
+#endif
+
/* Define any extra SPECS that the compiler needs to generate. */
/* Override rs6000.h definition. */
#undef SUBTARGET_EXTRA_SPECS
diff --git a/gcc/config/rs6000/x-rs6000 b/gcc/config/rs6000/x-rs6000
index 9e31f24cd64..ab526fd2584 100644
--- a/gcc/config/rs6000/x-rs6000
+++ b/gcc/config/rs6000/x-rs6000
@@ -1,3 +1,3 @@
driver-rs6000.o : $(srcdir)/config/rs6000/driver-rs6000.c \
- $(CONFIG_H) $(SYSTEM_H) $(TM_H) coretypes.h
+ $(CONFIG_H) $(SYSTEM_H) $(TM_H) coretypes.h $(GCC_H)
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
diff --git a/gcc/configure b/gcc/configure
index 83998d6511a..a144ad46f22 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -897,6 +897,11 @@ with_multilib_list
enable_rpath
with_libiconv_prefix
enable_sjlj_exceptions
+with_extra_prefix
+with_extra_exec_prefix
+with_extra_startfile_prefix
+with_extra_include_prefix
+with_extra_rpath_prefix
enable_secureplt
enable_leading_mingw64_underscores
enable_cld
@@ -1664,6 +1669,21 @@ Optional Packages:
--with-gnu-ld assume the C compiler uses GNU ld default=no
--with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib
--without-libiconv-prefix don't search for libiconv in includedir and libdir
+ --with-extra-prefix={prefixes}
+ Add extra prefixes to the list of locations to
+ search for all files
+ --with-extra-exec-prefix={prefixes}
+ Add extra prefixes to the list of locations to
+ search for executables
+ --with-extra-startfile-prefix={prefix}
+ Add extra prefixes to the list of locations to
+ search for startfiles
+ --with-extra-include-prefix={prefix}
+ Add extra prefixes to the list of locations to
+ search for system include files
+ --with-extra-rpath-prefix={prefixes}
+ Specify prefixes to pass to the linker via
+ -rpath=dir to locate shared libraries
--with-pic try to use only PIC/non-PIC objects [default=use
both]
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
@@ -11363,6 +11383,99 @@ case "$LIBINTL" in *$LIBICONV*)
LIBICONV= ;;
esac
+
+# Check whether --with-extra-prefix was given.
+if test "${with_extra_prefix+set}" = set; then :
+ withval=$with_extra_prefix; EXTRA_PREFIX="$withval"
+else
+ EXTRA_PREFIX=''
+fi
+
+
+
+# Check whether --with-extra-exec-prefix was given.
+if test "${with_extra_exec_prefix+set}" = set; then :
+ withval=$with_extra_exec_prefix; EXTRA_EXEC_PREFIX="$withval"
+else
+ if test x"${EXTRA_PREFIX}" != x; then
+ EXTRA_EXEC_PREFIX="`echo ${EXTRA_PREFIX} | sed 's/:/\\/bin:/g'`/bin"
+ else
+ EXTRA_EXEC_PREFIX=""
+ fi
+fi
+
+
+if test x"${EXTRA_EXEC_PREFIX}" != x; then
+
+cat >>confdefs.h <<_ACEOF
+#define CONFIGURE_EXEC_PREFIX "$EXTRA_EXEC_PREFIX"
+_ACEOF
+
+fi
+
+
+# Check whether --with-extra-startfile-prefix was given.
+if test "${with_extra_startfile_prefix+set}" = set; then :
+ withval=$with_extra_startfile_prefix; EXTRA_STARTFILE_PREFIX="$withval"
+else
+ if test x"${EXTRA_PREFIX}" != x; then
+ EXTRA_STARTFILE_PREFIX="`echo ${EXTRA_PREFIX} | sed 's/:/\\/lib:/g'`/lib"
+ else
+ EXTRA_STARTFILE_PREFIX=""
+ fi
+fi
+
+
+if test x"${EXTRA_STARTFILE_PREFIX}" != x; then
+
+cat >>confdefs.h <<_ACEOF
+#define CONFIGURE_STARTFILE_PREFIX "$EXTRA_STARTFILE_PREFIX"
+_ACEOF
+
+fi
+
+
+# Check whether --with-extra-include-prefix was given.
+if test "${with_extra_include_prefix+set}" = set; then :
+ withval=$with_extra_include_prefix; EXTRA_INCLUDE_PREFIX="$withval"
+else
+ if test x"${EXTRA_PREFIX}" != x; then
+ EXTRA_INCLUDE_PREFIX="${EXTRA_PREFIX}"
+ else
+ EXTRA_INCLUDE_PREFIX=""
+ fi
+fi
+
+
+if test x"${EXTRA_INCLUDE_PREFIX}" != x; then
+
+cat >>confdefs.h <<_ACEOF
+#define CONFIGURE_INCLUDE_PREFIX "$EXTRA_INCLUDE_PREFIX"
+_ACEOF
+
+fi
+
+
+# Check whether --with-extra-rpath-prefix was given.
+if test "${with_extra_rpath_prefix+set}" = set; then :
+ withval=$with_extra_rpath_prefix; EXTRA_RPATH_PREFIX="$withval"
+else
+ if test x"${EXTRA_PREFIX}" != x; then
+ EXTRA_RPATH_PREFIX="${prefix}/lib:`echo ${EXTRA_PREFIX} | sed 's/:/\\/lib:/g'`/lib"
+ else
+ EXTRA_RPATH_PREFIX=""
+ fi
+fi
+
+
+if test x"${EXTRA_RPATH_PREFIX}" != x; then
+
+cat >>confdefs.h <<_ACEOF
+#define CONFIGURE_RPATH_PREFIX "$EXTRA_RPATH_PREFIX"
+_ACEOF
+
+fi
+
# Check whether --enable-secureplt was given.
if test "${enable_secureplt+set}" = set; then :
enableval=$enable_secureplt;
@@ -17833,7 +17946,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 17836 "configure"
+#line 17949 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -17939,7 +18052,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 17942 "configure"
+#line 18055 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 7e97074c409..9fba69179ba 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1612,6 +1612,72 @@ case "$LIBINTL" in *$LIBICONV*)
LIBICONV= ;;
esac
+AC_ARG_WITH([extra-prefix],
+[AC_HELP_STRING([--with-extra-prefix={prefixes}],
+ [Add extra prefixes to the list of locations to search for all files])],
+ [EXTRA_PREFIX="$withval"],
+ [EXTRA_PREFIX=''])
+
+AC_ARG_WITH([extra-exec-prefix],
+[AC_HELP_STRING([--with-extra-exec-prefix={prefixes}],
+ [Add extra prefixes to the list of locations to search for executables])],
+ [EXTRA_EXEC_PREFIX="$withval"],
+ [if test x"${EXTRA_PREFIX}" != x; then
+ EXTRA_EXEC_PREFIX="`echo ${EXTRA_PREFIX} | sed 's/:/\\/bin:/g'`/bin"
+ else
+ EXTRA_EXEC_PREFIX=""
+ fi])
+
+if test x"${EXTRA_EXEC_PREFIX}" != x; then
+ AC_DEFINE_UNQUOTED(CONFIGURE_EXEC_PREFIX, "$EXTRA_EXEC_PREFIX",
+ [Extra executable prefixes])
+fi
+
+AC_ARG_WITH([extra-startfile-prefix],
+[AC_HELP_STRING([--with-extra-startfile-prefix={prefix}],
+ [Add extra prefixes to the list of locations to search for startfiles])],
+ [EXTRA_STARTFILE_PREFIX="$withval"],
+ [if test x"${EXTRA_PREFIX}" != x; then
+ EXTRA_STARTFILE_PREFIX="`echo ${EXTRA_PREFIX} | sed 's/:/\\/lib:/g'`/lib"
+ else
+ EXTRA_STARTFILE_PREFIX=""
+ fi])
+
+if test x"${EXTRA_STARTFILE_PREFIX}" != x; then
+ AC_DEFINE_UNQUOTED(CONFIGURE_STARTFILE_PREFIX, "$EXTRA_STARTFILE_PREFIX",
+ [Extra startfile prefix])
+fi
+
+AC_ARG_WITH([extra-include-prefix],
+[AC_HELP_STRING([--with-extra-include-prefix={prefix}],
+ [Add extra prefixes to the list of locations to search for system include files])],
+ [EXTRA_INCLUDE_PREFIX="$withval"],
+ [if test x"${EXTRA_PREFIX}" != x; then
+ EXTRA_INCLUDE_PREFIX="${EXTRA_PREFIX}"
+ else
+ EXTRA_INCLUDE_PREFIX=""
+ fi])
+
+if test x"${EXTRA_INCLUDE_PREFIX}" != x; then
+ AC_DEFINE_UNQUOTED(CONFIGURE_INCLUDE_PREFIX, "$EXTRA_INCLUDE_PREFIX",
+ [Extra include file prefix])
+fi
+
+AC_ARG_WITH([extra-rpath-prefix],
+[AC_HELP_STRING([--with-extra-rpath-prefix={prefixes}],
+ [Specify prefixes to pass to the linker via -rpath=dir to locate shared libraries])],
+ [EXTRA_RPATH_PREFIX="$withval"],
+ [if test x"${EXTRA_PREFIX}" != x; then
+ EXTRA_RPATH_PREFIX="${prefix}/lib:`echo ${EXTRA_PREFIX} | sed 's/:/\\/lib:/g'`/lib"
+ else
+ EXTRA_RPATH_PREFIX=""
+ fi])
+
+if test x"${EXTRA_RPATH_PREFIX}" != x; then
+ AC_DEFINE_UNQUOTED(CONFIGURE_RPATH_PREFIX, "$EXTRA_RPATH_PREFIX",
+ [Extra rpath prefix])
+fi
+
AC_ARG_ENABLE(secureplt,
[AS_HELP_STRING([--enable-secureplt],
[enable -msecure-plt by default for PowerPC])],
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 1265129988e..ad7cc9b5812 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -758,6 +758,51 @@ from the full GCC manuals, which are provided in Texinfo format. The manpages
are derived by an automatic conversion process from parts of the full
manual.)
+@item --with-extra-prefix=@var{prefix}
+Specify an additional prefix for finding executables, libraries, and
+startfiles when the compiler is run. By default no extra
+prefixes are used. This option sets the options
+@option{--with-extra-exec-prefix=},
+@option{--with-extra-include-prefix=},
+@option{--with-extra-startfiles-prefix=},
+and @option{--with-extra-rpath-prefix=} if they are not specified.
+
+@item --with-extra-exec-prefix=@var{prefixes}
+Specify additional prefixes for finding executables when the compiler
+is run. Each prefix is separated by the standard path sepator
+(usually colon, @option{:}). By default no extra prefixes are used.
+
+@item --with-extra-include-prefix=@var{prefixes}
+Specify additional prefixes for finding system include files when the
+compiler is run. Each prefix is separated by the standard path
+sepator (usually colon, @option{:}). By default no extra prefixes are
+used.
+
+@item --with-extra-startfile-prefix=@var{prefixes}
+Specify additional prefixes for finding libraries, and startfiles when
+the compiler is run. Each prefix is separated by the standard path
+sepator (usually colon, @option{:}). By default no extra prefixes are
+used.
+
+On powerpc64-linux systems, the dynamic linker will be searched for in
+the directories specified by the prefixed, that is used instead of the
+standard system dynamic linker.
+
+In addition on powerpc64-linux systems, if the user used static
+linking, as well as the @option{-mcpu=} option, the linker will be
+told to search in appropriate directories for libraries that are built
+for that particular machine. If dynamic linking is used, these cpu
+tuned libraries will not be searched, since the dynamic linker will
+load the appropriate cpu tuned library, based on the system that is
+executing the code.
+
+@item --with-extra-rpath-prefix=@var{prefixes}
+Specify additional directories for finding shared libraries when
+the compiler is run. Each prefix is separated by the standard path
+sepator (usually colon, @option{:}). By default no extra prefixes are
+used. If this option is used, each of the directories if they exist
+will be specified to the linker via the @option{-rpath=} option.
+
@item --with-gxx-include-dir=@var{dirname}
Specify
the installation directory for G++ header files. The default depends
diff --git a/gcc/gcc.c b/gcc/gcc.c
index fea73945a52..3cc858cd8be 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -199,6 +199,8 @@ static int access_check (const char *, int);
static char *find_a_file (const struct path_prefix *, const char *, int, bool);
static void add_prefix (struct path_prefix *, const char *, const char *,
int, int, int);
+static void add_multiple_prefix (struct path_prefix *, const char *,
+ const char *, int, int, int);
static void add_sysrooted_prefix (struct path_prefix *, const char *,
const char *, int, int, int);
static char *skip_whitespace (char *);
@@ -258,6 +260,7 @@ static const char *remove_outfile_spec_function (int, const char **);
static const char *version_compare_spec_function (int, const char **);
static const char *include_spec_function (int, const char **);
static const char *find_file_spec_function (int, const char **);
+static const char *find_dynamic_linker_spec_function (int, const char **);
static const char *find_plugindir_spec_function (int, const char **);
static const char *print_asm_header_spec_function (int, const char **);
static const char *compare_debug_dump_opt_spec_function (int, const char **);
@@ -266,6 +269,8 @@ static const char *compare_debug_auxbase_opt_spec_function (int, const char **);
static const char *pass_through_libs_spec_func (int, const char **);
static const char *replace_extension_spec_func (int, const char **);
static char *convert_white_space (char *);
+static const char *extra_rpath_dirs_spec_function (int, const char **);
+const char *extra_cpu_dirs_spec_function (int, const char **);
/* The Specs Language
@@ -722,6 +727,16 @@ proper position among the other output files. */
%{!pie:%{!shared:%e-fsanitize=thread linking must be done with -pie or -shared}}}}}"
#endif
+#ifndef LINK_RPATH_DIRS_SPEC
+#ifdef CONFIGURE_RPATH_PREFIX
+/* Add extra -rpath= options if configured. */
+#define LINK_RPATH_DIRS_SPEC \
+ "%{!nostdlib:%{!nodefaultlibs:%{!static: %:extra-rpath-dirs()}}}"
+#else
+#define LINK_RPATH_DIRS_SPEC
+#endif
+#endif
+
/* -u* was put back because both BSD and SysV seem to support it. */
/* %{static:} simply prevents an error message if the target machine
doesn't handle -static. */
@@ -735,6 +750,7 @@ proper position among the other output files. */
#define LINK_COMMAND_SPEC "\
%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
%(linker) " \
+ LINK_RPATH_DIRS_SPEC \
LINK_PLUGIN_SPEC \
"%{flto|flto=*:%<fcompare-debug*} \
%{flto} %{flto=*} %l " LINK_PIE_SPEC \
@@ -1168,6 +1184,17 @@ static const char *gcc_libexec_prefix;
#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
#endif
+/* Additional directories added at configure time. */
+#ifndef CONFIGURE_INCLUDE_PREFIX
+#define CONFIGURE_INCLUDE_PREFIX ""
+#endif
+#ifndef CONFIGURE_STARTFILE_PREFIX
+#define CONFIGURE_STARTFILE_PREFIX ""
+#endif
+#ifndef CONFIGURE_EXEC_PREFIX
+#define CONFIGURE_EXEC_PREFIX ""
+#endif
+
#ifdef CROSS_DIRECTORY_STRUCTURE /* Don't use these prefixes for a cross compiler. */
#undef MD_EXEC_PREFIX
#undef MD_STARTFILE_PREFIX
@@ -1206,6 +1233,12 @@ static const char *const standard_startfile_prefix_1
= STANDARD_STARTFILE_PREFIX_1;
static const char *const standard_startfile_prefix_2
= STANDARD_STARTFILE_PREFIX_2;
+static const char *const configure_startfile_prefix
+ = CONFIGURE_STARTFILE_PREFIX;
+static const char *const configure_exec_prefix
+ = CONFIGURE_EXEC_PREFIX;
+static const char *const configure_include_prefix
+ = CONFIGURE_INCLUDE_PREFIX;
/* A relative path to be used in finding the location of tools
relative to the driver. */
@@ -1328,6 +1361,7 @@ static const struct spec_function static_spec_functions[] =
{ "version-compare", version_compare_spec_function },
{ "include", include_spec_function },
{ "find-file", find_file_spec_function },
+ { "find-dynamic-linker", find_dynamic_linker_spec_function },
{ "find-plugindir", find_plugindir_spec_function },
{ "print-asm-header", print_asm_header_spec_function },
{ "compare-debug-dump-opt", compare_debug_dump_opt_spec_function },
@@ -1335,6 +1369,8 @@ static const struct spec_function static_spec_functions[] =
{ "compare-debug-auxbase-opt", compare_debug_auxbase_opt_spec_function },
{ "pass-through-libs", pass_through_libs_spec_func },
{ "replace-extension", replace_extension_spec_func },
+ { "extra-rpath-dirs", extra_rpath_dirs_spec_function },
+ { "extra-cpu-dirs", extra_cpu_dirs_spec_function },
#ifdef EXTRA_SPEC_FUNCTIONS
EXTRA_SPEC_FUNCTIONS
#endif
@@ -2528,6 +2564,44 @@ add_prefix (struct path_prefix *pprefix, const char *prefix,
(*prev) = pl;
}
+/* Same as add_prefix, but split the prefix at each PATH_SEPARATOR. */
+static void
+add_multiple_prefix (struct path_prefix *pprefix, const char *prefix,
+ const char *component,
+ /* enum prefix_priority */ int priority,
+ int require_machine_suffix, int os_multilib)
+{
+ const char *startp, *endp;
+ char *nstore = (char *) alloca (strlen (prefix) + 3);
+
+ startp = endp = prefix;
+ while (1)
+ {
+ if (*endp == PATH_SEPARATOR || *endp == 0)
+ {
+ strncpy (nstore, startp, endp - startp);
+ if (endp == startp)
+ strcpy (nstore, concat (".", dir_separator_str, NULL));
+ else if (!IS_DIR_SEPARATOR (endp[-1]))
+ {
+ nstore[endp - startp] = DIR_SEPARATOR;
+ nstore[endp - startp + 1] = 0;
+ }
+ else
+ nstore[endp - startp] = 0;
+ add_prefix (pprefix, nstore, component, priority,
+ require_machine_suffix, os_multilib);
+ if (*endp == 0)
+ break;
+ endp = startp = endp + 1;
+ }
+ else
+ endp++;
+ }
+
+ return;
+}
+
/* Same as add_prefix, but prepending target_system_root to prefix. */
/* The target_system_root prefix has been relocated by gcc_exec_prefix. */
static void
@@ -3778,101 +3852,22 @@ process_command (unsigned int decoded_options_count,
temp = getenv ("COMPILER_PATH");
if (temp)
{
- const char *startp, *endp;
- char *nstore = (char *) alloca (strlen (temp) + 3);
-
- startp = endp = temp;
- while (1)
- {
- if (*endp == PATH_SEPARATOR || *endp == 0)
- {
- strncpy (nstore, startp, endp - startp);
- if (endp == startp)
- strcpy (nstore, concat (".", dir_separator_str, NULL));
- else if (!IS_DIR_SEPARATOR (endp[-1]))
- {
- nstore[endp - startp] = DIR_SEPARATOR;
- nstore[endp - startp + 1] = 0;
- }
- else
- nstore[endp - startp] = 0;
- add_prefix (&exec_prefixes, nstore, 0,
- PREFIX_PRIORITY_LAST, 0, 0);
- add_prefix (&include_prefixes, nstore, 0,
- PREFIX_PRIORITY_LAST, 0, 0);
- if (*endp == 0)
- break;
- endp = startp = endp + 1;
- }
- else
- endp++;
- }
+ add_multiple_prefix (&exec_prefixes, temp, 0,
+ PREFIX_PRIORITY_LAST, 0, 0);
+ add_multiple_prefix (&include_prefixes, temp, 0,
+ PREFIX_PRIORITY_LAST, 0, 0);
}
temp = getenv (LIBRARY_PATH_ENV);
if (temp && *cross_compile == '0')
- {
- const char *startp, *endp;
- char *nstore = (char *) alloca (strlen (temp) + 3);
-
- startp = endp = temp;
- while (1)
- {
- if (*endp == PATH_SEPARATOR || *endp == 0)
- {
- strncpy (nstore, startp, endp - startp);
- if (endp == startp)
- strcpy (nstore, concat (".", dir_separator_str, NULL));
- else if (!IS_DIR_SEPARATOR (endp[-1]))
- {
- nstore[endp - startp] = DIR_SEPARATOR;
- nstore[endp - startp + 1] = 0;
- }
- else
- nstore[endp - startp] = 0;
- add_prefix (&startfile_prefixes, nstore, NULL,
- PREFIX_PRIORITY_LAST, 0, 1);
- if (*endp == 0)
- break;
- endp = startp = endp + 1;
- }
- else
- endp++;
- }
- }
+ add_multiple_prefix (&startfile_prefixes, temp, NULL,
+ PREFIX_PRIORITY_LAST, 0, 1);
/* Use LPATH like LIBRARY_PATH (for the CMU build program). */
temp = getenv ("LPATH");
if (temp && *cross_compile == '0')
- {
- const char *startp, *endp;
- char *nstore = (char *) alloca (strlen (temp) + 3);
-
- startp = endp = temp;
- while (1)
- {
- if (*endp == PATH_SEPARATOR || *endp == 0)
- {
- strncpy (nstore, startp, endp - startp);
- if (endp == startp)
- strcpy (nstore, concat (".", dir_separator_str, NULL));
- else if (!IS_DIR_SEPARATOR (endp[-1]))
- {
- nstore[endp - startp] = DIR_SEPARATOR;
- nstore[endp - startp + 1] = 0;
- }
- else
- nstore[endp - startp] = 0;
- add_prefix (&startfile_prefixes, nstore, NULL,
- PREFIX_PRIORITY_LAST, 0, 1);
- if (*endp == 0)
- break;
- endp = startp = endp + 1;
- }
- else
- endp++;
- }
- }
+ add_multiple_prefix (&startfile_prefixes, temp, NULL,
+ PREFIX_PRIORITY_LAST, 0, 1);
/* Process the options and store input files and switches in their
vectors. */
@@ -4050,6 +4045,19 @@ process_command (unsigned int decoded_options_count,
}
#endif
+ /* Add prefixes specified by configure's --with-prefix. */
+ if (*configure_exec_prefix)
+ add_multiple_prefix (&exec_prefixes, configure_exec_prefix, "GCC",
+ PREFIX_PRIORITY_LAST, 0, 0);
+
+ if (*configure_include_prefix)
+ add_multiple_prefix (&include_prefixes, configure_include_prefix,
+ "GCC", PREFIX_PRIORITY_LAST, 0, 1);
+
+ if (*configure_startfile_prefix)
+ add_multiple_prefix (&startfile_prefixes, configure_startfile_prefix,
+ "GCC", PREFIX_PRIORITY_LAST, 0, 1);
+
/* More prefixes are enabled in main, after we read the specs file
and determine whether this is cross-compilation or not. */
@@ -8253,7 +8261,6 @@ find_file_spec_function (int argc, const char **argv)
return file;
}
-
/* %:find-plugindir spec function. This function replaces its argument
by the -iplugindir=<dir> option. `dir' is found through find_file, that
is the -print-file-name gcc program option. */
@@ -8590,3 +8597,232 @@ convert_white_space (char *orig)
else
return orig;
}
+
+#define IS_STD_DIR(PATH,STD) (strncmp (PATH, STD, sizeof (STD)-1) == 0)
+
+#ifdef CONFIGURE_RPATH_PREFIX
+
+static const char config_rpath[] = CONFIGURE_RPATH_PREFIX;
+
+/* Common code for extra_rpath_dirs_spec_function and
+ extra_cpu_dirs_spec_function to build up a list of -rpath-link=<dir> or
+ -L<dir> options, based on the extra rpath directories that were configured
+ in. */
+
+static char *
+build_rpath_or_cpu_dirs (const char *rpath_dirs,
+ const char *global_prefix,
+ const char *prefix,
+ const char *sep,
+ const char *subdir)
+{
+ char *ret = NULL;
+ char *tmpstr, *endp, *prev_dir;
+ size_t rpath_len = strlen (rpath_dirs);
+ size_t subdir_len = (subdir) ? strlen (subdir) : 0;
+ size_t mlib_len = (multilib_os_dir) ? strlen (multilib_os_dir) : 0;
+ bool mlib_updir;
+ size_t i;
+
+ mlib_updir = (DIR_SEPARATOR == '/'
+ && mlib_len > sizeof ("../") - 1
+ && multilib_os_dir[0] == '.'
+ && multilib_os_dir[1] == '.'
+ && multilib_os_dir[2] == '/');
+
+ endp = tmpstr = XALLOCAVEC (char, rpath_len + subdir_len + mlib_len + 4);
+ prev_dir = NULL;
+ for (i = 0; i <= rpath_len; i++)
+ {
+ int ch = rpath_dirs[i];
+ if (ch != PATH_SEPARATOR && ch != '\0')
+ {
+ *endp++ = ch;
+ if (ch == DIR_SEPARATOR)
+ prev_dir = endp;
+ }
+ else if (endp > tmpstr)
+ {
+ /* Add current multlib directory. Convert <stuff>/lib/../lib64 into
+ <stuff>/lib64. */
+ if (mlib_len > 0)
+ {
+ if (mlib_updir && prev_dir)
+ {
+ memcpy (prev_dir, multilib_os_dir + 3, mlib_len - 3);
+ endp = prev_dir + mlib_len - 3;
+ }
+ else
+ {
+ *endp = DIR_SEPARATOR;
+ memcpy (endp+1, multilib_os_dir, mlib_len);
+ endp += mlib_len + 1;
+ }
+ }
+
+ /* Look for machine specific subdir? */
+ if (subdir)
+ {
+ *endp = DIR_SEPARATOR;
+ memcpy (endp+1, subdir, subdir_len);
+ endp += subdir_len + 1;
+ }
+
+ endp[0] = DIR_SEPARATOR;
+ endp[1] = '.';
+ endp[2] = '\0';
+
+ if (is_directory (tmpstr, false))
+ {
+ *endp = '\0';
+ if (ret)
+ ret = reconcat (ret, ret, sep, prefix, tmpstr, NULL);
+ else if (global_prefix)
+ ret = concat (global_prefix, prefix, tmpstr, NULL);
+ else
+ ret = concat (prefix, tmpstr, NULL);
+ }
+
+ endp = tmpstr;
+ }
+ }
+
+ return ret;
+}
+
+static const char path_sep[2] = { PATH_SEPARATOR, '\0' };
+
+/* Return an rpath to use for creating extra rpath dirs or cpu dirs. If this
+ is a native compiler, update LD_RUN_PATH to include the extra rpath
+ directories. */
+
+static const char *
+get_rpath_dirs (void)
+{
+ static const char *rpath_with_env = config_rpath;
+
+#ifndef CROSS_DIRECTORY_STRUCTURE
+ /* If we are not cross compiling, update the LD_RUN_PATH environment
+ variable. */
+ static const char *ld_run_path = NULL;
+
+ if (!ld_run_path)
+ {
+ const char *cur_ld_run_path = getenv ("LD_RUN_PATH");
+ if (cur_ld_run_path)
+ rpath_with_env = concat (cur_ld_run_path, path_sep, config_rpath, NULL);
+
+ ld_run_path = build_rpath_or_cpu_dirs (rpath_with_env, "LD_RUN_PATH=",
+ "", path_sep, NULL);
+ xputenv (ld_run_path);
+ }
+#endif
+
+ return rpath_with_env;
+}
+
+/* %:extra-rpath-dirs spec function. If we have alternate rpath directories
+ (install lib directory + alternate startfile prefix directories), build a
+ string with all of the directories that are found with appropriate
+ -rpath-link options for the linker. On native builds, use and update the
+ LD_RUN_PATH environment variable as well as using -rpath-link. If the user
+ uses explicit -rpath=<dir>, then those will override these values. */
+
+static const char *
+extra_rpath_dirs_spec_function (int argc, const char **argv ATTRIBUTE_UNUSED)
+{
+ if (argc != 0)
+ abort ();
+
+ return build_rpath_or_cpu_dirs (get_rpath_dirs (), NULL, "-rpath-link=", " ",
+ NULL);
+}
+
+/* %:extra-cpu-dirs spec function. If we have alternate rpath directories,
+ search them to see if there are subdirectories that hold the static
+ libraries built for a particular machines, and return appropriate -L<dir>
+ to those directories. */
+
+const char *
+extra_cpu_dirs_spec_function (int argc, const char **argv)
+{
+ if (argc != 1)
+ abort ();
+
+ return build_rpath_or_cpu_dirs (get_rpath_dirs (), NULL, "-L", " ", argv[0]);
+}
+
+/* %:find-dynamic-linker spec function. Find the dynamic linker if we have
+ extra search paths configured. */
+
+static const char *
+find_dynamic_linker_spec_function (int argc, const char **argv)
+{
+ const char *file;
+ char *tmpstr;
+ char *endp;
+ char *prev_dir;
+ size_t len;
+ size_t i;
+ int ch;
+
+ if (argc < 1)
+ abort ();
+
+ file = argv[0];
+ len = strlen (file);
+ gcc_assert (file[0] == DIR_SEPARATOR);
+
+ endp = tmpstr = XALLOCAVEC (char, ARRAY_SIZE (config_rpath) + len + 1);
+ prev_dir = NULL;
+ for (i = 0; i <= ARRAY_SIZE (config_rpath); i++)
+ {
+ ch = config_rpath[i];
+ if (ch != PATH_SEPARATOR && ch != '\0')
+ {
+ if (ch == DIR_SEPARATOR)
+ prev_dir = endp;
+
+ *endp++ = ch;
+ }
+ else if (endp > tmpstr)
+ {
+ *endp = '\0';
+ if (prev_dir && strncmp (prev_dir, "/lib", sizeof ("/lib")-1) == 0)
+ endp = prev_dir;
+ memcpy (endp, file, len);
+ endp[len] = '\0';
+ if (access (tmpstr, X_OK) == 0)
+ return xstrdup (tmpstr);
+
+ endp = tmpstr;
+ }
+ }
+
+ return xstrdup (file);
+}
+
+#else
+const char *
+extra_rpath_dirs_spec_function (int argc ATTRIBUTE_UNUSED,
+ const char **argv ATTRIBUTE_UNUSED)
+{
+ return NULL;
+}
+
+const char *
+extra_cpu_dirs_spec_function (int argc ATTRIBUTE_UNUSED,
+ const char **argv ATTRIBUTE_UNUSED)
+{
+ return NULL;
+}
+
+static const char *
+find_dynamic_linker_spec_function (int argc, const char **argv)
+{
+ if (argc != 1)
+ abort ();
+
+ return xstrdup (argv[0]);
+}
+#endif
diff --git a/gcc/gcc.h b/gcc/gcc.h
index 8a96b9acf4a..d31b679b88e 100644
--- a/gcc/gcc.h
+++ b/gcc/gcc.h
@@ -36,6 +36,7 @@ extern int do_spec (const char *);
extern void record_temp_file (const char *, int, int);
extern void pfatal_with_name (const char *) ATTRIBUTE_NORETURN;
extern void set_input (const char *);
+extern const char *extra_cpu_dirs_spec_function (int, const char **);
/* Spec files linked with gcc.c must provide definitions for these. */