Skip to contentSkip to conversation

tests/xenstore: link in librt

PATCH Superseded Jan Beulich 3 participants 6 messages Aug 11, 2021 – Aug 16, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/xenstore: link in librt

Old enough glibc has clock_gettime() in librt.so, hence the library needs to be specified to the linker.

Fixes 93c9edbef51b ("tests/xenstore: Rework Makefile")

---
Cc list based on the assumption that the XENSTORE section of ./MAINTAINERS probably ought to list the containing directory.

tools/tests/xenstore/Makefile +1 -0
@@ -31,6 +31,7 @@ CFLAGS += -Werror
 CFLAGS += $(CFLAGS_libxenstore)
 CFLAGS += $(APPEND_CFLAGS)
 
+LDFLAGS += -lrt
 LDFLAGS += $(LDLIBS_libxenstore)
 LDFLAGS += $(APPEND_LDFLAGS)
 
#1 lore raw

PATCH 1/1 tests/xenstore: link in librt

Jan Beulich writes ("[PATCH] tests/xenstore: link in librt"):

Quoted 12 lines

Old enough glibc has clock_gettime() in librt.so, hence the library needs to be specified to the linker.

Fixes 93c9edbef51b ("tests/xenstore: Rework Makefile")

---
Cc list based on the assumption that the XENSTORE section of ./MAINTAINERS probably ought to list the containing directory.

tools/tests/xenstore/Makefile CFLAGS += -Werror · line 34

Quoted 4 lines
tools/tests/xenstore/Makefile +1 -0
@@ -31,6 +31,7 @@ CFLAGS += -Werror
 CFLAGS += $(CFLAGS_libxenstore)
 CFLAGS += $(APPEND_CFLAGS)
 
+LDFLAGS += -lrt

Don't this unconditionally is definitely not right.

How old a glibc are we talking about ? (I looked at the minimum versions listed in README and there's notthing about glibc; perhaps should be.)

Ian.

#2 lore raw
Quoted 16 lines · Ian Jackson

Jan Beulich writes ("[PATCH] tests/xenstore: link in librt"):

Quoted 15 lines

Old enough glibc has clock_gettime() in librt.so, hence the library needs to be specified to the linker.

Fixes 93c9edbef51b ("tests/xenstore: Rework Makefile")

---
Cc list based on the assumption that the XENSTORE section of ./MAINTAINERS probably ought to list the containing directory.

tools/tests/xenstore/Makefile +0 -0
@@ -31,6 +31,7 @@ CFLAGS += -Werror
 CFLAGS += $(CFLAGS_libxenstore)
 CFLAGS += $(APPEND_CFLAGS)
 
Quoted 3 lines

tools/tests/xenstore/Makefile CFLAGS += -Werror · line 34

Quoted 1 line
tools/tests/xenstore/Makefile +1 -0
+LDFLAGS += -lrt

Don't this unconditionally is definitely not right.

Assuming you meant "Doing this ..." - why? If the concern is that librt.so may needlessly get recorded in a DT_NEEDED entry, then I can replace the early addition with a late

LDFLAGS += -Wl,--as-needed -lc -lrt

one.

Quoted 3 lines

How old a glibc are we talking about ? (I looked at the minimum versions listed in README and there's notthing about glibc; perhaps should be.)

I've hit this with 2.11.3. I guess it has been made available by libc.so from 2.17 onwards, considering the symbol version is GLIBC_2.17.

Jan

#3 lore raw

Jan Beulich writes ("Re: [PATCH] tests/xenstore: link in librt"):

Quoted 5 lines · Ian Jackson
Quoted 3 lines
Quoted 1 line

+LDFLAGS += -lrt

Don't this unconditionally is definitely not right.

Quoted 7 lines

Assuming you meant "Doing this ..." - why? If the concern is that librt.so may needlessly get recorded in a DT_NEEDED entry, then I can replace the early addition with a late

LDFLAGS += -Wl,--as-needed -lc -lrt

one.

librt might not exist at all on some platforms.

Quoted 7 lines
Quoted 3 lines

How old a glibc are we talking about ? (I looked at the minimum versions listed in README and there's notthing about glibc; perhaps should be.)

I've hit this with 2.11.3. I guess it has been made available by libc.so from 2.17 onwards, considering the symbol version is GLIBC_2.17.

According to
https://www.sourceware.org/glibc/wiki/Glibc%20Timeline
glibc 2.17 was released more than eight years ago on 2012-12-25.

Ian.

#4 lore raw
Quoted 10 lines · Ian Jackson

Jan Beulich writes ("Re: [PATCH] tests/xenstore: link in librt"):

Quoted 9 lines · Ian Jackson
Quoted 3 lines
Quoted 1 line

+LDFLAGS += -lrt

Don't this unconditionally is definitely not right.

Assuming you meant "Doing this ..." - why? If the concern is that librt.so may needlessly get recorded in a DT_NEEDED entry, then I can replace the early addition with a late

Quoted 5 lines
Quoted 3 lines

LDFLAGS += -Wl,--as-needed -lc -lrt

one.

librt might not exist at all on some platforms.

Hmm, indeed. Do you have any suggestion then? Adding a ./configure check is going to be beyond what I'd we willing to spend time on ...

Jan

#5 lore raw
Quoted 11 lines · Jan Beulich
Quoted 10 lines · Ian Jackson

Jan Beulich writes ("Re: [PATCH] tests/xenstore: link in librt"):

Quoted 9 lines · Ian Jackson
Quoted 3 lines
Quoted 1 line

+LDFLAGS += -lrt

Don't this unconditionally is definitely not right.

Assuming you meant "Doing this ..." - why? If the concern is that librt.so may needlessly get recorded in a DT_NEEDED entry, then I can replace the early addition with a late

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

LDFLAGS += -Wl,--as-needed -lc -lrt

one.

librt might not exist at all on some platforms.

Hmm, indeed. Do you have any suggestion then? Adding a ./configure check is going to be beyond what I'd we willing to spend time on ...

libxl is using (probably due to the same problem):

LDUSELIBS-$(CONFIG_Linux) += -lrt

So I guess the same construct is possible here, too.

Juergen