All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roger Pau Monne <roger.pau@citrix.com>
To: <xen-devel@lists.xenproject.org>
Cc: <ross.lagerwall@citrix.com>, <konrad.wilk@oracle.com>,
	<doebel@amazon.de>, <julien@xen.org>, <Andrew.Cooper3@citrix.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH 4/4] livepatch: differentiate between old and new build systems
Date: Wed,  2 Mar 2022 15:27:11 +0100	[thread overview]
Message-ID: <20220302142711.38953-5-roger.pau@citrix.com> (raw)
In-Reply-To: <20220302142711.38953-1-roger.pau@citrix.com>

Do not attempt to modify the build system if CFLAGS are not set in
Rules.mk, and instead rely on CONFIG_LIVEPATCH already setting
-f{function,data}-sections.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
This depends on getting the patch to add -f{function,data}-sections
when using CONFIG_LIVEPATCH accepted.
---
 livepatch-build | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/livepatch-build b/livepatch-build
index 38a92be..656cdac 100755
--- a/livepatch-build
+++ b/livepatch-build
@@ -98,14 +98,20 @@ function build_special()
 
     # Build with special GCC flags
     cd "${SRCDIR}/xen" || die
-    sed -i 's/CFLAGS += -nostdinc/CFLAGS += -nostdinc -ffunction-sections -fdata-sections/' Rules.mk
-    cp -p arch/x86/Makefile arch/x86/Makefile.bak
-    sed -i 's/--section-alignment=0x200000/--section-alignment=0x1000/' arch/x86/Makefile
-    # Restore timestamps to prevent spurious rebuilding
-    touch --reference=arch/x86/Makefile.bak arch/x86/Makefile
-    make "-j$CPUS" $XEN_DEBUG &> "${OUTPUT}/build_${name}_compile.log" || die
-    sed -i 's/CFLAGS += -nostdinc -ffunction-sections -fdata-sections/CFLAGS += -nostdinc/' Rules.mk
-    mv -f arch/x86/Makefile.bak arch/x86/Makefile
+    if grep -q 'nostdinc' Rules.mk; then
+         # Support for old build system, attempt to set -f{function,data}-sections and rebuild
+        sed -i 's/CFLAGS += -nostdinc/CFLAGS += -nostdinc -ffunction-sections -fdata-sections/' Rules.mk
+        cp -p arch/x86/Makefile arch/x86/Makefile.bak
+        sed -i 's/--section-alignment=0x200000/--section-alignment=0x1000/' arch/x86/Makefile
+        # Restore timestamps to prevent spurious rebuilding
+        touch --reference=arch/x86/Makefile.bak arch/x86/Makefile
+        make "-j$CPUS" $XEN_DEBUG &> "${OUTPUT}/build_${name}_compile.log" || die
+        sed -i 's/CFLAGS += -nostdinc -ffunction-sections -fdata-sections/CFLAGS += -nostdinc/' Rules.mk
+        mv -f arch/x86/Makefile.bak arch/x86/Makefile
+    else
+        # -f{function,data}-sections set by CONFIG_LIVEPATCH
+        make "-j$CPUS" $XEN_DEBUG &> "${OUTPUT}/build_${name}_compile.log" || die
+    fi
 
     unset LIVEPATCH_BUILD_DIR
     unset LIVEPATCH_CAPTURE_DIR
-- 
2.34.1



  parent reply	other threads:[~2022-03-02 14:29 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-02 14:27 [PATCH 0/4] livepatch: fixes for patch generation Roger Pau Monne
2022-03-02 14:27 ` [PATCH 1/4] livepatch: update readme to mention --xen-depends Roger Pau Monne
2022-03-02 15:32   ` Doebel, Bjoern
2022-03-08 13:36   ` Ross Lagerwall
2022-03-02 14:27 ` [PATCH 2/4] livepatch: improve rune for fetching of Build ID Roger Pau Monne
2022-03-02 15:33   ` Doebel, Bjoern
2022-03-08 13:47   ` Ross Lagerwall
2022-03-02 14:27 ` [PATCH 3/4] livepatch: do the initial build using CROSS_COMPILE Roger Pau Monne
2022-03-02 16:24   ` Doebel, Bjoern
2022-03-08 13:52   ` Ross Lagerwall
2022-03-02 14:27 ` Roger Pau Monne [this message]
2022-03-02 15:41   ` [PATCH 4/4] livepatch: differentiate between old and new build systems Doebel, Bjoern
2022-03-02 15:51     ` Roger Pau Monné
2022-03-02 15:55     ` Andrew Cooper
2022-03-02 16:25   ` Doebel, Bjoern
2022-03-08 13:58   ` Ross Lagerwall
2022-03-08 14:38   ` Andrew Cooper
2022-03-08 14:52     ` Roger Pau Monné
2022-03-10 18:01       ` Andrew Cooper
2022-03-11  8:33         ` Roger Pau Monné
2022-03-21 10:25           ` Roger Pau Monné

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220302142711.38953-5-roger.pau@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=Andrew.Cooper3@citrix.com \
    --cc=doebel@amazon.de \
    --cc=julien@xen.org \
    --cc=konrad.wilk@oracle.com \
    --cc=ross.lagerwall@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.