summaryrefslogtreecommitdiffstats
path: root/import-layers/meta-openembedded/meta-oe/recipes-extended/libuio/libuio/replace_inline_with_static-inline.patch
blob: fd314bfee5848520dd94adfe099b4c1d0eb1fdcc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
By default, gcc-5 uses C99 inline semantics, this semantics doesn't 
generate externally visible function for inline functions. This results in 
below error, when an another translation unit (TU) tries to link with the 
inline function,

-- snip --
| lsuio.o: In function `main':
| <...>/libuio/0.2.1-r0/git/tools/lsuio.c:85: undefined reference to `uio_mmap'
| collect2: error: ld returned 1 exit status
| make[2]: *** [lsuio] Error 1
-- CUT --

To solve this error and make libuio to compile with both 4.x and 5.x,

1. We can remove 'uio_mmap' inline function definition in uio_mmap.c, and move
   that definition into uio_helper.h file (which is included by lsuio.c) and 
   replace inline with "static inline". Similarly it can be done to other 
   uio_single_munmap and uio_munmap inline functions

2. Add 'extern' keyword in front of inline functions declaration, to make 
   inlined function as externally visible function, and to link with other TUs.

Going with option 1.

Upstream-Status: Pending

Signed-off-by: Jagadeesh Krishnanjanappa <jkrishnanjanappa@mvista.com>

--- git_org/src/uio_helper.h	2015-10-20 02:37:04.183075855 -0400
+++ git/src/uio_helper.h	2015-10-20 03:34:24.659970136 -0400
@@ -61,11 +61,11 @@ struct uio_info_t {
 
 /* function prototypes */
 
-inline char* uio_lib_name(void);
-inline char* uio_lib_version(void);
-inline int uio_lib_ifcurrent(void);
-inline int uio_lib_ifrevision(void);
-inline int uio_lib_ifage(void);
+static inline char* uio_lib_name(void);
+static inline char* uio_lib_version(void);
+static inline int uio_lib_ifcurrent(void);
+static inline int uio_lib_ifrevision(void);
+static inline int uio_lib_ifage(void);
 
 int uio_get_mem_size(struct uio_info_t* info, int map_num);
 int uio_get_mem_addr(struct uio_info_t* info, int map_num);
@@ -76,10 +76,30 @@ int uio_get_all_info(struct uio_info_t* 
 int uio_get_device_attributes(struct uio_info_t* info);
 
 void* uio_single_mmap(struct uio_info_t* info, int map_num, int fd);
-inline void uio_mmap(struct uio_info_t* info, int fd);
 
-inline void uio_single_munmap(struct uio_info_t* info, int map_num);
-inline void uio_munmap(struct uio_info_t* info);
+static inline void uio_mmap(struct uio_info_t* info, int fd);
+static inline void uio_mmap(struct uio_info_t* info, int fd)
+{
+        int map_num;
+        if (!fd) return;
+        for (map_num= 0; map_num < MAX_UIO_MAPS; map_num++)
+                uio_single_mmap(info, map_num, fd);
+}
+
+static inline void uio_single_munmap(struct uio_info_t* info, int map_num);
+static inline void uio_single_munmap(struct uio_info_t* info, int map_num)
+{
+        munmap(info->maps[map_num].internal_addr, info->maps[map_num].size);
+        info->maps[map_num].mmap_result = UIO_MMAP_NOT_DONE;
+}
+
+static inline void uio_munmap(struct uio_info_t* info);
+static inline void uio_munmap(struct uio_info_t* info)
+{
+        int i;
+        for (i = 0; i < MAX_UIO_MAPS; i++)
+                uio_single_munmap(info, i);
+}
 
 void uio_free_dev_attrs(struct uio_info_t* info);
 void uio_free_info(struct uio_info_t* info);
--- git_org/src/uio_mmap.c	2015-10-20 02:37:04.183075855 -0400
+++ git/src/uio_mmap.c	2015-10-20 03:34:45.060003208 -0400
@@ -22,11 +22,3 @@
 #include <stdlib.h>
 
 #include "uio_helper.h"
-
-inline void uio_mmap(struct uio_info_t* info, int fd)
-{
-	int map_num;
-	if (!fd) return;
-	for (map_num= 0; map_num < MAX_UIO_MAPS; map_num++)
-		uio_single_mmap(info, map_num, fd);
-}
--- git_org/src/uio_munmap.c	2015-10-20 02:37:04.183075855 -0400
+++ git/src/uio_munmap.c	2015-10-20 03:34:59.636026835 -0400
@@ -22,10 +22,3 @@
 #include <stdlib.h>
 
 #include "uio_helper.h"
-
-inline void uio_munmap(struct uio_info_t* info)
-{
-	int i;
-	for (i = 0; i < MAX_UIO_MAPS; i++)
-		uio_single_munmap(info, i);
-}
\ No newline at end of file
--- git_org/src/uio_single_munmap.c	2015-10-20 02:37:04.183075855 -0400
+++ git/src/uio_single_munmap.c	2015-10-20 03:52:55.005763023 -0400
@@ -24,9 +24,3 @@
 #include <sys/mman.h>
 
 #include "uio_helper.h"
-
-inline void uio_single_munmap(struct uio_info_t* info, int map_num)
-{
-	munmap(info->maps[map_num].internal_addr, info->maps[map_num].size);
-	info->maps[map_num].mmap_result = UIO_MMAP_NOT_DONE;
-}
OpenPOWER on IntegriCloud