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]

Re: [gold] PATCH: Filter out -Wp,-D_FORTIFY_SOURCE=. with -O0


On Thu, Oct 25, 2012 at 2:06 PM, Ian Lance Taylor <iant@google.com> wrote:
> On Thu, Oct 25, 2012 at 1:45 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>
>>> Is there any reason to think that people are likely to do this?  It
>>> hardly seems worth it.
>>>
>>
>> Fedora builds binutils rpm with it.
>
> That in conjunction with the -O0 warning seems to me to be insane.
>
> OK, can you write a patch that simply removes the -Wp,-D_FORTIFY_SRC
> option from all testsuite builds?  I don't see any reason to make the
> gold testsuite more complex by sometimes using CXXCOMPILE and
> sometimes using CXXCOMPILE_NFORTIFY.  The use of _FORTIFY_SRC is
> irrelevant for the gold testsuite.
>
> Also needs a comment explaining why this is necessary.
>
> Ian

Here is a patch.  COMPILE1, LINK1, CXXCOMPILE1, CXXLINK1 are
renamed from COMPILE, LINK, CXXCOMPILE and CXXLINK generated
 by automake 1.11.1 so that these are only only changes in Makefile.am.
But we need to update them if they are ever changed by newer automake
used by future binutils.  OK to install?

Thanks.


-- 
H.J.
---
2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>

	* testsuite/Makefile.am (COMPILE1): New variable. Renamed from
	COMPILE generated by automake.
	(LINK1): Likewise.
	(CXXCOMPILE1): Likewise.
	(CXXLINK1): Likewise.
	(COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
	(LINK): Likewise.
	(CXXCOMPILE): Likewise.
	(CXXLINK): Likewise.
	* testsuite/Makefile.in: Regenerated.

diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
index 8bb16b6..64e36e4 100644
--- a/gold/testsuite/Makefile.am
+++ b/gold/testsuite/Makefile.am
@@ -19,6 +19,25 @@ AM_CPPFLAGS = \
 	-DLOCALEDIR="\"$(datadir)/locale\"" \
 	@INCINTL@

+# 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 $@
+CXXCOMPILE1 = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLINK1 = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+	-o $@
+
+# Strip out -Wp,-D_FORTIFY_SOURCE=, which is rrelevant 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]]*//'`
+LINK = `echo $(LINK1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
+CXXCOMPILE = `echo $(CXXCOMPILE1) | sed -e
's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
+CXXLINK = `echo $(CXXLINK1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
+
 TEST_READELF = $(top_builddir)/../binutils/readelf
 TEST_OBJDUMP = $(top_builddir)/../binutils/objdump
 TEST_OBJCOPY = $(top_builddir)/../binutils/objcopy
diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
index 80aeb09..3a9cf0c 100644
--- a/gold/testsuite/Makefile.in
+++ b/gold/testsuite/Makefile.in
@@ -1697,15 +1697,8 @@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/../depcomp
 am__depfiles_maybe = depfiles
 am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 CCLD = $(CC)
-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
 CXXLD = $(CXX)
-CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-	-o $@
 SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c basic_pie_test.c \
 	basic_static_pic_test.c basic_static_test.c basic_test.c \
 	$(binary_test_SOURCES) $(binary_unittest_SOURCES) \
@@ -2007,6 +2000,28 @@ AM_CPPFLAGS = \
 	-DLOCALEDIR="\"$(datadir)/locale\"" \
 	@INCINTL@

+
+# 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 $@
+CXXCOMPILE1 = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+
+CXXLINK1 = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+	-o $@
+
+
+# Strip out -Wp,-D_FORTIFY_SOURCE=, which is rrelevant 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]]*//'`
+LINK = `echo $(LINK1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
+CXXCOMPILE = `echo $(CXXCOMPILE1) | sed -e
's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
+CXXLINK = `echo $(CXXLINK1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
 TEST_READELF = $(top_builddir)/../binutils/readelf
 TEST_OBJDUMP = $(top_builddir)/../binutils/objdump
 TEST_OBJCOPY = $(top_builddir)/../binutils/objcopy


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