Skip to content

Commit

Permalink
make-seccomp-filters.sh: split cflags/ldflags for libseccomp
Browse files Browse the repository at this point in the history
Resolves a link failure with -Wl,--as-needed.
Thanks to Mathias Krause for noticing the problem.

Signed-off-by: Mike Gilbert <floppym@gentoo.org>
  • Loading branch information
floppym committed Jul 22, 2024
1 parent a1d0123 commit b16cce4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions make-seccomp-filters.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ set -ufe
>&2 echo YOU DO NOT NEED TO RUN IT UNLESS YOU EDITED seccomp-bpf.c

: "${CC:=gcc}"
: "${CCFLAGS:=$(pkg-config --cflags --libs libseccomp)}"
: "${PKG_CONFIG:=pkg-config}"
: "${SECCOMP_CFLAGS:=$(${PKG_CONFIG} --cflags libseccomp)}"
: "${SECCOMP_LIBS:=$(${PKG_CONFIG} --libs libseccomp)}"

generator="$(mktemp)"
trap 'rm "${generator}"' EXIT

"${CC}" -o "${generator}" -D_GNU_SOURCE ${CCFLAGS} seccomp-bpf.c && \
${CC} -o "${generator}" -D_GNU_SOURCE ${SECCOMP_CFLAGS} ${CFLAGS-} ${LDFLAGS-} seccomp-bpf.c ${SECCOMP_LIBS} && \
"${generator}" > seccomp-bpf.h

0 comments on commit b16cce4

Please sign in to comment.