[Xen-devel] [PATCH LP-BUILD_TOOLS] Fix building with updated ENFORCE_UNIQUE_SYMBOLS behaviour

Ross Lagerwall posted 1 patch 4 years, 4 months ago
Failed in applying to current master (apply log)
livepatch-gcc | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
[Xen-devel] [PATCH LP-BUILD_TOOLS] Fix building with updated ENFORCE_UNIQUE_SYMBOLS behaviour
Posted by Ross Lagerwall 4 years, 4 months ago
The patch "build: provide option to disambiguate symbol names" changes
ENFORCE_UNIQUE_SYMBOLS so that gcc generates output to a temporary file
and then objcopy is used to create the final object file. This breaks
livepatch-build's interposition of GCC to capture the changed object
files so intercept calls to objcopy as well to capture the final object
files.

While in the area, add a couple of extra object files to be ignored when
patching.

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
---

With this change, I've built and successfully applied a trivial
livepatch with Jan's patch applied and ENFORCE_UNIQUE_SYMBOLS turned on.

To be applied at the same time as Jan's patch.

 livepatch-gcc | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/livepatch-gcc b/livepatch-gcc
index 01e4b8c..91333d5 100755
--- a/livepatch-gcc
+++ b/livepatch-gcc
@@ -26,6 +26,7 @@ declare -a args=("$@")
 keep=no
 
 declare -r GCC_RE='gcc.*'
+declare -r OBJCOPY_RE='objcopy.*'
 if [[ "$TOOLCHAINCMD" =~ $GCC_RE ]] ; then
     while [ "$#" -gt 0 ]; do
         if [ "$1" = "-o" ]; then
@@ -34,7 +35,9 @@ if [[ "$TOOLCHAINCMD" =~ $GCC_RE ]] ; then
             case "$obj" in
             version.o|\
             debug.o|\
+            efi/check.o|\
             *.xen-syms.*.o|\
+            *.xen.efi.*.o|\
             built_in.o|\
             prelink.o|\
             .*.o)
@@ -56,6 +59,25 @@ if [[ "$TOOLCHAINCMD" =~ $GCC_RE ]] ; then
     fi
     shift
 done
+elif [[ "$TOOLCHAINCMD" =~ $OBJCOPY_RE ]] ; then
+    obj="${!#}"
+    case "$obj" in
+        version.o|\
+        debug.o|\
+        efi/check.o|\
+        .*.o)
+            ;;
+        *.o)
+            path="$(pwd)/$(dirname $obj)"
+            dir="${path#$LIVEPATCH_BUILD_DIR}"
+            if [ -n "$LIVEPATCH_CAPTURE_DIR" -a -d "$LIVEPATCH_CAPTURE_DIR" ]; then
+                echo "$dir/$obj" >> "${LIVEPATCH_CAPTURE_DIR}/changed_objs"
+                keep=yes
+            fi
+            ;;
+        *)
+            ;;
+    esac
 fi
 
 "$TOOLCHAINCMD" "${args[@]}"
-- 
2.21.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH LP-BUILD_TOOLS] Fix building with updated ENFORCE_UNIQUE_SYMBOLS behaviour
Posted by Sergey Dyasli 4 years, 4 months ago
On 28/11/2019 14:51, Ross Lagerwall wrote:
> The patch "build: provide option to disambiguate symbol names" changes
> ENFORCE_UNIQUE_SYMBOLS so that gcc generates output to a temporary file
> and then objcopy is used to create the final object file. This breaks
> livepatch-build's interposition of GCC to capture the changed object
> files so intercept calls to objcopy as well to capture the final object
> files.
> 
> While in the area, add a couple of extra object files to be ignored when
> patching.
> 
> Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
> ---
> 
> With this change, I've built and successfully applied a trivial
> livepatch with Jan's patch applied and ENFORCE_UNIQUE_SYMBOLS turned on.

Can confirm the same with my test LP. So

    Tested-by: Sergey Dyasli <sergey.dyasli@citrix.com>

can go to both this and Jan's patch I guess.

--
Thanks,
Sergey

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel