From: "Jan Beulich" Subject: [PATCH] tools: work around collision of -O0 and -D_FORTIFY_SOURCE Date: Wed, 04 Feb 2015 17:01:57 +0000 Message-ID: <54D25E95020000780005CFD8@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part2B1EA095.2__=" Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YJ3Ky-0002ZB-AK for xen-devel@lists.xenproject.org; Wed, 04 Feb 2015 17:02:00 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Ian Campbell , Ian Jackson , Wei Liu , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part2B1EA095.2__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline The former gets enforced by our debug builds, the latter appears to be not uncommon for certain distros' Python packages. Newer glibc warns on uses of _FORTIFY_SOURCE without optimization being enabled, which with -Werror causes the build to fail. Determine Python's intended flags to be passed to the C compiler via "python-config --cflags", and replace -O0 by -O1 when a non-zero value gets set for _FORTIFY_SOURCE. Signed-off-by: Jan Beulich --- a/tools/pygrub/Makefile +++ b/tools/pygrub/Makefile @@ -2,15 +2,24 @@ XEN_ROOT =3D $(CURDIR)/../.. include $(XEN_ROOT)/tools/Rules.mk =20 +py_cflags :=3D $(shell $(PYTHON)-config --cflags) +PY_CFLAGS =3D $(if $(strip $(py_cflags)),,\ + $(error '$(PYTHON)-config --cflags' produced no = output))\ + $(if $(filter -D_FORTIFY_SOURCE=3D%,\ + $(filter-out -D_FORTIFY_SOURCE=3D0,\ + $(py_cflags))),\ + $(patsubst -O0,-O1,$(CFLAGS)),\ + $(CFLAGS)) $(APPEND_LDFLAGS) + .PHONY: all all: build .PHONY: build build: - CC=3D"$(CC)" CFLAGS=3D"$(CFLAGS) $(APPEND_LDFLAGS)" $(PYTHON) = setup.py build + CC=3D"$(CC)" CFLAGS=3D"$(PY_CFLAGS)" $(PYTHON) setup.py build =20 .PHONY: install install: all - CC=3D"$(CC)" CFLAGS=3D"$(CFLAGS) $(APPEND_LDFLAGS)" $(PYTHON) = setup.py install \ + CC=3D"$(CC)" CFLAGS=3D"$(PY_CFLAGS)" $(PYTHON) setup.py install \ $(PYTHON_PREFIX_ARG) --root=3D"$(DESTDIR)" \ --install-scripts=3D$(LIBEXEC_BIN) --force set -e; if [ $(BINDIR) !=3D $(LIBEXEC_BIN) -a \ --- a/tools/python/Makefile +++ b/tools/python/Makefile @@ -4,6 +4,15 @@ include $(XEN_ROOT)/tools/Rules.mk .PHONY: all all: build =20 +py_cflags :=3D $(shell $(PYTHON)-config --cflags) +PY_CFLAGS =3D $(if $(strip $(py_cflags)),,\ + $(error '$(PYTHON)-config --cflags' produced no = output))\ + $(if $(filter -D_FORTIFY_SOURCE=3D%,\ + $(filter-out -D_FORTIFY_SOURCE=3D0,\ + $(py_cflags))),\ + $(patsubst -O0,-O1,$(CFLAGS)),\ + $(CFLAGS)) $(LDFLAGS) $(APPEND_LDFLAGS) + .PHONY: build build: genwrap.py $(XEN_ROOT)/tools/libxl/libxl_types.idl \ $(XEN_ROOT)/tools/libxl/idl.py @@ -11,11 +20,11 @@ build: genwrap.py $(XEN_ROOT)/tools/libx $(XEN_ROOT)/tools/libxl/libxl_types.idl \ xen/lowlevel/xl/_pyxl_types.h \ xen/lowlevel/xl/_pyxl_types.c - CC=3D"$(CC)" CFLAGS=3D"$(CFLAGS) $(LDFLAGS) $(APPEND_LDFLAGS)" = $(PYTHON) setup.py build + CC=3D"$(CC)" CFLAGS=3D"$(PY_CFLAGS)" $(PYTHON) setup.py build =20 .PHONY: install install: - CC=3D"$(CC)" CFLAGS=3D"$(CFLAGS) $(LDFLAGS) $(APPEND_LDFLAGS)" = $(PYTHON) setup.py install \ + CC=3D"$(CC)" CFLAGS=3D"$(PY_CFLAGS)" $(PYTHON) setup.py install \ $(PYTHON_PREFIX_ARG) --root=3D"$(DESTDIR)" --force =20 .PHONY: test --=__Part2B1EA095.2__= Content-Type: text/plain; name="tools-python-build.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="tools-python-build.patch" tools: work around collision of -O0 and -D_FORTIFY_SOURCE=0A=0AThe former = gets enforced by our debug builds, the latter appears to be=0Anot uncommon = for certain distros' Python packages. Newer glibc warns on=0Auses of = _FORTIFY_SOURCE without optimization being enabled, which with=0A-Werror = causes the build to fail.=0A=0ADetermine Python's intended flags to be = passed to the C compiler via=0A"python-config --cflags", and replace -O0 = by -O1 when a non-zero value=0Agets set for _FORTIFY_SOURCE.=0A=0ASigned-of= f-by: Jan Beulich =0A=0A--- a/tools/pygrub/Makefile=0A++= + b/tools/pygrub/Makefile=0A@@ -2,15 +2,24 @@=0A XEN_ROOT =3D $(CURDIR)/../= ..=0A include $(XEN_ROOT)/tools/Rules.mk=0A =0A+py_cflags :=3D $(shell = $(PYTHON)-config --cflags)=0A+PY_CFLAGS =3D $(if $(strip $(py_cflags)),,\= =0A+ $(error '$(PYTHON)-config --cflags' produced no = output))\=0A+ $(if $(filter -D_FORTIFY_SOURCE=3D%,\=0A+ = $(filter-out -D_FORTIFY_SOURCE=3D0,\=0A+ = $(py_cflags))),\=0A+ $(patsubst = -O0,-O1,$(CFLAGS)),\=0A+ $(CFLAGS)) $(APPEND_LDFLAGS)=0A+= =0A .PHONY: all=0A all: build=0A .PHONY: build=0A build:=0A- CC=3D"$(CC)= " CFLAGS=3D"$(CFLAGS) $(APPEND_LDFLAGS)" $(PYTHON) setup.py build=0A+ = CC=3D"$(CC)" CFLAGS=3D"$(PY_CFLAGS)" $(PYTHON) setup.py build=0A =0A = .PHONY: install=0A install: all=0A- CC=3D"$(CC)" CFLAGS=3D"$(CFLAGS) = $(APPEND_LDFLAGS)" $(PYTHON) setup.py install \=0A+ CC=3D"$(CC)" = CFLAGS=3D"$(PY_CFLAGS)" $(PYTHON) setup.py install \=0A = $(PYTHON_PREFIX_ARG) --root=3D"$(DESTDIR)" \=0A --install-s= cripts=3D$(LIBEXEC_BIN) --force=0A set -e; if [ $(BINDIR) !=3D = $(LIBEXEC_BIN) -a \=0A--- a/tools/python/Makefile=0A+++ b/tools/python/Make= file=0A@@ -4,6 +4,15 @@ include $(XEN_ROOT)/tools/Rules.mk=0A .PHONY: = all=0A all: build=0A =0A+py_cflags :=3D $(shell $(PYTHON)-config = --cflags)=0A+PY_CFLAGS =3D $(if $(strip $(py_cflags)),,\=0A+ = $(error '$(PYTHON)-config --cflags' produced no output))\=0A+ = $(if $(filter -D_FORTIFY_SOURCE=3D%,\=0A+ = $(filter-out -D_FORTIFY_SOURCE=3D0,\=0A+ = $(py_cflags))),\=0A+ $(patsubst -O0,-O1,$(CFLAGS)),\=0A= + $(CFLAGS)) $(LDFLAGS) $(APPEND_LDFLAGS)=0A+=0A .PHONY: = build=0A build: genwrap.py $(XEN_ROOT)/tools/libxl/libxl_types.idl \=0A = $(XEN_ROOT)/tools/libxl/idl.py=0A@@ -11,11 +20,11 @@ build: = genwrap.py $(XEN_ROOT)/tools/libx=0A $(XEN_ROOT)/tools/libxl/lib= xl_types.idl \=0A xen/lowlevel/xl/_pyxl_types.h \=0A = xen/lowlevel/xl/_pyxl_types.c=0A- CC=3D"$(CC)" CFLAGS=3D"$(CFLAGS) = $(LDFLAGS) $(APPEND_LDFLAGS)" $(PYTHON) setup.py build=0A+ CC=3D"$(CC)= " CFLAGS=3D"$(PY_CFLAGS)" $(PYTHON) setup.py build=0A =0A .PHONY: = install=0A install:=0A- CC=3D"$(CC)" CFLAGS=3D"$(CFLAGS) $(LDFLAGS) = $(APPEND_LDFLAGS)" $(PYTHON) setup.py install \=0A+ CC=3D"$(CC)" = CFLAGS=3D"$(PY_CFLAGS)" $(PYTHON) setup.py install \=0A = $(PYTHON_PREFIX_ARG) --root=3D"$(DESTDIR)" --force=0A =0A .PHONY: test=0A --=__Part2B1EA095.2__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part2B1EA095.2__=--