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