Re: [Xen-devel] [PATCH v4 16/16] livepatch: In xen_nop test-case remove the .bss and .data sections

2016-09-19 Thread Jan Beulich
>>> On 16.09.16 at 18:38,  wrote:
> As they are not needed for the livepatch to work.

I think this patch can be dropped when skipping zero-size sections,
as suggested earlier.

Jan


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v4 16/16] livepatch: In xen_nop test-case remove the .bss and .data sections

2016-09-16 Thread Konrad Rzeszutek Wilk
As they are not needed for the livepatch to work.

Also this allows us to properly test:
"livepatch: Disallow applying after an revert" as the livepatch
will now only have the minimalistic sections:

Section Headers:
  [Nr] Name  Type Address   Offset
   Size  EntSize  Flags  Link  Info  Align
  [ 0]   NULL   
        0 0 0
  [ 1] .note.gnu.build-i NOTE   0040
   0024     A   0 0 4
  [ 2] .text PROGBITS 0024  0064
       AX   0 0 4
  [ 3] .livepatch.depend PROGBITS   0064
   0024     A   0 0 1
  [ 4] .livepatch.funcs  PROGBITS   00a0
   0040    WA   0 0 32
  [ 5] .note.GNU-stack   PROGBITS   00e0
        X   0 0 1
  [ 6] .comment  PROGBITS   00e0
   002d  0001  MS   0 0 1
  [ 7] .shstrtab STRTAB     010d
   0071     0 0 1
  [ 8] .symtab   SYMTAB     0400
   00c0  0018   9 7 8
  [ 9] .strtab   STRTAB     04c0
   000f     0 0 1

In which only .livepatch.funcs is write-able.

Signed-off-by: Konrad Rzeszutek Wilk 
---
Cc: Jan Beulich 
Cc: Andrew Cooper 

v4: New submission
---
 xen/test/livepatch/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/test/livepatch/Makefile b/xen/test/livepatch/Makefile
index d7a4735..41ad59d 100644
--- a/xen/test/livepatch/Makefile
+++ b/xen/test/livepatch/Makefile
@@ -104,6 +104,8 @@ xen_nop.o: config.h
 .PHONY: $(LIVEPATCH_NOP)
 $(LIVEPATCH_NOP): xen_nop.o note.o
$(LD) $(LDFLAGS) $(build_id_linker) -r -o $(LIVEPATCH_NOP) $^
+   $(OBJCOPY) --remove-section=.bss --remove-section=.data $@
+   $(OBJCOPY) --strip-unneeded $@
 
 .PHONY: livepatch
 livepatch: $(LIVEPATCH) $(LIVEPATCH_BYE) $(LIVEPATCH_REPLACE) $(LIVEPATCH_NOP)
-- 
2.5.5


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel