Add liblockdep packages

liblockdep is in fairly bad shape - one patch needed to make it build
at all, another to make it build in a separate directory successfully,
and a third to fix the soname.  And the install rule doesn't install
its public headers.  But maybe it will be useful.
This commit is contained in:
Ben Hutchings 2015-08-13 20:48:12 +02:00
parent 9083cdad75
commit 042546e3a1
12 changed files with 193 additions and 1 deletions

View File

@ -1,5 +1,6 @@
SUBDIRS = \
hv \
lib/lockdep \
perf \
usb/usbip

26
debian/build/tools/lib/lockdep/Makefile vendored Normal file
View File

@ -0,0 +1,26 @@
srcdir := $(top_srcdir)/tools/lib/lockdep
DEB_HOST_MULTIARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
MAKE_LOCKDEP := $(MAKE) -C $(srcdir) O=$(CURDIR)/out V=1 \
prefix=/usr libdir_relative=lib/$(DEB_HOST_MULTIARCH) \
LIBLOCKDEP_VERSION=$(VERSION)
unexport CFLAGS
all:
mkdir -p out
$(MAKE_LOCKDEP)
install:
$(MAKE_LOCKDEP) install
mkdir -p $(DESTDIR)/usr/include
cp -R $(srcdir)/include/liblockdep $(DESTDIR)/usr/include/
ln -s liblockdep.so.$(VERSION) \
$(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/liblockdep.so
# Upstream lockdep preload script is not suitable for installation
sed 's/@VERSION@/$(VERSION)/' lockdep.in > $(DESTDIR)/usr/bin/lockdep
chmod 755 $(DESTDIR)/usr/bin/lockdep
clean:
rm -rf out

View File

@ -0,0 +1,2 @@
#!/bin/sh
LD_PRELOAD="liblockdep.so.@VERSION@ $LD_PRELOAD" exec "$@"

1
debian/liblockdep-dev.docs vendored Normal file
View File

@ -0,0 +1 @@
Documentation/locking/lockdep-design.txt

3
debian/liblockdep-dev.install vendored Normal file
View File

@ -0,0 +1,3 @@
usr/include/liblockdep
usr/lib/*/liblockdep.a
usr/lib/*/liblockdep.so

1
debian/lockdep.install vendored Normal file
View File

@ -0,0 +1 @@
usr/bin/lockdep

View File

@ -0,0 +1,62 @@
--- /dev/null
+++ b/tools/lib/lockdep/uinclude/linux/export.h
@@ -0,0 +1,10 @@
+#ifndef _LINUX_EXPORT_H
+#define _LINUX_EXPORT_H
+
+#define EXPORT_SYMBOL(sym)
+#define EXPORT_SYMBOL_GPL(sym)
+#define EXPORT_SYMBOL_GPL_FUTURE(sym)
+#define EXPORT_UNUSED_SYMBOL(sym)
+#define EXPORT_UNUSED_SYMBOL_GPL(sym)
+
+#endif /* _LINUX_EXPORT_H */
--- a/tools/lib/lockdep/uinclude/linux/kernel.h
+++ b/tools/lib/lockdep/uinclude/linux/kernel.h
@@ -23,7 +23,7 @@
#define WARN_ON(x) (x)
#define WARN_ON_ONCE(x) (x)
#define likely(x) (x)
-#define WARN(x, y, z) (x)
+#define WARN(x, y...) (x)
#define uninitialized_var(x) x
#define __init
#define noinline
--- a/tools/lib/lockdep/preload.c
+++ b/tools/lib/lockdep/preload.c
@@ -5,7 +5,7 @@
#include <stdlib.h>
#include <sysexits.h>
#include "include/liblockdep/mutex.h"
-#include "../../../include/linux/rbtree.h"
+#include <linux/rbtree.h>
/**
* struct lock_lookup - liblockdep's view of a single unique lock
--- a/tools/lib/lockdep/uinclude/linux/rbtree.h
+++ b/tools/lib/lockdep/uinclude/linux/rbtree.h
@@ -1 +1 @@
-#include "../../../include/linux/rbtree.h"
+#include "../../include/linux/rbtree.h"
--- a/tools/lib/lockdep/uinclude/linux/compiler.h
+++ b/tools/lib/lockdep/uinclude/linux/compiler.h
@@ -4,4 +4,10 @@
#define __used __attribute__((__unused__))
#define unlikely
+#define __ACCESS_ONCE(x) ({ \
+ __attribute__((__unused__)) typeof(x) __var = (__force typeof(x)) 0; \
+ (volatile typeof(x) *)&(x); })
+#define ACCESS_ONCE(x) (*__ACCESS_ONCE(x))
+#define WRITE_ONCE(x, val) (ACCESS_ONCE(x) = (val))
+
#endif
--- a/tools/lib/lockdep/uinclude/linux/rcu.h
+++ b/tools/lib/lockdep/uinclude/linux/rcu.h
@@ -18,4 +18,6 @@ static inline bool rcu_is_watching(void)
return false;
}
+#define RCU_INIT_POINTER(p, v) (p = v)
+
#endif

View File

@ -0,0 +1,33 @@
--- a/tools/lib/lockdep/Makefile
+++ b/tools/lib/lockdep/Makefile
@@ -98,7 +98,7 @@ build := -f $(srctree)/tools/build/Makef
do_compile_shared_library = \
($(print_shared_lib_compile) \
- $(CC) --shared $^ -o $@ -lpthread -ldl -Wl,-soname='"$@"';$(shell ln -s $@ liblockdep.so))
+ $(CC) --shared $^ -o $@ -lpthread -ldl -Wl,-soname='"$(@F)"';$(shell ln -s $(@F) $(@D)/liblockdep.so))
do_build_static_lib = \
($(print_static_lib_build) \
@@ -116,10 +116,10 @@ all_cmd: $(CMD_TARGETS)
$(LIB_IN): force
$(Q)$(MAKE) $(build)=liblockdep
-liblockdep.so.$(LIBLOCKDEP_VERSION): $(LIB_IN)
+$(OUTPUT)liblockdep.so.$(LIBLOCKDEP_VERSION): $(LIB_IN)
$(Q)$(do_compile_shared_library)
-liblockdep.a: $(LIB_IN)
+$(OUTPUT)liblockdep.a: $(LIB_IN)
$(Q)$(do_build_static_lib)
tags: force
@@ -147,7 +147,7 @@ install_lib: all_cmd
install: install_lib
clean:
- $(RM) *.o *~ $(TARGETS) *.a *liblockdep*.so* $(VERSION_FILES) .*.d
+ $(RM) $(OUTPUT)*.o *~ $(TARGETS) $(OUTPUT)*.a $(OUTPUT)*liblockdep*.so* $(VERSION_FILES) $(OUTPUT).*.d
$(RM) tags TAGS
PHONY += force

11
debian/patches/lockdep-fix-soname.patch vendored Normal file
View File

@ -0,0 +1,11 @@
--- a/tools/lib/lockdep/Makefile
+++ b/tools/lib/lockdep/Makefile
@@ -98,7 +98,7 @@ build := -f $(srctree)/tools/build/Makef
do_compile_shared_library = \
($(print_shared_lib_compile) \
- $(CC) --shared $^ -o $@ -lpthread -ldl -Wl,-soname='"$(@F)"';$(shell ln -s $(@F) $(@D)liblockdep.so))
+ $(CC) --shared $^ -o $@ -lpthread -ldl -Wl,-soname='$(@F)';$(shell ln -s $(@F) $(@D)/liblockdep.so))
do_build_static_lib = \
($(print_static_lib_build) \

View File

@ -7,3 +7,6 @@ kbuild-fix-recordmcount-dependency.patch
usbip-include-uninstalled-linux-usbip-h.patch
tools-perf-man-date.patch
tools-perf-add-empty-build-files-for-architectures-lacking.patch
lockdep-fix-oot-build.patch
lockdep-fix-headers.patch
lockdep-fix-soname.patch

26
debian/rules.real vendored
View File

@ -3,7 +3,7 @@ export KBUILD_BUILD_TIMESTAMP := $(shell dpkg-parsechangelog | sed -ne 's,^Date:
include debian/rules.defs
binary-arch: install-kbuild install-usbip
binary-arch: install-kbuild install-usbip install-lockdep
ifneq ($(filter alpha amd64 arm64 armel armhf hppa i386 mips mips64 mips64el mipsel powerpc powerpcspe ppc64 ppc64el s390 s390x sh4 sparc sparc64 x32,$(DEB_BUILD_ARCH)),)
binary-arch: install-perf
endif
@ -103,3 +103,27 @@ install-hyperv-daemons: $(STAMPS_DIR)/build
dh_gencontrol
dh_md5sums
dh_builddeb
install-lockdep: DH_OPTIONS = -plockdep -pliblockdep$(VERSION) -pliblockdep-dev
install-lockdep: DIR = $(CURDIR)/debian/tmp
install-lockdep: $(STAMPS_DIR)/build
dh_testdir
dh_testroot
dh_prep
$(MAKE) -C $(BUILD_DIR)/tools/lib/lockdep install top_srcdir=$(CURDIR) \
DESTDIR=$(DIR)
env -u DH_OPTIONS dh_install -pliblockdep$(VERSION) \
'usr/lib/*/liblockdep.so.*'
dh_install
dh_installchangelogs
dh_installdocs
dh_strip
dh_compress
dh_fixperms
env -u DH_OPTIONS dh_makeshlibs -pliblockdep$(VERSION) \
liblockdep$(VERSION)
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb

View File

@ -70,3 +70,28 @@ Description: Support daemons for Linux running on Hyper-V
.
hv_vss_daemon provides the volume shadow copy service (VSS), allowing
the host to freeze the guest filesystems while taking a snapshot.
Package: lockdep
Architecture: all
Depends: ${shlibs:Depends}, ${misc:Depends}, liblockdep@version@
Recommends: liblockdep-dev
Section: devel
Multi-Arch: allowed
Description: Runtime locking correctness validator
TBD
Package: liblockdep@version@
Architecture: linux-any
Depends: ${shlibs:Depends}, ${misc:Depends}
Section: libs
Multi-Arch: same
Description: Runtime locking correctness validator - shared library
TBD
Package: liblockdep-dev
Architecture: linux-any
Depends: ${shlibs:Depends}, ${misc:Depends}
Section: libdevel
Multi-Arch: same
Description: Runtime locking correctness validator - development files
TBD