0002-fix-build-failure-against-gcc-10.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. From fe2f5da4b0f8994169c53e84b7cb8a0feefc97b5 Mon Sep 17 00:00:00 2001
  2. From: Sergei Trofimovich <slyfox@gentoo.org>
  3. Date: Sun, 26 Jan 2020 18:35:13 +0000
  4. Subject: [PATCH] squashfs-tools: fix build failure against gcc-10
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. On gcc-10 (and gcc-9 -fno-common) build fails as:
  9. ```
  10. cc ... -o mksquashfs
  11. ld: read_fs.o:(.bss+0x0):
  12. multiple definition of `fwriter_buffer'; mksquashfs.o:(.bss+0x400c90): first defined here
  13. ld: read_fs.o:(.bss+0x8):
  14. multiple definition of `bwriter_buffer'; mksquashfs.o:(.bss+0x400c98): first defined here
  15. ```
  16. gcc-10 will change the default from -fcommon to fno-common:
  17. https://gcc.gnu.org/PR85678.
  18. The error also happens if CFLAGS=-fno-common passed explicitly.
  19. Reported-by: Toralf Förster
  20. Bug: https://bugs.gentoo.org/706456
  21. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
  22. ---
  23. squashfs-tools/mksquashfs.h | 2 +-
  24. 1 file changed, 1 insertion(+), 1 deletion(-)
  25. diff --git a/squashfs-tools/mksquashfs.h b/squashfs-tools/mksquashfs.h
  26. index 1beefef7..b6503063 100644
  27. --- a/squashfs-tools/mksquashfs.h
  28. +++ b/squashfs-tools/mksquashfs.h
  29. @@ -143,7 +143,7 @@ struct append_file {
  30. #endif
  31. extern struct cache *reader_buffer, *fragment_buffer, *reserve_cache;
  32. -struct cache *bwriter_buffer, *fwriter_buffer;
  33. +extern struct cache *bwriter_buffer, *fwriter_buffer;
  34. extern struct queue *to_reader, *to_deflate, *to_writer, *from_writer,
  35. *to_frag, *locked_fragment, *to_process_frag;
  36. extern struct append_file **file_mapping;