[PATCH v2] tests/xenstore: link in librt if necessary

Jan Beulich posted 1 patch 2 years, 8 months ago
Test gitlab-ci failed
Failed in applying to current master (apply log)
[PATCH v2] tests/xenstore: link in librt if necessary
Posted by Jan Beulich 2 years, 8 months ago
Old enough glibc has clock_gettime() in librt.so, hence the library
needs to be specified to the linker. Newer glibc has the symbol
available in both libraries, so make sure that libc.so is preferred (to
avoid an unnecessary dependency on librt.so).

Fixes: 93c9edbef51b ("tests/xenstore: Rework Makefile")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
v2: Use --as-needed and put last in LDFLAGS. Restict to just Linux.

--- a/tools/tests/xenstore/Makefile
+++ b/tools/tests/xenstore/Makefile
@@ -33,6 +33,9 @@ CFLAGS += $(APPEND_CFLAGS)
 
 LDFLAGS += $(LDLIBS_libxenstore)
 LDFLAGS += $(APPEND_LDFLAGS)
+ifeq ($(CONFIG_Linux),y)
+LDFLAGS += -Wl,--as-needed -lc -lrt
+endif
 
 %.o: Makefile
 


Re: [PATCH v2] tests/xenstore: link in librt if necessary
Posted by Juergen Gross 2 years, 8 months ago
On 17.08.21 16:18, Jan Beulich wrote:
> Old enough glibc has clock_gettime() in librt.so, hence the library
> needs to be specified to the linker. Newer glibc has the symbol
> available in both libraries, so make sure that libc.so is preferred (to
> avoid an unnecessary dependency on librt.so).
> 
> Fixes: 93c9edbef51b ("tests/xenstore: Rework Makefile")
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

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


Juergen
Re: [PATCH v2] tests/xenstore: link in librt if necessary
Posted by Ian Jackson 2 years, 7 months ago
Juergen Gross writes ("Re: [PATCH v2] tests/xenstore: link in librt if necessary"):
> On 17.08.21 16:18, Jan Beulich wrote:
> > Old enough glibc has clock_gettime() in librt.so, hence the library
> > needs to be specified to the linker. Newer glibc has the symbol
> > available in both libraries, so make sure that libc.so is preferred (to
> > avoid an unnecessary dependency on librt.so).
> > 
> > Fixes: 93c9edbef51b ("tests/xenstore: Rework Makefile")
> > Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Reviewed-by: Juergen Gross <jgross@suse.com>

Thanks.

While I peronally think this is not warranted, the extra Makefile
clutter is a very minor wart and I definitely don't want to stand in
the way of people dealing with things that are a problem for them.

So:

Acked-by: Ian Jackson <iwj@xenproject.org>

and queued.  I will push it today.

Ian.