|
|
c6d234 |
commit 27822ce67fbf7f2b204992a410e7da2e8c1e2607
|
|
|
c6d234 |
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
|
|
|
c6d234 |
Date: Wed Mar 26 15:37:35 2014 -0500
|
|
|
c6d234 |
|
|
|
c6d234 |
Define _STRING_ARCH_unaligned unconditionally
|
|
|
c6d234 |
|
|
|
c6d234 |
This patch defines _STRING_ARCH_unaligned to 0 on default bits/string.h
|
|
|
c6d234 |
header to avoid undefined compiler warnings on platforms that do not
|
|
|
c6d234 |
define it. It also make adjustments in code where tests checked if macro
|
|
|
c6d234 |
existed or not.
|
|
|
c6d234 |
|
|
|
c6d234 |
Conflicts:
|
|
|
c6d234 |
resolv/res_send.c
|
|
|
c6d234 |
|
|
|
c6d234 |
Conflict due to stub resolver rebase in glibc-rh677316-resolv.patch.
|
|
|
c6d234 |
|
|
|
c6d234 |
diff --git a/bits/string.h b/bits/string.h
|
|
|
c6d234 |
index f8630d2c52a9298a..b88a6bc601803f68 100644
|
|
|
c6d234 |
--- a/bits/string.h
|
|
|
c6d234 |
+++ b/bits/string.h
|
|
|
c6d234 |
@@ -8,5 +8,7 @@
|
|
|
c6d234 |
#ifndef _BITS_STRING_H
|
|
|
c6d234 |
#define _BITS_STRING_H 1
|
|
|
c6d234 |
|
|
|
c6d234 |
+/* Define if architecture can access unaligned multi-byte variables. */
|
|
|
c6d234 |
+#define _STRING_ARCH_unaligned 0
|
|
|
c6d234 |
|
|
|
c6d234 |
#endif /* bits/string.h */
|
|
|
c6d234 |
diff --git a/crypt/sha256.c b/crypt/sha256.c
|
|
|
c6d234 |
index aea94651391f19ae..1cbd2bc8381d6778 100644
|
|
|
c6d234 |
--- a/crypt/sha256.c
|
|
|
c6d234 |
+++ b/crypt/sha256.c
|
|
|
c6d234 |
@@ -124,7 +124,7 @@ __sha256_finish_ctx (ctx, resbuf)
|
|
|
c6d234 |
memcpy (&ctx->buffer[bytes], fillbuf, pad);
|
|
|
c6d234 |
|
|
|
c6d234 |
/* Put the 64-bit file length in *bits* at the end of the buffer. */
|
|
|
c6d234 |
-#ifdef _STRING_ARCH_unaligned
|
|
|
c6d234 |
+#if _STRING_ARCH_unaligned
|
|
|
c6d234 |
ctx->buffer64[(bytes + pad) / 8] = SWAP64 (ctx->total64 << 3);
|
|
|
c6d234 |
#else
|
|
|
c6d234 |
ctx->buffer32[(bytes + pad + 4) / 4] = SWAP (ctx->total[TOTAL64_low] << 3);
|
|
|
c6d234 |
diff --git a/iconv/gconv_simple.c b/iconv/gconv_simple.c
|
|
|
c6d234 |
index 48932ee695083595..03fa5f2e2c771ebc 100644
|
|
|
c6d234 |
--- a/iconv/gconv_simple.c
|
|
|
c6d234 |
+++ b/iconv/gconv_simple.c
|
|
|
c6d234 |
@@ -112,7 +112,7 @@ internal_ucs4_loop (struct __gconv_step *step,
|
|
|
c6d234 |
return result;
|
|
|
c6d234 |
}
|
|
|
c6d234 |
|
|
|
c6d234 |
-#ifndef _STRING_ARCH_unaligned
|
|
|
c6d234 |
+#if !_STRING_ARCH_unaligned
|
|
|
c6d234 |
static inline int
|
|
|
c6d234 |
__attribute ((always_inline))
|
|
|
c6d234 |
internal_ucs4_loop_unaligned (struct __gconv_step *step,
|
|
|
c6d234 |
@@ -289,7 +289,7 @@ ucs4_internal_loop (struct __gconv_step *step,
|
|
|
c6d234 |
return result;
|
|
|
c6d234 |
}
|
|
|
c6d234 |
|
|
|
c6d234 |
-#ifndef _STRING_ARCH_unaligned
|
|
|
c6d234 |
+#if !_STRING_ARCH_unaligned
|
|
|
c6d234 |
static inline int
|
|
|
c6d234 |
__attribute ((always_inline))
|
|
|
c6d234 |
ucs4_internal_loop_unaligned (struct __gconv_step *step,
|
|
|
c6d234 |
@@ -478,7 +478,7 @@ internal_ucs4le_loop (struct __gconv_step *step,
|
|
|
c6d234 |
return result;
|
|
|
c6d234 |
}
|
|
|
c6d234 |
|
|
|
c6d234 |
-#ifndef _STRING_ARCH_unaligned
|
|
|
c6d234 |
+#if !_STRING_ARCH_unaligned
|
|
|
c6d234 |
static inline int
|
|
|
c6d234 |
__attribute ((always_inline))
|
|
|
c6d234 |
internal_ucs4le_loop_unaligned (struct __gconv_step *step,
|
|
|
c6d234 |
@@ -660,7 +660,7 @@ ucs4le_internal_loop (struct __gconv_step *step,
|
|
|
c6d234 |
return result;
|
|
|
c6d234 |
}
|
|
|
c6d234 |
|
|
|
c6d234 |
-#ifndef _STRING_ARCH_unaligned
|
|
|
c6d234 |
+#if !_STRING_ARCH_unaligned
|
|
|
c6d234 |
static inline int
|
|
|
c6d234 |
__attribute ((always_inline))
|
|
|
c6d234 |
ucs4le_internal_loop_unaligned (struct __gconv_step *step,
|
|
|
c6d234 |
diff --git a/iconv/loop.c b/iconv/loop.c
|
|
|
c6d234 |
index e11e86b5ecd4abd9..7b2499a3d0657265 100644
|
|
|
c6d234 |
--- a/iconv/loop.c
|
|
|
c6d234 |
+++ b/iconv/loop.c
|
|
|
c6d234 |
@@ -63,7 +63,7 @@
|
|
|
c6d234 |
representations with a fixed width of 2 or 4 bytes. But if we cannot
|
|
|
c6d234 |
access unaligned memory we still have to read byte-wise. */
|
|
|
c6d234 |
#undef FCTNAME2
|
|
|
c6d234 |
-#if defined _STRING_ARCH_unaligned || !defined DEFINE_UNALIGNED
|
|
|
c6d234 |
+#if _STRING_ARCH_unaligned || !defined DEFINE_UNALIGNED
|
|
|
c6d234 |
/* We can handle unaligned memory access. */
|
|
|
c6d234 |
# define get16(addr) *((const uint16_t *) (addr))
|
|
|
c6d234 |
# define get32(addr) *((const uint32_t *) (addr))
|
|
|
c6d234 |
@@ -342,7 +342,7 @@ FCTNAME (LOOPFCT) (struct __gconv_step *step,
|
|
|
c6d234 |
|
|
|
c6d234 |
/* Include the file a second time to define the function to handle
|
|
|
c6d234 |
unaligned access. */
|
|
|
c6d234 |
-#if !defined DEFINE_UNALIGNED && !defined _STRING_ARCH_unaligned \
|
|
|
c6d234 |
+#if !defined DEFINE_UNALIGNED && !_STRING_ARCH_unaligned \
|
|
|
c6d234 |
&& MIN_NEEDED_INPUT != 1 && MAX_NEEDED_INPUT % MIN_NEEDED_INPUT == 0 \
|
|
|
c6d234 |
&& MIN_NEEDED_OUTPUT != 1 && MAX_NEEDED_OUTPUT % MIN_NEEDED_OUTPUT == 0
|
|
|
c6d234 |
# undef get16
|
|
|
c6d234 |
diff --git a/iconv/skeleton.c b/iconv/skeleton.c
|
|
|
c6d234 |
index 934b1fdde8d277df..176436a4c81f071b 100644
|
|
|
c6d234 |
--- a/iconv/skeleton.c
|
|
|
c6d234 |
+++ b/iconv/skeleton.c
|
|
|
c6d234 |
@@ -203,7 +203,7 @@
|
|
|
c6d234 |
/* Define macros which can access unaligned buffers. These macros are
|
|
|
c6d234 |
supposed to be used only in code outside the inner loops. For the inner
|
|
|
c6d234 |
loops we have other definitions which allow optimized access. */
|
|
|
c6d234 |
-#ifdef _STRING_ARCH_unaligned
|
|
|
c6d234 |
+#if _STRING_ARCH_unaligned
|
|
|
c6d234 |
/* We can handle unaligned memory access. */
|
|
|
c6d234 |
# define get16u(addr) *((const uint16_t *) (addr))
|
|
|
c6d234 |
# define get32u(addr) *((const uint32_t *) (addr))
|
|
|
c6d234 |
@@ -522,7 +522,7 @@ FUNCTION_NAME (struct __gconv_step *step, struct __gconv_step_data *data,
|
|
|
c6d234 |
INTERNAL, for which the subexpression evaluates to 1, but INTERNAL
|
|
|
c6d234 |
buffers are always aligned correctly. */
|
|
|
c6d234 |
#define POSSIBLY_UNALIGNED \
|
|
|
c6d234 |
- (!defined _STRING_ARCH_unaligned \
|
|
|
c6d234 |
+ (!_STRING_ARCH_unaligned \
|
|
|
c6d234 |
&& (((FROM_LOOP_MIN_NEEDED_FROM != 1 \
|
|
|
c6d234 |
&& FROM_LOOP_MAX_NEEDED_FROM % FROM_LOOP_MIN_NEEDED_FROM == 0) \
|
|
|
c6d234 |
&& (FROM_LOOP_MIN_NEEDED_TO != 1 \
|
|
|
c6d234 |
diff --git a/nscd/nscd_gethst_r.c b/nscd/nscd_gethst_r.c
|
|
|
c6d234 |
index 41488ed6c033ffcd..5fe9f2f62fa28fd4 100644
|
|
|
c6d234 |
--- a/nscd/nscd_gethst_r.c
|
|
|
c6d234 |
+++ b/nscd/nscd_gethst_r.c
|
|
|
c6d234 |
@@ -190,7 +190,7 @@ nscd_gethst_r (const char *key, size_t keylen, request_type type,
|
|
|
c6d234 |
goto out;
|
|
|
c6d234 |
}
|
|
|
c6d234 |
|
|
|
c6d234 |
-#ifndef _STRING_ARCH_unaligned
|
|
|
c6d234 |
+#if !_STRING_ARCH_unaligned
|
|
|
c6d234 |
/* The aliases_len array in the mapped database might very
|
|
|
c6d234 |
well be unaligned. We will access it word-wise so on
|
|
|
c6d234 |
platforms which do not tolerate unaligned accesses we
|
|
|
c6d234 |
diff --git a/nscd/nscd_getserv_r.c b/nscd/nscd_getserv_r.c
|
|
|
c6d234 |
index acf7e22f82582dbb..5880b1bc023d1c02 100644
|
|
|
c6d234 |
--- a/nscd/nscd_getserv_r.c
|
|
|
c6d234 |
+++ b/nscd/nscd_getserv_r.c
|
|
|
c6d234 |
@@ -140,7 +140,7 @@ nscd_getserv_r (const char *crit, size_t critlen, const char *proto,
|
|
|
c6d234 |
> recend, 0))
|
|
|
c6d234 |
goto out;
|
|
|
c6d234 |
|
|
|
c6d234 |
-#ifndef _STRING_ARCH_unaligned
|
|
|
c6d234 |
+#if !_STRING_ARCH_unaligned
|
|
|
c6d234 |
/* The aliases_len array in the mapped database might very
|
|
|
c6d234 |
well be unaligned. We will access it word-wise so on
|
|
|
c6d234 |
platforms which do not tolerate unaligned accesses we
|
|
|
c6d234 |
diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c
|
|
|
c6d234 |
index 96fb93db768703cc..a46047b1fa0d502e 100644
|
|
|
c6d234 |
--- a/nscd/nscd_helper.c
|
|
|
c6d234 |
+++ b/nscd/nscd_helper.c
|
|
|
c6d234 |
@@ -489,7 +489,7 @@ __nscd_cache_search (request_type type, const char *key, size_t keylen,
|
|
|
c6d234 |
struct hashentry *here = (struct hashentry *) (mapped->data + work);
|
|
|
c6d234 |
ref_t here_key, here_packet;
|
|
|
c6d234 |
|
|
|
c6d234 |
-#ifndef _STRING_ARCH_unaligned
|
|
|
c6d234 |
+#if !_STRING_ARCH_unaligned
|
|
|
c6d234 |
/* Although during garbage collection when moving struct hashentry
|
|
|
c6d234 |
records around we first copy from old to new location and then
|
|
|
c6d234 |
adjust pointer from previous hashentry to it, there is no barrier
|
|
|
c6d234 |
@@ -511,7 +511,7 @@ __nscd_cache_search (request_type type, const char *key, size_t keylen,
|
|
|
c6d234 |
struct datahead *dh
|
|
|
c6d234 |
= (struct datahead *) (mapped->data + here_packet);
|
|
|
c6d234 |
|
|
|
c6d234 |
-#ifndef _STRING_ARCH_unaligned
|
|
|
c6d234 |
+#if !_STRING_ARCH_unaligned
|
|
|
c6d234 |
if ((uintptr_t) dh & (__alignof__ (*dh) - 1))
|
|
|
c6d234 |
return NULL;
|
|
|
c6d234 |
#endif
|
|
|
c6d234 |
@@ -535,7 +535,7 @@ __nscd_cache_search (request_type type, const char *key, size_t keylen,
|
|
|
c6d234 |
struct hashentry *trailelem;
|
|
|
c6d234 |
trailelem = (struct hashentry *) (mapped->data + trail);
|
|
|
c6d234 |
|
|
|
c6d234 |
-#ifndef _STRING_ARCH_unaligned
|
|
|
c6d234 |
+#if !_STRING_ARCH_unaligned
|
|
|
c6d234 |
/* We have to redo the checks. Maybe the data changed. */
|
|
|
c6d234 |
if ((uintptr_t) trailelem & (__alignof__ (*trailelem) - 1))
|
|
|
c6d234 |
return NULL;
|