summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools
diff options
context:
space:
mode:
authorRoy Li <rongqing.li@windriver.com>2015-09-14 17:27:40 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-18 09:05:25 +0100
commit82be1f3ba2e3101590b819b83fdb263d18177083 (patch)
treee1f503e8b80333940bb3ab363d7c33f1141358a4 /meta/recipes-devtools
parentdc3bc2283cdf7e80d82ba3ddd32ea5a9143d3d73 (diff)
downloadpoky-82be1f3ba2e3101590b819b83fdb263d18177083.tar.gz
squashfs-tools: make it be able to be compiled by gcc5 with "-O0"
(From OE-Core rev: e0d5e6a7d31f0e69f65f9bf3f1027b91c9bd23cc) Signed-off-by: Roy Li <rongqing.li@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r--meta/recipes-devtools/squashfs-tools/squashfs-tools/0001-mksquashfs.c-get-inline-functions-work-with-C99.patch154
-rw-r--r--meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb1
2 files changed, 155 insertions, 0 deletions
diff --git a/meta/recipes-devtools/squashfs-tools/squashfs-tools/0001-mksquashfs.c-get-inline-functions-work-with-C99.patch b/meta/recipes-devtools/squashfs-tools/squashfs-tools/0001-mksquashfs.c-get-inline-functions-work-with-C99.patch
new file mode 100644
index 0000000000..a5bab05448
--- /dev/null
+++ b/meta/recipes-devtools/squashfs-tools/squashfs-tools/0001-mksquashfs.c-get-inline-functions-work-with-C99.patch
@@ -0,0 +1,154 @@
1From ac6268e843c43286eebff2a1052182c2393cdb2e Mon Sep 17 00:00:00 2001
2From: Roy Li <rongqing.li@windriver.com>
3Date: Mon, 14 Sep 2015 12:31:42 +0800
4Subject: [PATCH] mksquashfs.c: get inline functions work with both gnu11 and gnu89
5
6Upstream-Status: Pending
7
8After gcc upgraded to gcc5, and if the codes is compiled without optimization(-O0),
9and the below error will happen:
10
11| mksquashfs.o: In function `create_inode':
12| git/squashfs-tools/mksquashfs.c:897: undefined reference to `get_inode_no'
13| git/squashfs-tools/mksquashfs.c:960: undefined reference to `get_parent_no'
14| git/squashfs-tools/mksquashfs.c:983: undefined reference to `get_parent_no'
15| mksquashfs.o: In function `reader_read_process':
16| git/squashfs-tools/mksquashfs.c:2132: undefined reference to `is_fragment'
17| mksquashfs.o: In function `reader_read_file':
18| git/squashfs-tools/mksquashfs.c:2228: undefined reference to `is_fragment'
19| mksquashfs.o: In function `dir_scan':
20| git/squashfs-tools/mksquashfs.c:3101: undefined reference to `create_dir_entry'
21
22gcc5 defaults to -std=gnu11 instead of -std=gnu89, and it requires that exactly one C
23source file has the callable copy of the inline function. Consider the following
24program:
25
26 inline int
27 foo (void)
28 {
29 return 42;
30 }
31
32 int
33 main (void)
34 {
35 return foo ();
36 }
37
38The program above will not link with the C99 inline semantics, because no out-of-line
39function foo is generated. To fix this, either mark the function foo as static, or
40add the following declaration:
41 static inline int foo (void);
42
43more information refer to: https://gcc.gnu.org/gcc-5/porting_to.html;
44
45but the use of "extern inline" will lead to the compilation issue if gcc is not
46gcc5, as the commit in oe-core d0af30c92fde [alsa-lib: Change function type to
47"static __inline__"]
48 "extern __inline__ function()" is the inlined version that
49 can be used in this compilation unit, but there will be another
50 definition of this function somewhere, so compiler will not emit
51 any code for the function body. This causes problem in -O0,
52 where functions are never inlined, the function call is preserved,
53 but linker can't find the symbol, thus the error happens.
54
55so replace "inline" with "static inline" to make it work with both gnu11 and gnu89
56
57Signed-off-by: Roy Li <rongqing.li@windriver.com>
58---
59 squashfs-tools/mksquashfs.c | 20 ++++++++++----------
60 1 file changed, 10 insertions(+), 10 deletions(-)
61
62diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c
63index d221c35..6bba1d2 100644
64--- a/squashfs-tools/mksquashfs.c
65+++ b/squashfs-tools/mksquashfs.c
66@@ -828,13 +828,13 @@ char *subpathname(struct dir_ent *dir_ent)
67 }
68
69
70-inline unsigned int get_inode_no(struct inode_info *inode)
71+static inline unsigned int get_inode_no(struct inode_info *inode)
72 {
73 return inode->inode_number;
74 }
75
76
77-inline unsigned int get_parent_no(struct dir_info *dir)
78+static inline unsigned int get_parent_no(struct dir_info *dir)
79 {
80 return dir->depth ? get_inode_no(dir->dir_ent->inode) : inode_no;
81 }
82@@ -2027,7 +2027,7 @@ struct file_info *duplicate(long long file_size, long long bytes,
83 }
84
85
86-inline int is_fragment(struct inode_info *inode)
87+static inline int is_fragment(struct inode_info *inode)
88 {
89 off_t file_size = inode->buf.st_size;
90
91@@ -2996,13 +2996,13 @@ struct inode_info *lookup_inode2(struct stat *buf, int pseudo, int id)
92 }
93
94
95-inline struct inode_info *lookup_inode(struct stat *buf)
96+static inline struct inode_info *lookup_inode(struct stat *buf)
97 {
98 return lookup_inode2(buf, 0, 0);
99 }
100
101
102-inline void alloc_inode_no(struct inode_info *inode, unsigned int use_this)
103+static inline void alloc_inode_no(struct inode_info *inode, unsigned int use_this)
104 {
105 if (inode->inode_number == 0) {
106 inode->inode_number = use_this ? : inode_no ++;
107@@ -3013,7 +3013,7 @@ inline void alloc_inode_no(struct inode_info *inode, unsigned int use_this)
108 }
109
110
111-inline struct dir_ent *create_dir_entry(char *name, char *source_name,
112+static inline struct dir_ent *create_dir_entry(char *name, char *source_name,
113 char *nonstandard_pathname, struct dir_info *dir)
114 {
115 struct dir_ent *dir_ent = malloc(sizeof(struct dir_ent));
116@@ -3031,7 +3031,7 @@ inline struct dir_ent *create_dir_entry(char *name, char *source_name,
117 }
118
119
120-inline void add_dir_entry(struct dir_ent *dir_ent, struct dir_info *sub_dir,
121+static inline void add_dir_entry(struct dir_ent *dir_ent, struct dir_info *sub_dir,
122 struct inode_info *inode_info)
123 {
124 struct dir_info *dir = dir_ent->our_dir;
125@@ -3047,7 +3047,7 @@ inline void add_dir_entry(struct dir_ent *dir_ent, struct dir_info *sub_dir,
126 }
127
128
129-inline void add_dir_entry2(char *name, char *source_name,
130+static inline void add_dir_entry2(char *name, char *source_name,
131 char *nonstandard_pathname, struct dir_info *sub_dir,
132 struct inode_info *inode_info, struct dir_info *dir)
133 {
134@@ -3059,7 +3059,7 @@ inline void add_dir_entry2(char *name, char *source_name,
135 }
136
137
138-inline void free_dir_entry(struct dir_ent *dir_ent)
139+static inline void free_dir_entry(struct dir_ent *dir_ent)
140 {
141 if(dir_ent->name)
142 free(dir_ent->name);
143@@ -3080,7 +3080,7 @@ inline void free_dir_entry(struct dir_ent *dir_ent)
144 }
145
146
147-inline void add_excluded(struct dir_info *dir)
148+static inline void add_excluded(struct dir_info *dir)
149 {
150 dir->excluded ++;
151 }
152--
1531.9.1
154
diff --git a/meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb b/meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb
index 497b282074..7aebd00e0b 100644
--- a/meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb
+++ b/meta/recipes-devtools/squashfs-tools/squashfs-tools_git.bb
@@ -12,6 +12,7 @@ PV = "4.3+gitr${SRCPV}"
12SRCREV = "9c1db6d13a51a2e009f0027ef336ce03624eac0d" 12SRCREV = "9c1db6d13a51a2e009f0027ef336ce03624eac0d"
13SRC_URI = "git://github.com/plougher/squashfs-tools.git;protocol=https \ 13SRC_URI = "git://github.com/plougher/squashfs-tools.git;protocol=https \
14 http://downloads.sourceforge.net/sevenzip/lzma465.tar.bz2;name=lzma \ 14 http://downloads.sourceforge.net/sevenzip/lzma465.tar.bz2;name=lzma \
15 file://0001-mksquashfs.c-get-inline-functions-work-with-C99.patch;striplevel=2 \
15" 16"
16SRC_URI[lzma.md5sum] = "29d5ffd03a5a3e51aef6a74e9eafb759" 17SRC_URI[lzma.md5sum] = "29d5ffd03a5a3e51aef6a74e9eafb759"
17SRC_URI[lzma.sha256sum] = "c935fd04dd8e0e8c688a3078f3675d699679a90be81c12686837e0880aa0fa1e" 18SRC_URI[lzma.sha256sum] = "c935fd04dd8e0e8c688a3078f3675d699679a90be81c12686837e0880aa0fa1e"