Fix dynamic linking with GNU gold linker
[lttng-ust.git] / include / lttng / tracepoint-rcu.h
CommitLineData
40b2b5a4
MD
1#ifndef _LTTNG_TRACEPOINT_RCU_H
2#define _LTTNG_TRACEPOINT_RCU_H
3
4/*
5 * Copyright (c) 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 *
7 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
8 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
9 *
10 * Permission is hereby granted to use or copy this program
11 * for any purpose, provided the above notices are retained on all copies.
12 * Permission to modify the code and to distribute modified code is granted,
13 * provided the above notices are retained, and a notice that the code was
14 * modified is included with the above copyright notice.
15 *
16 * This file allows weak linking on tracepoint RCU symbols for non-LGPL
17 * code.
18 */
19
20#include <urcu/compiler.h>
21
22#ifdef _LGPL_SOURCE
23
24#include <urcu-bp.h>
25
26#define TP_RCU_LINK_TEST() 1
27#define tp_rcu_read_lock_bp rcu_read_lock_bp
28#define tp_rcu_read_unlock_bp rcu_read_unlock_bp
29#define tp_rcu_dereference_bp rcu_dereference_bp
30
31#else /* _LGPL_SOURCE */
32
33#define TP_RCU_LINK_TEST() tp_rcu_read_lock_bp
34
35/* Symbols looked up with dlsym */
36static void (*tp_rcu_read_lock_bp)(void) __attribute__((unused));
37static void (*tp_rcu_read_unlock_bp)(void) __attribute__((unused));
38static void *(*tp_rcu_dereference_sym_bp)(void *p) __attribute__((unused));
39
40#define tp_rcu_dereference_bp(p) \
41 ({ \
42 typeof(p) _________p1 = URCU_FORCE_CAST(typeof(p), \
43 tp_rcu_dereference_sym_bp(URCU_FORCE_CAST(void *, p))); \
44 (_________p1); \
45 })
46
47#endif /* _LGPL_SOURCE */
48
49#endif /* _LTTNG_TRACEPOINT_RCU_H */
This page took 0.040686 seconds and 4 git commands to generate.