Backport OpenWrt patch to fix squashfs build with gcc 10

Submitted by Fabian Blaese on June 16, 2020, 8:40 a.m.

Details

Message ID 20200616084001.1828963-1-fabian@blaese.de
State Accepted
Headers show

Commit Message

Fabian Blaese June 16, 2020, 8:40 a.m.
This patch is already included in the openwrt-19.07 branch,
so our backport can be removed when upgrading to or past
OpenWrt 19.07.4.

Signed-off-by: Fabian Bläse <fabian@blaese.de>
---
 ...004-squashfs-Fix-compile-with-GCC-10.patch | 47 +++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 build_patches/openwrt/0004-squashfs-Fix-compile-with-GCC-10.patch

Patch hide | download patch | download mbox

diff --git a/build_patches/openwrt/0004-squashfs-Fix-compile-with-GCC-10.patch b/build_patches/openwrt/0004-squashfs-Fix-compile-with-GCC-10.patch
new file mode 100644
index 0000000..f3d5966
--- /dev/null
+++ b/build_patches/openwrt/0004-squashfs-Fix-compile-with-GCC-10.patch
@@ -0,0 +1,47 @@ 
+From 1bbc1aa884902fd05cc579b53d68b2ba0b18683f Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke@hauke-m.de>
+Date: Sun, 24 May 2020 12:23:31 +0200
+Subject: [PATCH] squashfs: Fix compile with GCC 10
+
+Fixes the following build error with GCC 10:
+	/usr/bin/ld: read_fs.o:(.bss+0x0): multiple definition of `swap'; mksquashfs.o:(.bss+0x1b2a88): first defined here
+And a compile warning.
+
+Fixes: FS#3104, FS#3119
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+---
+ tools/squashfs/patches/140-gcc-10-fix.patch | 25 +++++++++++++++++++++
+ 1 file changed, 25 insertions(+)
+ create mode 100644 tools/squashfs/patches/140-gcc-10-fix.patch
+
+diff --git a/tools/squashfs/patches/140-gcc-10-fix.patch b/tools/squashfs/patches/140-gcc-10-fix.patch
+new file mode 100644
+index 00000000000..a02641f3072
+--- /dev/null
++++ b/tools/squashfs/patches/140-gcc-10-fix.patch
+@@ -0,0 +1,25 @@
++Fixes the following build error with GCC 10:
++	/usr/bin/ld: read_fs.o:(.bss+0x0): multiple definition of `swap'; mksquashfs.o:(.bss+0x1b2a88): first defined here
++And a compile warning.
++
++--- a/squashfs-tools/read_fs.c
+++++ b/squashfs-tools/read_fs.c
++@@ -61,7 +61,7 @@ extern int add_file(long long, long long
++ 						fprintf(stderr, s, ## args); \
++ 					} while(0)
++ 
++-int swap;
+++static int swap;
++ 
++ int read_block(int fd, long long start, long long *next, unsigned char *block, squashfs_super_block *sBlk)
++ {
++--- a/squashfs-tools/mksquashfs.c
+++++ b/squashfs-tools/mksquashfs.c
++@@ -258,6 +258,7 @@ int read_sort_file(char *filename, int s
++ void sort_files_and_write(struct dir_info *dir);
++ struct file_info *duplicate(char *(get_next_file_block)(struct duplicate_buffer_handle *, unsigned int), struct duplicate_buffer_handle *file_start, long long bytes, unsigned int **block_list, long long *start, int blocks, struct fragment **fragment, char *frag_data, int frag_bytes);
++ struct dir_info *dir_scan1(char *, int (_readdir)(char *, char *, struct dir_info *));
+++int dir_scan2(squashfs_inode *inode, struct dir_info *dir_info);
++ 
++ #define MKINODE(A)	((squashfs_inode)(((squashfs_inode) inode_bytes << 16) + (((char *)A) - data_cache)))
++ 

Comments

Adrian Schmutzler June 18, 2020, 10:32 a.m.
Reviewed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>

Wird gleich gemergt, werde den commit Titel etwas anpassen, sodass build_patches darin vorkommt.

> -----Original Message-----
> From: franken-dev [mailto:franken-dev-bounces@freifunk.net] On Behalf
> Of Fabian Bläse
> Sent: Dienstag, 16. Juni 2020 10:40
> To: franken-dev@freifunk.net
> Subject: [PATCH] Backport OpenWrt patch to fix squashfs build with gcc 10
> 
> This patch is already included in the openwrt-19.07 branch, so our backport
> can be removed when upgrading to or past OpenWrt 19.07.4.
> 
> Signed-off-by: Fabian Bläse <fabian@blaese.de>
> ---
>  ...004-squashfs-Fix-compile-with-GCC-10.patch | 47
> +++++++++++++++++++
>  1 file changed, 47 insertions(+)
>  create mode 100644 build_patches/openwrt/0004-squashfs-Fix-compile-
> with-GCC-10.patch
> 
> diff --git a/build_patches/openwrt/0004-squashfs-Fix-compile-with-GCC-
> 10.patch b/build_patches/openwrt/0004-squashfs-Fix-compile-with-GCC-
> 10.patch
> new file mode 100644
> index 0000000..f3d5966
> --- /dev/null
> +++ b/build_patches/openwrt/0004-squashfs-Fix-compile-with-GCC-
> 10.patch
> @@ -0,0 +1,47 @@
> +From 1bbc1aa884902fd05cc579b53d68b2ba0b18683f Mon Sep 17 00:00:00
> 2001
> +From: Hauke Mehrtens <hauke@hauke-m.de>
> +Date: Sun, 24 May 2020 12:23:31 +0200
> +Subject: [PATCH] squashfs: Fix compile with GCC 10
> +
> +Fixes the following build error with GCC 10:
> +	/usr/bin/ld: read_fs.o:(.bss+0x0): multiple definition of `swap';
> +mksquashfs.o:(.bss+0x1b2a88): first defined here And a compile warning.
> +
> +Fixes: FS#3104, FS#3119
> +Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> +---
> + tools/squashfs/patches/140-gcc-10-fix.patch | 25
> +++++++++++++++++++++
> + 1 file changed, 25 insertions(+)
> + create mode 100644 tools/squashfs/patches/140-gcc-10-fix.patch
> +
> +diff --git a/tools/squashfs/patches/140-gcc-10-fix.patch
> +b/tools/squashfs/patches/140-gcc-10-fix.patch
> +new file mode 100644
> +index 00000000000..a02641f3072
> +--- /dev/null
> ++++ b/tools/squashfs/patches/140-gcc-10-fix.patch
> +@@ -0,0 +1,25 @@
> ++Fixes the following build error with GCC 10:
> ++	/usr/bin/ld: read_fs.o:(.bss+0x0): multiple definition of `swap';
> ++mksquashfs.o:(.bss+0x1b2a88): first defined here And a compile warning.
> ++
> ++--- a/squashfs-tools/read_fs.c
> +++++ b/squashfs-tools/read_fs.c
> ++@@ -61,7 +61,7 @@ extern int add_file(long long, long long
> ++ 						fprintf(stderr, s, ## args); \
> ++ 					} while(0)
> ++
> ++-int swap;
> +++static int swap;
> ++
> ++ int read_block(int fd, long long start, long long *next, unsigned
> ++char *block, squashfs_super_block *sBlk)  {
> ++--- a/squashfs-tools/mksquashfs.c
> +++++ b/squashfs-tools/mksquashfs.c
> ++@@ -258,6 +258,7 @@ int read_sort_file(char *filename, int s  void
> ++sort_files_and_write(struct dir_info *dir);  struct file_info
> ++*duplicate(char *(get_next_file_block)(struct duplicate_buffer_handle
> ++*, unsigned int), struct duplicate_buffer_handle *file_start, long
> ++long bytes, unsigned int **block_list, long long *start, int blocks,
> ++struct fragment **fragment, char *frag_data, int frag_bytes);  struct
> ++dir_info *dir_scan1(char *, int (_readdir)(char *, char *, struct
> ++dir_info *));
> +++int dir_scan2(squashfs_inode *inode, struct dir_info *dir_info);
> ++
> ++ #define MKINODE(A)	((squashfs_inode)(((squashfs_inode)
> inode_bytes << 16) + (((char *)A) - data_cache)))
> ++
> --
> 2.27.0