Christian Göttsche <cgzones@xxxxxxxxxxxxxx> writes: > 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 <cgzones@xxxxxxxxxxxxxx> Acked-by: Petr Lautrbach <plautrba@xxxxxxxxxx> Thanks! > --- > v2: > - drop line regarding regex.o, as suggested by Nicolas Iooss. > - order -lpcre after libselinux.a > > > libselinux/utils/Makefile | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/libselinux/utils/Makefile b/libselinux/utils/Makefile > index b018a08a..36816155 100644 > --- a/libselinux/utils/Makefile > +++ b/libselinux/utils/Makefile > @@ -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) > > -- > 2.33.0