[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/2] livepatch-tools: add -largp option when required



crate-diff-object makes use of argp library, and depending on the libc
used by the system (ie: musl or BSD libc) argp is a separate library
and requires the addition of -largp to the build rune.

Introduce some shell logic to detect whether -largp is required for
linking create-diff-object.

I haven't done this as a reusable macro because I'm not sure there's
much point in doing so, the only library we need to test for is argp,
anything else is likely to be a mandatory library flag that doesn't
require such testing (like libelf for example).

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Makefile b/Makefile
index f96b150539d2..2f74c3433336 100644
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,10 @@ LIBEXECDIR = 
$(DESTDIR)$(PREFIX)/libexec/livepatch-build-tools
 CFLAGS  += -Iinsn -Wall -g
 LDFLAGS = -lelf
 
+# Non GNU libc systems usually have argp as a standalone library.
+LDFLAGS += $(shell if test -z "`$(CC) -largp 2>&1 | grep '\-largp'`"; \
+                      then echo "-largp"; fi;)
+
 TARGETS = create-diff-object prelink
 CREATE_DIFF_OBJECT_OBJS = create-diff-object.o lookup.o insn/insn.o 
insn/inat.o common.o
 PRELINK_OBJS = prelink.o lookup.o insn/insn.o insn/inat.o common.o
-- 
2.42.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.