[PATCH 1/7] liblockdep: Fix undefined symbol prandom_u32

From: Ben Hutchings
Date: Tue Jun 14 2016 - 16:55:26 EST


__lock_pin_lock() now calls prandom_u32() which is not defined in
liblockdep. __lock_pin_lock() and its caller lock_pin_lock() are dead
code in liblockdep, but we still need to provide a definition of
prandom_u32() in case lazy binding is disabled.

Fixes: e7904a28f533 ("locking/lockdep, sched/core: Implement a better ...")
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
tools/lib/lockdep/common.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/tools/lib/lockdep/common.c b/tools/lib/lockdep/common.c
index d1c89cc06f5f..405c17667c4d 100644
--- a/tools/lib/lockdep/common.c
+++ b/tools/lib/lockdep/common.c
@@ -1,5 +1,6 @@
#include <stddef.h>
#include <stdbool.h>
+#include <stdlib.h>
#include <linux/compiler.h>
#include <linux/lockdep.h>
#include <unistd.h>
@@ -10,6 +11,11 @@ static __thread struct task_struct current_obj;
/* lockdep wants these */
bool debug_locks = true;
bool debug_locks_silent;
+u32 prandom_u32(void)
+{
+ /* Used only by lock_pin_lock() which is dead code */
+ abort();
+}

__attribute__((destructor)) static void liblockdep_exit(void)
{

Attachment: signature.asc
Description: Digital signature