0001-fix-build-with-gcc-10.patch 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. From 9fecb6ce056f25837dffac95260d5a80b9f468c0 Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Wed, 19 Aug 2020 10:37:07 +0200
  4. Subject: [PATCH] fix build with gcc 10
  5. Move initialisation of global variables to main functions to fix the
  6. following build failure with gcc 10:
  7. /tmp/instance-1/output-1/host/lib/gcc/arm-buildroot-linux-gnueabihf/10.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: ./libgdbmapp.a(parseopt.o):(.bss+0x2c): multiple definition of `parseopt_program_args'; gdbm_dump.o:(.data.rel.local+0x28): first defined here
  8. /tmp/instance-1/output-1/host/lib/gcc/arm-buildroot-linux-gnueabihf/10.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: ./libgdbmapp.a(parseopt.o):(.bss+0x30): multiple definition of `parseopt_program_doc'; gdbm_dump.o:(.data.rel.local+0x2c): first defined here
  9. /tmp/instance-1/output-1/host/lib/gcc/arm-buildroot-linux-gnueabihf/10.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: ./libgdbmapp.a(parseopt.o):(.bss+0x2c): multiple definition of `parseopt_program_args'; gdbm_load.o:(.data.rel.local+0xa0): first defined here
  10. /tmp/instance-1/output-1/host/lib/gcc/arm-buildroot-linux-gnueabihf/10.2.0/../../../../arm-buildroot-linux-gnueabihf/bin/ld: ./libgdbmapp.a(parseopt.o):(.bss+0x30): multiple definition of `parseopt_program_doc'; gdbm_load.o:(.data.rel.local+0xa4): first defined here
  11. Fixes:
  12. - http://autobuild.buildroot.org/results/d09b5368bb624df629296359a5abcdd37ba61e9e
  13. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  14. [Upstream status: sent to Sergey Poznyakoff <gray@gnu.org>]
  15. ---
  16. src/gdbm_dump.c | 5 +++--
  17. src/gdbm_load.c | 5 +++--
  18. src/gdbmtool.c | 5 +++--
  19. 3 files changed, 9 insertions(+), 6 deletions(-)
  20. diff --git a/src/gdbm_dump.c b/src/gdbm_dump.c
  21. index 82fb5af..67574ac 100644
  22. --- a/src/gdbm_dump.c
  23. +++ b/src/gdbm_dump.c
  24. @@ -19,8 +19,6 @@
  25. # include "gdbmapp.h"
  26. # include "gdbmdefs.h"
  27. -char *parseopt_program_doc = "dump a GDBM database to a file";
  28. -char *parseopt_program_args = "DB_FILE [FILE]";
  29. struct gdbm_option optab[] = {
  30. { 'H', "format", "binary|ascii|0|1", N_("select dump format") },
  31. { 0 }
  32. @@ -36,6 +34,9 @@ main (int argc, char **argv)
  33. char *dbname, *filename;
  34. FILE *fp;
  35. + parseopt_program_doc = "dump a GDBM database to a file";
  36. + parseopt_program_args = "DB_FILE [FILE]";
  37. +
  38. #ifdef HAVE_SETLOCALE
  39. setlocale (LC_ALL, "");
  40. #endif
  41. diff --git a/src/gdbm_load.c b/src/gdbm_load.c
  42. index 2d96ada..1b2739c 100644
  43. --- a/src/gdbm_load.c
  44. +++ b/src/gdbm_load.c
  45. @@ -29,8 +29,6 @@ int mode;
  46. uid_t owner_uid;
  47. gid_t owner_gid;
  48. -char *parseopt_program_doc = "load a GDBM database from a file";
  49. -char *parseopt_program_args = "FILE [DB_FILE]";
  50. struct gdbm_option optab[] = {
  51. { 'r', "replace", NULL, N_("replace records in the existing database") },
  52. { 'm', "mode", N_("MODE"), N_("set file mode") },
  53. @@ -100,6 +98,9 @@ main (int argc, char **argv)
  54. int cache_size = 0;
  55. int block_size = 0;
  56. + parseopt_program_doc = "load a GDBM database from a file";
  57. + parseopt_program_args = "FILE [DB_FILE]";
  58. +
  59. #ifdef HAVE_SETLOCALE
  60. setlocale (LC_ALL, "");
  61. #endif
  62. diff --git a/src/gdbmtool.c b/src/gdbmtool.c
  63. index bbadbae..69bc3b1 100644
  64. --- a/src/gdbmtool.c
  65. +++ b/src/gdbmtool.c
  66. @@ -1535,8 +1535,6 @@ command_lookup (const char *str, struct locus *loc, struct command **pcmd)
  67. return found->tok;
  68. }
  69. -char *parseopt_program_doc = N_("examine and/or modify a GDBM database");
  70. -char *parseopt_program_args = N_("DBFILE [COMMAND [ARG ...]]");
  71. enum {
  72. OPT_LEX_TRACE = 256,
  73. @@ -2053,6 +2051,9 @@ main (int argc, char *argv[])
  74. char *source = NULL;
  75. instream_t input = NULL;
  76. + parseopt_program_doc = N_("examine and/or modify a GDBM database");
  77. + parseopt_program_args = N_("DBFILE [COMMAND [ARG ...]]");
  78. +
  79. set_progname (argv[0]);
  80. #if GDBM_DEBUG_ENABLE
  81. gdbm_debug_printer = debug_printer;
  82. --
  83. 2.27.0