This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][BZ 18960] setlocale.c: Mark *_used symbols as unaligned.


On Sun, Sep 27, 2015 at 03:26:25PM +0200, Marcin KoÅcielnicki wrote:
> This ensures that compiler doesn't get the values of these symbols
> using instructions that have alignment requirements (eg. larl on s390).
> ---
>  locale/setlocale.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/locale/setlocale.c b/locale/setlocale.c
> index ead030d..028496d 100644
> --- a/locale/setlocale.c
> +++ b/locale/setlocale.c
> @@ -35,7 +35,7 @@
>     Also use a weak reference for the _nl_current_CATEGORY thread variable.  */
>  
>  # define DEFINE_CATEGORY(category, category_name, items, a) \
> -    extern char _nl_current_##category##_used; \
> +    extern char _nl_current_##category##_used __attribute__((__aligned__(1))); \
>      weak_extern (_nl_current_##category##_used) \
>      weak_extern (_nl_current_##category)
>  # include "categories.def"

Can you explain how/why you think this is needed? char has no
alignment requirements (inherently) so as far as I can tell, the
compiler may not make any alignment assumptions about an extern object
of type char.

Rich


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]