mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 18:21:39 +01:00
Some systems have python-config include -D_FORTIFY_SOURCE in the
CFLAGS. But -D_FORTIFY_SOURCE does not (currently) work with -O0, and
-O0 is enabled in debug builds (since 1166ecf781). As a result, on
those systems, debug builds fail.
Work around this problem as follows:
* In configure, detect -D_FORTIFY_SOURCE in $(python-config --cflags)
* If detected, set the new autoconf substitution and make variable
PY_NOOPT_CFLAGS to -O1.
* In tools/Rules.mk, where we add -O0, also add PY_NOOPT_CFLAGS
(which will override the -O0 with -O1 if required).
Overriding the -O0 is better than disabling Fortify because the
latter might have an adverse security impact. A user who wants to
disable optimisation completely even for Python and also disable
Fortify can set the environment variable
EXTRA_CFLAGS_XEN_TOOLS='-U_FORTIFY_SOURCE -O0'
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Reported-by: Jan Beulich <JBeulich@suse.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
CC: Jan Beulich <JBeulich@suse.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Euan Harris <euan.harris@citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Tested-by: Don Slutz <dslutz@verizon.com>
37 lines
934 B
Makefile
37 lines
934 B
Makefile
XEN_ROOT = $(CURDIR)/../..
|
|
include $(XEN_ROOT)/tools/Rules.mk
|
|
|
|
.PHONY: all
|
|
all: build
|
|
|
|
PY_CFLAGS = $(CFLAGS) $(PY_NOOPT_CFLAGS) $(LDFLAGS) $(APPEND_LDFLAGS)
|
|
|
|
.PHONY: build
|
|
build: genwrap.py $(XEN_ROOT)/tools/libxl/libxl_types.idl \
|
|
$(XEN_ROOT)/tools/libxl/idl.py
|
|
PYTHONPATH=$(XEN_ROOT)/tools/libxl $(PYTHON) genwrap.py \
|
|
$(XEN_ROOT)/tools/libxl/libxl_types.idl \
|
|
xen/lowlevel/xl/_pyxl_types.h \
|
|
xen/lowlevel/xl/_pyxl_types.c
|
|
CC="$(CC)" CFLAGS="$(PY_CFLAGS)" $(PYTHON) setup.py build
|
|
|
|
.PHONY: install
|
|
install:
|
|
CC="$(CC)" CFLAGS="$(PY_CFLAGS)" $(PYTHON) setup.py install \
|
|
$(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" --force
|
|
|
|
.PHONY: test
|
|
test:
|
|
export LD_LIBRARY_PATH=$$(readlink -f ../libxc):$$(readlink -f ../xenstore); $(PYTHON) test.py -b -u
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
find . \( -name "*.py[ocd]" -o -name "*~" -o -name "_*.[hc]" \) -delete
|
|
rm -rf build/
|
|
rm -f $(DEPS)
|
|
|
|
.PHONY: distclean
|
|
distclean: clean
|
|
|
|
-include $(DEPS)
|