|
From: Baruch S. <ba...@tk...> - 2017-08-04 05:40:30
|
gcc 7 with the -Os optimization level (optimize for size) removes sometimes
the code of inline routines. This leads to link failure:
mksquashfs.o: In function `scan1_single_readdir':
mksquashfs.c:(.text+0x139): undefined reference to `add_dir_entry2'
mksquashfs.c:(.text+0x1f4): undefined reference to `create_dir_entry'
mksquashfs.o: In function `create_inode':
mksquashfs.c:(.text+0x1524): undefined reference to `get_parent_no'
mksquashfs.c:(.text+0x15c1): undefined reference to `get_parent_no'
mksquashfs.o: In function `reader_read_process':
mksquashfs.c:(.text+0x2f94): undefined reference to `is_fragment'
mksquashfs.o: In function `reader_read_file':
mksquashfs.c:(.text+0x312b): undefined reference to `is_fragment'
mksquashfs.o: In function `scan1_encomp_readdir':
mksquashfs.c:(.text+0x42ed): undefined reference to `add_dir_entry2'
mksquashfs.c:(.text+0x4449): undefined reference to `create_dir_entry'
mksquashfs.o: In function `dir_scan2':
mksquashfs.c:(.text+0x491a): undefined reference to `create_dir_entry'
mksquashfs.c:(.text+0x49f1): undefined reference to `add_dir_entry'
mksquashfs.c:(.text+0x4a58): undefined reference to `add_dir_entry2'
mksquashfs.o: In function `free_dir':
mksquashfs.c:(.text+0x4af6): undefined reference to `free_dir_entry'
mksquashfs.o: In function `dir_scan4':
mksquashfs.c:(.text+0x4bae): undefined reference to `free_dir_entry'
mksquashfs.o: In function `dir_scan5':
mksquashfs.c:(.text+0x4c5f): undefined reference to `free_dir_entry'
mksquashfs.o: In function `dir_scan6':
mksquashfs.c:(.text+0x4df4): undefined reference to `alloc_inode_no'
mksquashfs.o: In function `dir_scan.part.26':
mksquashfs.c:(.text+0x548f): undefined reference to `create_dir_entry'
mksquashfs.c:(.text+0x553c): undefined reference to `lookup_inode'
mksquashfs.c:(.text+0x55e5): undefined reference to `alloc_inode_no'
mksquashfs.o: In function `dir_scan1':
mksquashfs.c:(.text+0x6150): undefined reference to `free_dir_entry'
mksquashfs.c:(.text+0x6322): undefined reference to `lookup_inode'
mksquashfs.c:(.text+0x6335): undefined reference to `free_dir_entry'
mksquashfs.c:(.text+0x63dd): undefined reference to `lookup_inode'
mksquashfs.c:(.text+0x63ea): undefined reference to `add_dir_entry'
mksquashfs.o: In function `scan1_readdir':
mksquashfs.c:(.text+0x27): undefined reference to `create_dir_entry'
Since these routines are local to mksquashfs.c declare them as static to avoid
this failure.
Signed-off-by: Baruch Siach <ba...@tk...>
---
squashfs-tools/mksquashfs.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c
index 75b357732439..7260c9045855 100644
--- a/squashfs-tools/mksquashfs.c
+++ b/squashfs-tools/mksquashfs.c
@@ -830,13 +830,13 @@ char *subpathname(struct dir_ent *dir_ent)
}
-inline unsigned int get_inode_no(struct inode_info *inode)
+static inline unsigned int get_inode_no(struct inode_info *inode)
{
return inode->inode_number;
}
-inline unsigned int get_parent_no(struct dir_info *dir)
+static inline unsigned int get_parent_no(struct dir_info *dir)
{
return dir->depth ? get_inode_no(dir->dir_ent->inode) : inode_no;
}
@@ -2030,7 +2030,7 @@ struct file_info *duplicate(long long file_size, long long bytes,
}
-inline int is_fragment(struct inode_info *inode)
+static inline int is_fragment(struct inode_info *inode)
{
off_t file_size = inode->buf.st_size;
@@ -2993,19 +2993,19 @@ struct inode_info *lookup_inode3(struct stat *buf, int pseudo, int id,
}
-struct inode_info *lookup_inode2(struct stat *buf, int pseudo, int id)
+static struct inode_info *lookup_inode2(struct stat *buf, int pseudo, int id)
{
return lookup_inode3(buf, pseudo, id, NULL, 0);
}
-inline struct inode_info *lookup_inode(struct stat *buf)
+static inline struct inode_info *lookup_inode(struct stat *buf)
{
return lookup_inode2(buf, 0, 0);
}
-inline void alloc_inode_no(struct inode_info *inode, unsigned int use_this)
+static inline void alloc_inode_no(struct inode_info *inode, unsigned int use_this)
{
if (inode->inode_number == 0) {
inode->inode_number = use_this ? : inode_no ++;
@@ -3016,7 +3016,7 @@ inline void alloc_inode_no(struct inode_info *inode, unsigned int use_this)
}
-inline struct dir_ent *create_dir_entry(char *name, char *source_name,
+static inline struct dir_ent *create_dir_entry(char *name, char *source_name,
char *nonstandard_pathname, struct dir_info *dir)
{
struct dir_ent *dir_ent = malloc(sizeof(struct dir_ent));
@@ -3034,7 +3034,7 @@ inline struct dir_ent *create_dir_entry(char *name, char *source_name,
}
-inline void add_dir_entry(struct dir_ent *dir_ent, struct dir_info *sub_dir,
+static inline void add_dir_entry(struct dir_ent *dir_ent, struct dir_info *sub_dir,
struct inode_info *inode_info)
{
struct dir_info *dir = dir_ent->our_dir;
@@ -3050,7 +3050,7 @@ inline void add_dir_entry(struct dir_ent *dir_ent, struct dir_info *sub_dir,
}
-inline void add_dir_entry2(char *name, char *source_name,
+static inline void add_dir_entry2(char *name, char *source_name,
char *nonstandard_pathname, struct dir_info *sub_dir,
struct inode_info *inode_info, struct dir_info *dir)
{
@@ -3062,7 +3062,7 @@ inline void add_dir_entry2(char *name, char *source_name,
}
-inline void free_dir_entry(struct dir_ent *dir_ent)
+static inline void free_dir_entry(struct dir_ent *dir_ent)
{
if(dir_ent->name)
free(dir_ent->name);
@@ -3083,7 +3083,7 @@ inline void free_dir_entry(struct dir_ent *dir_ent)
}
-inline void add_excluded(struct dir_info *dir)
+static inline void add_excluded(struct dir_info *dir)
{
dir->excluded ++;
}
--
2.13.2
|