xref: /openbmc/openbmc/poky/meta/recipes-extended/bash/bash/mkbuiltins_have_stringize.patch (revision 8460358c3d24c71d9d38fd126c745854a6301564)
1*8460358cSPatrick WilliamsFrom d11685286144c2e5630545e435d11387b2908fd0 Mon Sep 17 00:00:00 2001
2*8460358cSPatrick WilliamsFrom: Christopher Larson <chris_larson@mentor.com>
3*8460358cSPatrick WilliamsDate: Wed, 14 Nov 2012 07:55:09 -0700
4*8460358cSPatrick WilliamsSubject: [PATCH] bash: fix mkbuiltins build failure
5*8460358cSPatrick Williams
6eb8dc403SDave CobbleyOn hosts with FORTIFY_SOURCES, stringize support is required, as it's used by
7eb8dc403SDave Cobbleythe macros to wrap functions (e.g. read and open in unistd.h). Those wrappers
8eb8dc403SDave Cobbleyuse the STRING() macro from unistd.h. A header in the bash sources overrides
9eb8dc403SDave Cobbleythe unistd.h macro to 'x' when HAVE_STRINGIZE is not defined, causing the
10eb8dc403SDave Cobbleywrappers to generate calls to 'xread' and 'xopen', which do not exist,
11eb8dc403SDave Cobbleyresulting in a failure to link.
12eb8dc403SDave Cobbley
13eb8dc403SDave CobbleyAssume we have stringize support when cross-compiling, which works around the
14eb8dc403SDave Cobbleyissue.
15eb8dc403SDave Cobbley
16eb8dc403SDave CobbleyIt may be best for upstream to either give up on supporting compilers without
17eb8dc403SDave Cobbleystringize support, or to not define STRING() at all when FORTIFY_SOURCES is
18eb8dc403SDave Cobbleydefined, letting the unistd.h one be used, instead.
19eb8dc403SDave Cobbley
20eb8dc403SDave CobbleyUpstream-Status: Pending
21*8460358cSPatrick Williams---
22*8460358cSPatrick Williams builtins/mkbuiltins.c | 1 +
23*8460358cSPatrick Williams 1 file changed, 1 insertion(+)
24eb8dc403SDave Cobbley
25*8460358cSPatrick Williamsdiff --git a/builtins/mkbuiltins.c b/builtins/mkbuiltins.c
26*8460358cSPatrick Williamsindex f505ebd..b5b2eed 100644
27*8460358cSPatrick Williams--- a/builtins/mkbuiltins.c
28*8460358cSPatrick Williams+++ b/builtins/mkbuiltins.c
29eb8dc403SDave Cobbley@@ -28,6 +28,7 @@
30eb8dc403SDave Cobbley #  define HAVE_STDLIB_H
31eb8dc403SDave Cobbley
32eb8dc403SDave Cobbley #  define HAVE_RENAME
33eb8dc403SDave Cobbley+#  define HAVE_STRINGIZE
34eb8dc403SDave Cobbley #endif /* CROSS_COMPILING */
35eb8dc403SDave Cobbley
36eb8dc403SDave Cobbley #if defined (HAVE_UNISTD_H)
37