selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Moore <paul@paul-moore.com>
To: selinux@vger.kernel.org
Subject: [PATCH] selinux-testsuite: add libelf to builds using libbpf
Date: Tue, 24 Sep 2019 18:58:18 -0400	[thread overview]
Message-ID: <156936589827.661145.16998799838921887816.stgit@chester> (raw)

From: Paul Moore <paul@paul-moore.com>

On a modern Rawhide system builds that include libbpf require libelf
as well to avoid the following linker errors:

 # cc -g -O0 -Wall -D_GNU_SOURCE -DHAVE_BPF \
    client.c ../bpf/bpf_common.c ../bpf/bpf_common.h  -lbpf -o client
 /usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getshdr'
 /usr/bin/ld: ... libbpf.so: undefined reference to `elf_rawdata'
 /usr/bin/ld: ... libbpf.so: undefined reference to `elf_getscn'
 /usr/bin/ld: ... libbpf.so: undefined reference to `elf_begin'
 /usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getrel'
 /usr/bin/ld: ... libbpf.so: undefined reference to `elf_memory'
 /usr/bin/ld: ... libbpf.so: undefined reference to `elf_end'
 /usr/bin/ld: ... libbpf.so: undefined reference to `elf_strptr'
 /usr/bin/ld: ... libbpf.so: undefined reference to `elf_nextscn'
 /usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getehdr'
 /usr/bin/ld: ... libbpf.so: undefined reference to `elf_version'
 /usr/bin/ld: ... libbpf.so: undefined reference to `elf_getdata'
 /usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getsym'

Signed-off-by: Paul Moore <paul@paul-moore.com>
---
 tests/binder/Makefile    |    2 +-
 tests/bpf/Makefile       |    2 +-
 tests/fdreceive/Makefile |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/binder/Makefile b/tests/binder/Makefile
index e78ad16..8f3cc28 100644
--- a/tests/binder/Makefile
+++ b/tests/binder/Makefile
@@ -12,7 +12,7 @@ endif
 
 ifneq (,$(findstring -DHAVE_BPF,$(CFLAGS)))
 	DEPS += ../bpf/bpf_common.c ../bpf/bpf_common.h
-	LDLIBS += -lbpf
+	LDLIBS += -lelf -lbpf
 endif
 
 all: $(TARGETS)
diff --git a/tests/bpf/Makefile b/tests/bpf/Makefile
index 6fb230d..7b00b41 100644
--- a/tests/bpf/Makefile
+++ b/tests/bpf/Makefile
@@ -1,6 +1,6 @@
 TARGETS = bpf_test
 DEPS = bpf_common.c bpf_common.h
-LDLIBS += -lselinux -lbpf
+LDLIBS += -lselinux -lelf -lbpf
 
 # export so that BPF_ENABLED entries get built correctly on local build
 export CFLAGS += -DHAVE_BPF
diff --git a/tests/fdreceive/Makefile b/tests/fdreceive/Makefile
index 895f91c..cf57327 100644
--- a/tests/fdreceive/Makefile
+++ b/tests/fdreceive/Makefile
@@ -2,7 +2,7 @@ TARGETS = client server
 
 ifneq (,$(findstring -DHAVE_BPF,$(CFLAGS)))
 	DEPS = ../bpf/bpf_common.c ../bpf/bpf_common.h
-	LDLIBS += -lbpf
+	LDLIBS += -lelf -lbpf
 endif
 
 all: $(TARGETS)


             reply	other threads:[~2019-09-24 22:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-24 22:58 Paul Moore [this message]
2019-09-25  9:06 ` [PATCH] selinux-testsuite: add libelf to builds using libbpf Ondrej Mosnacek
2019-09-25 15:22   ` Paul Moore
2019-10-09 18:27     ` Stephen Smalley
2019-10-09 22:44       ` Paul Moore
2019-10-10 11:42       ` Ondrej Mosnacek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=156936589827.661145.16998799838921887816.stgit@chester \
    --to=paul@paul-moore.com \
    --cc=selinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).