Skip to content

Commit

Permalink
libselinux/utils: drop requirement to combine compiling and linking
Browse files Browse the repository at this point in the history
The extra dependency of sefcontext_compile on its object file causes the
compile and link step to be separated.
During the link step the CFLAGS are not passed, which might contain
optimization or sanitizer flags.

Reorder the LDLIBS requirements to avoid the symbol 'pcre_fullinfo'
being unresolvable at link time.

Current behavior:

    gcc-11 **custom CFLAGS** -I../include -D_GNU_SOURCE     -c -o sefcontext_compile.o sefcontext_compile.c
    gcc-11 -L../src  sefcontext_compile.o ../src/regex.o  -lselinux  -lpcre ../src/libselinux.a -lsepol -o sefcontext_compile

Changed:

    gcc-11 **custom CFLAGS** -I../include -D_GNU_SOURCE    -L../src  sefcontext_compile.c  -lselinux  ../src/libselinux.a -lpcre -lsepol -o sefcontext_compile

Signed-off-by: Christian Göttsche <[email protected]>
  • Loading branch information
cgzones authored and bachradsusi committed Sep 22, 2021
1 parent 18f8747 commit ffa7312
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions libselinux/utils/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ else
TARGETS=$(patsubst %.c,%,$(sort $(wildcard *.c)))
endif

sefcontext_compile: LDLIBS += $(PCRE_LDLIBS) ../src/libselinux.a -lsepol

sefcontext_compile: sefcontext_compile.o ../src/regex.o
sefcontext_compile: LDLIBS += ../src/libselinux.a $(PCRE_LDLIBS) -lsepol

all: $(TARGETS)

Expand Down

0 comments on commit ffa7312

Please sign in to comment.