diff mbox series

[for-4.19] tools/xs-clients: Fix `make clean` rule

Message ID 20240703223611.1754927-1-andrew.cooper3@citrix.com (mailing list archive)
State New
Headers show
Series [for-4.19] tools/xs-clients: Fix `make clean` rule | expand

Commit Message

Andrew Cooper July 3, 2024, 10:36 p.m. UTC
Prior to the split, "the clients" used tools/xenstored/Makefile.common whose
clean rule includes *.o whereas after the split, the removal of *.o was lost
by virtule of not including Makefile.common any more.

This is the bug behind the following build error:

  make[2]: Entering directory '/local/xen.git/tools/xs-clients'
  gcc     xenstore_client.o    (snip)
  /usr/bin/ld: xenstore_client.o: relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
  /usr/bin/ld: failed to set dynamic section sizes: bad value
  collect2: error: ld returned 1 exit status
  make[2]: *** [Makefile:35: xenstore] Error 1

which was caused by `make clean` not properly cleaning the tree as I was
swapping between various build containers.

Switch to a plain single-colon clean rule.

Fixes: 5c293058b130 ("tools/xenstore: move xenstored sources into dedicated directory")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Anthony PERARD <anthony.perard@vates.tech>
CC: Juergen Gross <jgross@suse.com>
CC: Oleksii Kurochko <oleksii.kurochko@gmail.com>

For 4.19.  It's a minor build system corner case, but is also very safe too.

Ultimately it needs backporting to 4.18 too.
---
 tools/xs-clients/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jürgen Groß July 4, 2024, 5:54 a.m. UTC | #1
On 04.07.24 00:36, Andrew Cooper wrote:
> Prior to the split, "the clients" used tools/xenstored/Makefile.common whose
> clean rule includes *.o whereas after the split, the removal of *.o was lost
> by virtule of not including Makefile.common any more.
> 
> This is the bug behind the following build error:
> 
>    make[2]: Entering directory '/local/xen.git/tools/xs-clients'
>    gcc     xenstore_client.o    (snip)
>    /usr/bin/ld: xenstore_client.o: relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIE
>    /usr/bin/ld: failed to set dynamic section sizes: bad value
>    collect2: error: ld returned 1 exit status
>    make[2]: *** [Makefile:35: xenstore] Error 1
> 
> which was caused by `make clean` not properly cleaning the tree as I was
> swapping between various build containers.
> 
> Switch to a plain single-colon clean rule.
> 
> Fixes: 5c293058b130 ("tools/xenstore: move xenstored sources into dedicated directory")
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Juergen Gross <jgross@suse.com>


Juergen
Oleksii Kurochko July 4, 2024, 10:32 a.m. UTC | #2
On Wed, 2024-07-03 at 23:36 +0100, Andrew Cooper wrote:
> Prior to the split, "the clients" used
> tools/xenstored/Makefile.common whose
> clean rule includes *.o whereas after the split, the removal of *.o
> was lost
> by virtule of not including Makefile.common any more.
> 
> This is the bug behind the following build error:
> 
>   make[2]: Entering directory '/local/xen.git/tools/xs-clients'
>   gcc     xenstore_client.o    (snip)
>   /usr/bin/ld: xenstore_client.o: relocation R_X86_64_32S against
> `.rodata' can not be used when making a PIE object; recompile with -
> fPIE
>   /usr/bin/ld: failed to set dynamic section sizes: bad value
>   collect2: error: ld returned 1 exit status
>   make[2]: *** [Makefile:35: xenstore] Error 1
> 
> which was caused by `make clean` not properly cleaning the tree as I
> was
> swapping between various build containers.
> 
> Switch to a plain single-colon clean rule.
> 
> Fixes: 5c293058b130 ("tools/xenstore: move xenstored sources into
> dedicated directory")
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> CC: Anthony PERARD <anthony.perard@vates.tech>
> CC: Juergen Gross <jgross@suse.com>
> CC: Oleksii Kurochko <oleksii.kurochko@gmail.com>
> 
> For 4.19.  It's a minor build system corner case, but is also very
> safe too.
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>

~ Oleksii

> 
> Ultimately it needs backporting to 4.18 too.
> ---
>  tools/xs-clients/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/xs-clients/Makefile b/tools/xs-clients/Makefile
> index 4e78d365e0df..5415c441920a 100644
> --- a/tools/xs-clients/Makefile
> +++ b/tools/xs-clients/Makefile
> @@ -38,8 +38,8 @@ xenstore-control: xenstore_control.o
>  	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ $(APPEND_LDFLAGS)
>  
>  .PHONY: clean
> -clean::
> -	$(RM) $(TARGETS) $(DEPS_RM)
> +clean:
> +	$(RM) *.o $(TARGETS) $(DEPS_RM)
>  
>  .PHONY: distclean
>  distclean: clean
diff mbox series

Patch

diff --git a/tools/xs-clients/Makefile b/tools/xs-clients/Makefile
index 4e78d365e0df..5415c441920a 100644
--- a/tools/xs-clients/Makefile
+++ b/tools/xs-clients/Makefile
@@ -38,8 +38,8 @@  xenstore-control: xenstore_control.o
 	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ $(APPEND_LDFLAGS)
 
 .PHONY: clean
-clean::
-	$(RM) $(TARGETS) $(DEPS_RM)
+clean:
+	$(RM) *.o $(TARGETS) $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean