about summary refs log tree commit diff
path: root/Makeconfig
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2016-07-05 15:01:33 -0700
committerH.J. Lu <hjl.tools@gmail.com>2016-07-05 15:01:46 -0700
commit8321286846970af562a2ff6b7272f1cd0860d6c1 (patch)
treef55e67f1454183794137df937393b034589a30a7 /Makeconfig
parent00068ce40c3885ae0598e55a163632d78dfe42bf (diff)
downloadglibc-8321286846970af562a2ff6b7272f1cd0860d6c1.tar.gz
glibc-8321286846970af562a2ff6b7272f1cd0860d6c1.tar.xz
glibc-8321286846970af562a2ff6b7272f1cd0860d6c1.zip
Make copies of cstdlib/cmath and use them [BZ #20314]
If C++ headers <cstdlib> or <cmath> are used, GCC 6 will include
/usr/include/stdlib.h or /usr/include/math.h from "#include_next"
(instead of stdlib/stdlib.h or math/math.h in the glibc source
directory), and this turns up as a make dependency.  An implicit
rule will kick in and make will try to install stdlib/stdlib.h or
math/math.h as /usr/include/stdlib.h or /usr/include/math.h because
the target is out of date.  We make a copy of <cstdlib> and <cmath>
in the glibc build directory so that stdlib/stdlib.h and math/math.h
will be used instead of /usr/include/stdlib.h and /usr/include/math.h.

	[BZ #20314]
	* Makeconfig (CXXFLAGS): Prepend -I$(common-objpfx).
	* Makerules (before-compile): Add $(common-objpfx)cstdlib and
	$(common-objpfx)cmath.
	($(common-objpfx)cstdlib): New target.
	($(common-objpfx)cmath): Likewise.
Diffstat (limited to 'Makeconfig')
-rw-r--r--Makeconfig3
1 files changed, 2 insertions, 1 deletions
diff --git a/Makeconfig b/Makeconfig
index 901e253453..03fd89c13e 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -889,7 +889,8 @@ override CFLAGS	= -std=gnu11 -fgnu89-inline $(config-extra-cflags) \
 		  $(CFLAGS-$(@F)) $(tls-model) \
 		  $(foreach lib,$(libof-$(basename $(@F))) \
 				$(libof-$(<F)) $(libof-$(@F)),$(CFLAGS-$(lib)))
-override CXXFLAGS = $(c++-sysincludes) \
+# Use our copies of cstdlib and cmath.
+override CXXFLAGS = -I$(common-objpfx) $(c++-sysincludes) \
 		    $(filter-out %frame-pointer,$(+cflags)) $(sysdep-CFLAGS) \
 		    $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) $(CFLAGS-$(@F))