Skip to contentSkip to conversation

tests/xenstore: link in librt if necessary

PATCH In review Jan Beulich 3 participants 3 messages Aug 17, 2021 – Sep 2, 2021

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tests/xenstore: link in librt if necessary

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")

---
v2: Use --as-needed and put last in LDFLAGS. Restict to just Linux.

tools/tests/xenstore/Makefile +3 -0
@@ -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
 
Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · Jan Beulich

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")

Juergen

Acked-by
#2 lore raw

Juergen Gross writes ("Re: [PATCH v2] tests/xenstore: link in librt if necessary"):

Quoted 10 lines · Jan Beulich
Quoted 7 lines

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")

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:

and queued. I will push it today.

Ian.