Skip to content

Commit

Permalink
Fix Arch build on conflicting _FORTIFY_SOURCE values
Browse files Browse the repository at this point in the history
  • Loading branch information
marmarek committed Jul 18, 2024
1 parent 31c52f7 commit 481b198
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
40 changes: 40 additions & 0 deletions 0653-python-avoid-conflicting-_FORTIFY_SOURCE-values.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
From 5e9e49c4f0ed9c54b63bf99d7b6a013005f94865 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?=
<[email protected]>
Date: Fri, 19 Jul 2024 01:15:13 +0200
Subject: [PATCH] python: avoid conflicting _FORTIFY_SOURCE values
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The compile flags are combined from python's build config (sysconfig
module) and CFLAGS environment. If both define the _FORTIFY_SOURCE but
to different values, the build will fail. This is the case on Arch,
where Python's sysconfig has -D_FORTIFY_SOURCE=2, while Arch's
makepkg.conf has -D_FORTIFY_SOURCE=3. Resolve the config by undefining
_FORTIFY_SOURCE first, and use the value from the CFLAGS environment.
Details:
https://setuptools.pypa.io/en/latest/userguide/ext_modules.html

Signed-off-by: Marek Marczykowski-Górecki <[email protected]>
---
tools/python/setup.py | 3 +++
1 file changed, 3 insertions(+)

diff --git a/tools/python/setup.py b/tools/python/setup.py
index 02354f698653..a73c95a9e766 100644
--- a/tools/python/setup.py
+++ b/tools/python/setup.py
@@ -20,6 +20,9 @@ PATH_LIBXENCTRL = XEN_ROOT + "/tools/libs/ctrl"
PATH_LIBXENGUEST = XEN_ROOT + "/tools/libs/guest"
PATH_XENSTORE = XEN_ROOT + "/tools/libs/store"

+if "-D_FORTIFY_SOURCE=" in os.environ.get("CFLAGS", ""):
+ os.environ["CFLAGS"] = "-Wp,-U_FORTIFY_SOURCE " + os.environ["CFLAGS"]
+
xc = Extension("xc",
extra_compile_args = extra_compile_args,
include_dirs = [ PATH_XEN,
--
2.45.2

1 change: 1 addition & 0 deletions archlinux/PKGBUILD.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ makedepends=(wget make gcc patch git iasl pkg-config openssl pixman python-setup
provides=('xen-qubes-vm-essentials')

_patches=(
0653-python-avoid-conflicting-_FORTIFY_SOURCE-values.patch
1000-Do-not-access-network-during-the-build.patch
1001-hotplug-store-block-params-for-cleanup.patch
1020-xen-tools-qubes-vm.patch
Expand Down
2 changes: 2 additions & 0 deletions xen.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ Patch0643: 0643-cpufreq-enable-HWP-by-default.patch
PAtch0651: 0651-x86-msi-passthrough-all-MSI-X-vector-ctrl-writes-to-.patch
PAtch0652: 0652-x86-hvm-Allow-writes-to-registers-on-the-same-page-a.patch

Patch0653: 0653-python-avoid-conflicting-_FORTIFY_SOURCE-values.patch

# S0ix support
Patch0670: 0670-x86-hpet-Disable-legacy-replacement-mode-after-test-.patch
Patch0671: 0671-x86-idle-Get-PC-8.10-counters-for-Tiger-and-Alder-La.patch
Expand Down

0 comments on commit 481b198

Please sign in to comment.