0020-locale.c-fix-build-without-wchar.patch 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. From 73ca494c60d46103f806325e6ccbe9e400238008 Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Sun, 23 Feb 2020 11:41:09 +0100
  4. Subject: [PATCH] locale.c: fix build without wchar
  5. bash unconditionally builds locale.c which depends on mblen since
  6. version 5.0 and
  7. https://github.com/bminor/bash/commit/d233b485e83c3a784b803fb894280773f16f2deb
  8. This results in the following build failure if wchar is not available:
  9. /home/buildroot/autobuild/run/instance-0/output-1/host/bin/microblazeel-buildroot-linux-uclibc-gcc -L./builtins -L/home/buildroot/autobuild/run/instance-0/output-1/host/microblazeel-buildroot-linux-uclibc/sysroot/lib -L/home/buildroot/autobuild/run/instance-0/output-1/host/microblazeel-buildroot-linux-uclibc/sysroot/lib -L./lib/glob -L./lib/tilde -L./lib/sh -rdynamic -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -Wno-parentheses -Wno-format-security -o bash shell.o eval.o y.tab.o general.o make_cmd.o print_cmd.o dispose_cmd.o execute_cmd.o variables.o copy_cmd.o error.o expr.o flags.o jobs.o subst.o hashcmd.o hashlib.o mailcheck.o trap.o input.o unwind_prot.o pathexp.o sig.o test.o version.o alias.o array.o arrayfunc.o assoc.o braces.o bracecomp.o bashhist.o bashline.o list.o stringlib.o locale.o findcmd.o redir.o pcomplete.o pcomplib.o syntax.o xmalloc.o signames.o -lbuiltins -lglob -lsh -lreadline -lhistory -lcurses -ltilde -ldl
  10. /home/buildroot/autobuild/run/instance-0/output-1/host/lib/gcc/microblazeel-buildroot-linux-uclibc/8.3.0/../../../../microblazeel-buildroot-linux-uclibc/bin/ld: locale.o: in function `set_default_locale':
  11. (.text+0x260): undefined reference to `mblen'
  12. To fix this issue, don't use mblen if HANDLE_MULTIBYTE is not defined,
  13. an other possibility would be to use MBLEN wrapper defined in shmbutil.h
  14. Fixes:
  15. - http://autobuild.buildroot.org/results/298fb9c785e137bff432dd304eb56986e54ce3ed
  16. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  17. [Upstream status: https://savannah.gnu.org/support/index.php?110200]
  18. ---
  19. locale.c | 10 ++++++++++
  20. 1 file changed, 10 insertions(+)
  21. diff --git a/locale.c b/locale.c
  22. index d62547f6..a64c5b4b 100644
  23. --- a/locale.c
  24. +++ b/locale.c
  25. @@ -86,7 +86,9 @@ set_default_locale ()
  26. locale_mb_cur_max = MB_CUR_MAX;
  27. locale_utf8locale = locale_isutf8 (default_locale);
  28. +#if defined (HANDLE_MULTIBYTE)
  29. locale_shiftstates = mblen ((char *)NULL, 0);
  30. +#endif
  31. }
  32. /* Set default values for LC_CTYPE, LC_COLLATE, LC_MESSAGES, LC_NUMERIC and
  33. @@ -107,7 +109,9 @@ set_default_locale_vars ()
  34. locale_setblanks ();
  35. locale_mb_cur_max = MB_CUR_MAX;
  36. locale_utf8locale = locale_isutf8 (lc_all);
  37. +# if defined (HANDLE_MULTIBYTE)
  38. locale_shiftstates = mblen ((char *)NULL, 0);
  39. +# endif
  40. u32reset ();
  41. }
  42. # endif
  43. @@ -211,7 +215,9 @@ set_locale_var (var, value)
  44. /* if LC_ALL == "", reset_locale_vars has already called this */
  45. if (*lc_all && x)
  46. locale_utf8locale = locale_isutf8 (lc_all);
  47. +# if defined (HANDLE_MULTIBYTE)
  48. locale_shiftstates = mblen ((char *)NULL, 0);
  49. +# endif
  50. u32reset ();
  51. return r;
  52. #else
  53. @@ -231,7 +237,9 @@ set_locale_var (var, value)
  54. /* if setlocale() returns NULL, the locale is not changed */
  55. if (x)
  56. locale_utf8locale = locale_isutf8 (x);
  57. +# if defined (HANDLE_MULTIBYTE)
  58. locale_shiftstates = mblen ((char *)NULL, 0);
  59. +# endif
  60. u32reset ();
  61. }
  62. # endif
  63. @@ -368,7 +376,9 @@ reset_locale_vars ()
  64. locale_mb_cur_max = MB_CUR_MAX;
  65. if (x)
  66. locale_utf8locale = locale_isutf8 (x);
  67. +# if defined (HANDLE_MULTIBYTE)
  68. locale_shiftstates = mblen ((char *)NULL, 0);
  69. +# endif
  70. u32reset ();
  71. #endif
  72. return 1;
  73. --
  74. 2.25.0