summaryrefslogtreecommitdiffstats
path: root/mkosi.images
diff options
context:
space:
mode:
authorLuca Boccassi <bluca@debian.org>2024-06-04 14:38:00 +0200
committerGitHub <noreply@github.com>2024-06-04 14:38:00 +0200
commit0af511453471f746583351d0648c4cbdfc4a3dda (patch)
tree034b42fc1f4d6ddfb3a9d3a5a4e455b7461d2596 /mkosi.images
parentMerge pull request #33192 from DaanDeMeyer/packaging (diff)
parentmkosi: Build Arch Linux image with -D_FORTIFY_SOURCE=3 (diff)
downloadsystemd-0af511453471f746583351d0648c4cbdfc4a3dda.tar.xz
systemd-0af511453471f746583351d0648c4cbdfc4a3dda.zip
Merge pull request #33193 from DaanDeMeyer/fortify
mkosi: Disable FORTIFY_SOURCE when building without optimizations or with sanitizers
Diffstat (limited to 'mkosi.images')
-rwxr-xr-xmkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot10
-rwxr-xr-xmkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.build.chroot2
-rwxr-xr-xmkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot2
-rwxr-xr-xmkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot2
4 files changed, 8 insertions, 8 deletions
diff --git a/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot b/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot
index 9407c1e053..60b6444bfc 100755
--- a/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot
+++ b/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot
@@ -24,7 +24,7 @@ ln --symbolic . "pkg/$ID/src"
# shellcheck source=/dev/null
. /etc/makepkg.conf
-MKOSI_CFLAGS="-O${OPTIMIZATION:-0} -Wp,-U_FORTIFY_SOURCE"
+MKOSI_CFLAGS="-Wp,-U_FORTIFY_SOURCE"
if ((LLVM)); then
# TODO: Remove -fno-sanitize-function when https://github.com/systemd/systemd/issues/29972 is fixed.
MKOSI_CFLAGS="$MKOSI_CFLAGS -shared-libasan -fno-sanitize=function"
@@ -40,10 +40,10 @@ if ((WIPE)); then
MKOSI_MESON_OPTIONS="$MKOSI_MESON_OPTIONS --wipe"
fi
-# Override the default options. Disable FORTIFY_SOURCE because it doesn't work with O0. We specifically
-# disable "strip", "zipman" and "lto" as they slow down builds significantly. OPTIONS= cannot be overridden
-# on the makepkg command line so we append to /etc/makepkg.conf instead. The rootfs is overlaid with a
-# writable tmpfs during the build script so these changes don't end up in the image itself.
+# Override the default options. We specifically disable "strip", "zipman" and "lto" as they slow down builds
+# significantly. OPTIONS= cannot be overridden on the makepkg command line so we append to /etc/makepkg.conf
+# instead. The rootfs is overlaid with a writable tmpfs during the build script so these changes don't end up
+# in the image itself.
tee --append /etc/makepkg.conf >/dev/null <<EOF
export CC="$( ((LLVM)) && echo clang || echo gcc)"
export CXX="$( ((LLVM)) && echo clang++ || echo g++)"
diff --git a/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.build.chroot b/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.build.chroot
index d2ba46bb56..31069aa8b3 100755
--- a/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.build.chroot
+++ b/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.build.chroot
@@ -47,7 +47,7 @@ COMMON_MACRO_OVERRIDES=(
)
# TODO: Drop -U_FORTIFY_SOURCE when we switch to CentOS Stream 10.
-MKOSI_CFLAGS="-O${OPTIMIZATION:-0} -Wp,-U_FORTIFY_SOURCE"
+MKOSI_CFLAGS="-Wp,-U_FORTIFY_SOURCE"
if ((WITH_DEBUG)); then
MKOSI_CFLAGS="$MKOSI_CFLAGS -fdebug-prefix-map=../src=$SRCDEST"
fi
diff --git a/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot
index e36fb4887c..1b8fe586ca 100755
--- a/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot
+++ b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot
@@ -44,7 +44,7 @@ EOF
cat debian/changelog >>debian/changelog.new
mv debian/changelog.new debian/changelog
-MKOSI_CFLAGS="-O${OPTIMIZATION:-0}"
+MKOSI_CFLAGS=""
if ((LLVM)); then
# TODO: Remove -fno-sanitize-function when https://github.com/systemd/systemd/issues/29972 is fixed.
MKOSI_CFLAGS="$MKOSI_CFLAGS -shared-libasan -fno-sanitize=function"
diff --git a/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot b/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot
index 0a08e8191a..4add69085d 100755
--- a/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot
+++ b/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot
@@ -42,7 +42,7 @@ DIST="$(rpm --eval %dist)"
ARCH="$(rpm --eval %_arch)"
SRCDEST="/usr/src/debug/systemd-$VERSION-${RELEASE}${DIST}.$ARCH"
-MKOSI_CFLAGS="-O${OPTIMIZATION:-0} -Wp,-U_FORTIFY_SOURCE"
+MKOSI_CFLAGS="-Wp,-U_FORTIFY_SOURCE"
if ((WITH_DEBUG)); then
MKOSI_CFLAGS="$MKOSI_CFLAGS -fdebug-prefix-map=../src=$SRCDEST"
fi