This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gold commit] Modify gold testsuite to disable plugins added by GCC driver


GCC 4.8 now adds linker plugin options by default, which conflict with the
--incremental tests in the testsuite. This patch checks whether the compiler
supports the -fno-use-linker-plugin option, and adds it to all link
commands.

-cary


2014-04-02  Cary Coutant  <ccoutant@google.com>

gold/
	* configure.ac (HAVE_PUBNAMES): Use C instead of C++.
	(HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
	* configure: Regenerate.
	* testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
	-fno-use-linker-plugin.
	(LINK1, CXXLINK1): Add it to the link command.
	* testsuite/Makefile.in: Regenerate.


diff --git a/gold/configure.ac b/gold/configure.ac
index 803cf46..7ad7302 100644
--- a/gold/configure.ac
+++ b/gold/configure.ac
@@ -520,6 +520,25 @@ dnl multiple declarations of functions like basename when compiling
 dnl with C++.
 AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf, snprintf, vsnprintf, strverscmp])
 
+dnl Check if gcc supports the -gpubnames option.
+dnl Use -Werror in case of compilers that make unknown -g options warnings.
+dnl They would pass the test here, but fail in actual use when $WARN_CFLAGS
+dnl gets set later by default Autoconf magic to include -Werror.  (We are
+dnl assuming here that there is no compiler that groks -gpubnames
+dnl but does not grok -Werror.)
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Werror -gpubnames"
+AC_COMPILE_IFELSE([int i;], [have_pubnames=yes], [have_pubnames=no])
+CFLAGS="$save_CFLAGS"
+AM_CONDITIONAL(HAVE_PUBNAMES, test "$have_pubnames" = "yes")
+
+dnl Check if gcc supports the -fno-use-linker-plugin option.
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Werror -fno-use-linker-plugin"
+AC_COMPILE_IFELSE([int i;], [have_no_use_linker_plugin=yes], [have_no_use_linker_plugin=no])
+CFLAGS="$save_CFLAGS"
+AM_CONDITIONAL(HAVE_NO_USE_LINKER_PLUGIN, test "$have_no_use_linker_plugin" = "yes")
+
 AC_LANG_PUSH(C++)
 
 AC_CHECK_HEADERS(unordered_set unordered_map)
@@ -601,18 +620,6 @@ if test "$gold_cv_stat_st_mtim" = "yes"; then
 	    [Define if struct stat has a field st_mtim with timespec for mtime])
 fi
 
-dnl Check if gcc supports the -gpubnames option.
-dnl Use -Werror in case of compilers that make unknown -g options warnings.
-dnl They would pass the test here, but fail in actual use when $WARN_CFLAGS
-dnl gets set later by default Autoconf magic to include -Werror.  (We are
-dnl assuming here that there is no compiler that groks -gpubnames
-dnl but does not grok -Werror.)
-save_CXXFLAGS="$CXXFLAGS"
-CXXFLAGS="$CXXFLAGS -Werror -gpubnames"
-AC_COMPILE_IFELSE([int i;], [have_pubnames=yes], [have_pubnames=no])
-CXXFLAGS="$save_CXXFLAGS"
-AM_CONDITIONAL(HAVE_PUBNAMES, test "$have_pubnames" = "yes")
-
 AC_LANG_POP(C++)
 
 AC_CHECK_HEADERS(locale.h)
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
index aa41290..52cc05e 100644
--- a/gold/testsuite/Makefile.am
+++ b/gold/testsuite/Makefile.am
@@ -19,18 +19,25 @@ AM_CPPFLAGS = \
 	-DLOCALEDIR="\"$(datadir)/locale\"" \
 	@INCINTL@
 
+# Some versions of GCC now automatically enable linker plugins,
+# but we want to run our tests without GCC's plugins.
+if HAVE_NO_USE_LINKER_PLUGIN
+OPT_NO_PLUGINS = -fno-use-linker-plugin
+endif
+
 # COMPILE1, LINK1, CXXCOMPILE1, CXXLINK1 are renamed from COMPILE, LINK,
 # CXXCOMPILE and CXXLINK generated by automake 1.11.1.  FIXME: they should
 # be updated if they are different from automake used by gold.
 COMPILE1 = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LINK1 = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+LINK1 = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(OPT_NO_PLUGINS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
 CXXCOMPILE1 = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
 	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
-CXXLINK1 = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-	-o $@
+CXXLINK1 = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(OPT_NO_PLUGINS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
 
-# Strip out -Wp,-D_FORTIFY_SOURCE=, which is rrelevant for the gold
+# Strip out -Wp,-D_FORTIFY_SOURCE=, which is irrelevant for the gold
 # testsuite and incompatible with -O0 used in gold tests, from
 # COMPILE, LINK, CXXCOMPILE and CXXLINK.
 COMPILE = `echo $(COMPILE1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9[0-9]]*//'`


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]