On Mon, Jul 16, 2012 at 06:54:38PM +0400, Michael Tokarev wrote: > On 16.07.2012 12:56, Aurelien Jarno wrote: > > Some messages strings are defined with ALIGN1 in libbb/messages.c > > to make sure strings are not aligned and thus to save some bytes. The > > corresponding declaration in include/libbb.h should also use ALIGN1, > > otherwise the compiler may assume they are aligned and generate wrong > > code to access them. This is the case on at least s390x. > > > > Signed-off-by: Aurelien Jarno <[email protected]> > > --- > > include/libbb.h | 36 ++++++++++++++++++------------------ > > 1 file changed, 18 insertions(+), 18 deletions(-) > > > > diff --git a/include/libbb.h b/include/libbb.h > > index 322a28c..f22e58e 100644 > > --- a/include/libbb.h > > +++ b/include/libbb.h > > @@ -1612,8 +1612,8 @@ unsigned get_cpu_count(void) FAST_FUNC; > > char *percent_decode_in_place(char *str, int strict) FAST_FUNC; > > > > > > -extern const char bb_uuenc_tbl_base64[]; > > -extern const char bb_uuenc_tbl_std[]; > > +extern const char bb_uuenc_tbl_base64[] ALIGN1; > > +extern const char bb_uuenc_tbl_std[] ALIGN1; > > I wonder whenever changing all these from arrays to > pointers is a good idea? Compiler should not assume > any alignments about pointer to char, unlike an array, > I think. > > I mean, > > -extern const char bb_uuenc_tbl_base64[]; > +extern const char *bb_uuenc_tbl_base64; > > Besides, this, and a few others (bb_hexdigits_upcase), > might be better without alignment. >
I confirm this solution also works on s390x, but it implies also changing the definitions of the strings in libbb/messages.c, otherwise GCC is unhappy about the change. -- Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
