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

Marcin Kościelnicki koriakin@0x04.net
Sun Sep 27 13:26:00 GMT 2015


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"
-- 
2.5.3



More information about the Libc-alpha mailing list