aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew G. Morgan <morgan@kernel.org>2021-08-11 19:54:29 -0700
committerAndrew G. Morgan <morgan@kernel.org>2021-08-11 19:59:24 -0700
commit6dea1813f269f9c03cea226fffdd75670c70ea01 (patch)
tree530f88b52c38502e4155000a3e66ca4d566462b7
parent4db87d88aec313b6fda78b48b3f28fdc6c751180 (diff)
downloadlibcap-6dea1813f269f9c03cea226fffdd75670c70ea01.tar.gz
Support CC=clang again.
I didn't realize CC=clang used to work. Now it does again. I've also added a test build for clang in distcheck. This fixes: https://bugzilla.kernel.org/show_bug.cgi?id=214047 Also, add a note about pam_cap.so building after debugging: https://bugzilla.kernel.org/show_bug.cgi?id=214023 Finally, removed a redundant LDFLAGS link directory override. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
-rw-r--r--Make.Rules1
-rw-r--r--Makefile1
-rw-r--r--libcap/Makefile4
-rw-r--r--pam_cap/Makefile5
4 files changed, 7 insertions, 4 deletions
diff --git a/Make.Rules b/Make.Rules
index 8f7906c..108463e 100644
--- a/Make.Rules
+++ b/Make.Rules
@@ -79,7 +79,6 @@ BUILD_GPERF := $(shell which gperf >/dev/null 2>/dev/null && echo yes)
SYSTEM_HEADERS = /usr/include
INCS=$(topdir)/libcap/include/sys/capability.h
-LDFLAGS += -L$(topdir)/libcap
CFLAGS += -Dlinux $(WARNINGS) $(DEBUG)
INDENT := $(shell if [ -n "$$(which indent 2>/dev/null)" ]; then echo "| indent -kr" ; fi)
diff --git a/Makefile b/Makefile
index 984d502..d26af01 100644
--- a/Makefile
+++ b/Makefile
@@ -70,6 +70,7 @@ distcheck:
$(MAKE) DYNAMIC=yes clean all test sudotest
$(MAKE) DYNAMIC=no COPTS="-O2 -std=c89" clean all test sudotest
$(MAKE) PAM_CAP=no CC=/usr/local/musl/bin/musl-gcc clean all test sudotest
+ $(MAKE) CC=clang clean all test sudotest
$(MAKE) clean all test sudotest
$(MAKE) distclean
diff --git a/libcap/Makefile b/libcap/Makefile
index 47cf8f4..b5689d2 100644
--- a/libcap/Makefile
+++ b/libcap/Makefile
@@ -20,7 +20,7 @@ PSXMAGICOBJ=psx_magic.o
# The linker magic needed to build a dynamic library as independently
# executable
-MAGIC=--entry=__so_start
+MAGIC=-Wl,-e,__so_start
INCLS=libcap.h cap_names.h $(INCS)
GPERF_OUTPUT = _caps_output.gperf
@@ -105,7 +105,7 @@ empty: empty.c
$(CC) -o $@ $<
loader.txt: empty
- $(OBJCOPY) --dump-section .interp=/dev/stdout $< > $@
+ $(OBJCOPY) --dump-section .interp=$@ $<
cap_magic.o: execable.h execable.c loader.txt
$(CC) $(CFLAGS) $(IPATH) -DLIBRARY_VERSION=\"$(LIBTITLE)-$(VERSION).$(MINOR)\" -DSHARED_LOADER=\"$(shell cat loader.txt)\" -c execable.c -o $@
diff --git a/pam_cap/Makefile b/pam_cap/Makefile
index c01baea..cb0b813 100644
--- a/pam_cap/Makefile
+++ b/pam_cap/Makefile
@@ -20,9 +20,12 @@ execable.o: execable.c ../libcap/execable.h ../libcap/loader.txt
# that this next line does *not* require -lpam on it.) If you think it
# does, *verify that it does*, and if you observe that it fails as
# written (and you know why it fails), email me and explain why. Thanks!
+#
+# This bug documents some overriden CC and LD flags that cause it to
+# be necessary: https://bugzilla.kernel.org/show_bug.cgi?id=214023
pam_cap.so: pam_cap.o execable.o
- $(LD) -o pam_cap.so $+ $(LIBCAPLIB) $(LDFLAGS) --entry=__so_start
+ $(LD) -o pam_cap.so $+ $(LIBCAPLIB) $(LDFLAGS) -Wl,-e,__so_start
pam_cap.o: pam_cap.c
$(CC) $(CFLAGS) $(IPATH) -c $< -o $@